Arduino Dock 2 - A5/A4 Pins & SPI



  • Am I crazy or do the A5 and A4 pins not function as Digital inputs/outputs? Unless I have done something to wreck two boards... which is possible i guess. Any one have any info on this?

    I have tried these pins on my Uno dock and they function as expected as Analog inputs, and Digital Inputs/Outputs with both INPUT and INPUT_PULLUP settings.

    The documents say the dock functions exactly like an Uno, which is the same except for the mcu package.

    EDIT:

    So looking at the schematic it looks like it has to do with the Omega I2C connection through the TXS0108E level shifter chip. I have added to rc.local:
    omega2-ctrl gpiomux set i2c gpio
    But I am still unable to successfully pull the pin to ground through a 10k resistor... the pin stays at around 3.5V



  • So looking at this post http://community.onion.io/topic/2500/arduino-dock-2-analog-read-issue it seems there is no way to fix this without cutting traces.

    It sure would be useful to have a bit of a warning in the documentation that these pins are pretty much useless... something in a large red font detailing pins that can't be used would be nice.



  • @Jon-Gordon So you have already read this thread Arduino Dock 2 Analog Read Issue :-)

    But I am still unable to successfully pull the pin to ground through a 10k resistor... the pin stays at around 3.5V

    With a resistive divider you was able to determine that the TXS0108E pin is open drain and really has a 4kΩ pull up resistor inside when it is driving high :
    (10kΩ * 5V / 3.5V) - 10kΩ = ~4kΩ
    10 kΩ / (4kΩ  + 10kΩ) * 5V = ~3.5V

    IMHO some jumpers are missing from the Arduino Dock 2 by design - this is one of them (between the OE pin of TXS0108E and GND).



  • @György-Farkas
    I am also trying to use the SPI port on the arduino.... but alas it is also connected through the voltage converter.

    Is there a trick (like maybe setting the Omega SPI port to gpio) that I can use so that the arduino's SPI port is usable????

    As it stands now my Arduino SPI port works fine (Its hooked up to a lora radio) until the omega fully boots... then it seems all comms end from the arduino to the radio.

    If I am also unable to use the arduino SPI port, I'm gonna smash this god damn thing with a hammer.



  • @Jon-Gordon said in Arduino Dock 2 - A5/A4 Pins & SPI:

    Is there a trick (like maybe setting the Omega SPI port to gpio) that I can use so that the arduino's SPI port is usable????

    avrdude uses Omega's GPIO 15, 16, 17, 19 in '/usr/share/arduino-dock/avrdude.conf'

     ...
    
    #
    # PROGRAMMER DEFINITIONS
    #
    
    #This programmer bitbangs GPIO lines using the Linux sysfs GPIO interface
    #
    #To enable it set the configuration below to match the GPIO lines connected to the
    #relevant ISP header pins and uncomment the entry definition. In case you don't
    #have the required permissions to edit this system wide config file put the
    #entry in a separate <your name>.conf file and use it with -C+<your name>.conf
    #on the command line.
    #
    #To check if your avrdude build has support for the linuxgpio programmer compiled in,
    #use -c?type on the command line and look for linuxgpio in the list. If it's not available
    #you need pass the --enable-linuxgpio=yes option to configure and recompile avrdude.
    #
    programmer
      id    = "linuxgpio";
      desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
      type  = "linuxgpio";
      reset = ~ 19;
      sck   = 15;
      mosi  = 16;
      miso  = 17;
    ;
      ...
    

    and it sets those GPIOs in '/usr/share/arduino-dock/arduino-dock-lib.sh'

     ...
    
    # set avrdude linuxgpio pins to output
    _SetAvrPins () {
            if  [ "$(GetDeviceType)" == "$DEVICE_OMEGA2" ] ||
                [ "$(GetDeviceType)" == "$DEVICE_OMEGA2P" ];
            then
                    omega2-ctrl gpiomux set pwm1 gpio >& /dev/null
            fi
    
            gpioctl dirout 15 >& /dev/null
            gpioctl dirout 16 >& /dev/null
            gpioctl dirout 17 >& /dev/null
            gpioctl dirout 19 >& /dev/null
    }
    
    # flash application
    #       arg1    - path to application hex file
    _FlashApplication () {
            # set avrdude gpio pins to output
            _SetAvrPins
    
     ...
    

    You should set those GPIOs to input if you don't want to flash the ATmega (the Arduino) and use the original settings if you want to flash it.



  • @György-Farkas thanks for the response... i will give that a try and report back.



  • @Jon-Gordon

    BTW The setting of Omega's bitbang MISO pin (GPIO17) in '/usr/share/arduino-dock/arduino-dock-lib.sh' is wrong.
    Try to change it

    gpioctl dirin 17 >& /dev/null

    See also Output vs. Output on Arduino Dock 2



  • @György-Farkas
    So this doesn't do anything.... I'm pretty sure this script doesn't get called until you actually program the mcu... and I believe the pins get reset by the omega after the script runs.

    I think the issue here is I'm holding my radio IC's Chip Select pin high (to communicate with it from the arduino) and at the same time the omega is also trying to use the bus, since these two are connected and since the omega uses the spi bus to communicate with flash memory there is really no way to turn it off, with the omega still remaining useful.

    I could be wrong but from all the tests I've done this seems to be the case. It just seems odd that they would break these pins out when they are totally useless on the arduino side.


  • administrators

    @Jon-Gordon Regarding the I2C pins and using them with the ATmega MCU, it's possible and you were on the right track.
    You first need to set the Omega's I2C pins to act like GPIOs (which you did) with omega2-ctrl gpiomux set i2c gpio.
    Then you'll need to set them to act as input GPIOs:

    gpioctl dirin 4
    gpioctl dirin 5
    

    This is crucial since the Omega will then allow these pins to float, giving the MCU an opportunity to become the I2C bus master.

    For the SPI pins, yes, GPIOs 15, 16, 17 on the Omega are used to flash the MCU and are connected to the MCU's SPI pins. You can use the same gpioctl dirin command on the Omega to free the MCU's SPI lines.
    Just note that your SPI device will probably need to be disconnected if you want to flash the MCU again, and you'll have to rerun the gpioctl dirin commands after you flash the MCU.

    Note that GPIOs 15, 16, 17 are just GPIOs and setting them to inputs will not affect communication with the Omega's internal flash storage. That's done with the hardware SPI on GPIOs 7, 8, 9.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.