0 Replies Latest reply on Sep 9, 2014 6:22 PM by MarkBunney_Intel

    Mapping for digital and analog Arduino pins

    MarkBunney_Intel

      Here's a simplified mapping of which GPIO lines you need to change in order to use the Arduino headers as inputs and outputs.


      Example: Toggle digital pin 7

      Export the following GPIO to control the pull up/down resistor, level shifter direction, and native GPIO, respectively:

           echo -n "223" > /sys/class/gpio/export

           echo -n "255" > /sys/class/gpio/export

           echo -n "48" > /sys/class/gpio/export


      Make sure the pull up/down resistor is disabled:

           echo -n "in" > /sys/class/gpio/gpio223/direction

       

      Set the level shifter to transmit from the native GPIO to DIG7 (A to B in the schematic) by outputting a high voltage:

           echo -n "out" > /sys/class/gpio/gpio255/direction

           echo -n "1" > /sys/class/gpio/gpio255/value

       

      Set the native GPIO output the desired voltage:

           echo -n "out" > /sys/class/gpio/gpio48/direction

           echo -n "1" > /sys/class/gpio/gpio48/value

           echo -n "0" > /sys/class/gpio/gpio48/value

           echo -n "1" > /sys/class/gpio/gpio48/value

       

       

      Example: Use digital pin 7 as input

      If you haven't already, export the following GPIO:

           echo -n "223" > /sys/class/gpio/export

           echo -n "255" > /sys/class/gpio/export

           echo -n "48" > /sys/class/gpio/export


      Configure resistor as a pull-up:

           echo -n "out" > /sys/class/gpio/gpio223/direction

           echo -n "1" > /sys/class/gpio/gpio223/value

       

      Set the level shifter to transmit from DIG 7 to the native GPIO (B to A in the schematic) by outputting a low voltage:

           echo -n "out" > /sys/class/gpio/gpio255/direction

           echo -n "0" > /sys/class/gpio/gpio255/value

       

      Set the native GPIO to an input and read the value (should return 1):

           echo -n "in" > /sys/class/gpio/gpio48/direction

           cat /sys/class/gpio/gpio48/value

       

      Configure resistor as a pull-down and read again (should return 0):

           echo -n "0" > /sys/class/gpio/gpio223/value

           cat /sys/class/gpio/gpio48/value

       

       

       

      Document Revisions
      Rev 14ww33.1
           -Corrected GPIO for DIG13 mux from 259 to 243

           -Moved labels SPI_FS_SEL and SPI_TXD_SEL to the leftmost mux

           -added a color PDF