4 Replies Latest reply on Jul 25, 2015 2:42 AM by mercurywaters

    GPIO ports on J13 connector


      Hello all!


      We want to setup the external gpio on RIOTBOARD and we get stuck with mux procedure. We want to use all GPIO from J13 connector.



      This is the only GPIO  that works:

      root@RIoTboard_6solo:/ # devmem2 0x20E009C w 0x5

      /dev/mem opened.

      Memory mapped at address 0x400fc000.

      Value at address 0x20E009C (0x400fc09c): 0x5

      Written 0x5; readback 0x5

      root@RIoTboard_6solo:/ # echo 112 > /sys/class/gpio/export

      1|root@RIoTboard_6solo:/ # echo out > /sys/class/gpio/gpio112/direction

      root@RIoTboard_6solo:/ # echo 1 > /sys/class/gpio/gpio112/value

      And the rest of them doesn't work


      We try to set GPIO5_08 to output (that means SW_PAD_CTL_PAD_DISP0_DATA14)

      root@RIoTboard_6solo:/ # devmem2 0x20E03DC w 0x5

      /dev/mem opened.

      Memory mapped at address 0x40180000.

      Value at address 0x20E03DC (0x401803dc): 0x1

      Written 0x5; readback 0x1

      --->All time  we get 0x1 even we write 0x5 (ALT5 -MUX mode)


      The problem: 

      We can't set the GPIO as output or input. Maybe we need to set somehow the SION first?

      Any idea?


      Thx in advance!


        • Re: GPIO ports on J13 connector

          There's no need to (re)compile anything, beyond a copy of devmem2.


          I'm using GPIO port 112, 113, 114 and 115 on my RiotBoard w/ the stock android on the system. (Successfully I might add.)


          Snipping bits of my scripts....


          initgpio 112 0x20e009c

          initgpio 113 0x20e00a0

          initgpio 114 0x20e00a4

          initgpio 115 0x20e00a8


          initgpio() is a simple subroutine that:






          initgpio() {






                  if [ -d "$PORTPATH" ]; then

                          echo "GPIO ${portloc} already initialized.."




                  echo $portloc  > "$GPIOBASE/export"

                  echo "out"      > "$PORTPATH/direction"

                  echo 1          > "$PORTPATH/active_low"                # So that a value of "1" means a relay that is on.


                  $DEVMEM2 $memloc w 0x5 > /dev/null 2>&1

                  sleep 1


                  $SCRPATH/setvalue-gpio.sh "${portloc}" 0                        # Initialize the ports value.  (0 = off)


                  echo "GPIO $portloc initialized.."






          setvalue-gpio.sh is little more than:


          setvaluegpio() {






            echo $value > "$PORTPATH/value"



          There is, of course some better error handling, but nothing of significance, and its been deleted in the hopes of better clarity.    It twiddles some relays I've connected up to the GPIO ports on mine well enought...


          Hope this helps someone in the future....



            • Re: GPIO ports on J13 connector

              Hi David,


              You might eb abel to help me here.  I'm able to use the command  "echo 1 > /sys/class/leds/user_led/brightness" in my Android code to turn the build-in LED on and off.  However, can't get any success on GPIO pins.  I have a question for you.  Where to get the copy of devmem2?  I am able to get few versions of source code, but can't get it compiled.  Can you share your copy of devmem2 that works with your code?


              Shine On!