4 Replies Latest reply on May 5, 2014 12:57 PM by bill_tex

    Galileo  SoC via Python (or Linux Shell)

    bill_tex

      I am trying to read GPIO via python. The normal IO via Cypress controller is pretty slow -- about 3 ms poll time in Python.

       

      I want to read the SoC versions of IO2 and IO3. This is the pinMode INPUT_FAST in Arduino. I am assuming this is using SoC IO.


      I cannot read input on IO2 or IO3 when I put it in SoC mode, though I can via Cypress mode. Any Pointers?

       

      Here's what I tried:

       

      Steps to enable SoC mode for IO2:

      1. Setup MUX control hardware so I/O goes to SoC

      2. Setup GPIO14 for IO2

       

      So from what I understand so far, I set the mode of the IO:

       

      Init GPIO 31 as output and set low to select IO2 to use SoC

      echo "31" >/sys/class/gpio/export

      echo "out" >/sys/class/gpio/gpio31/direction

      echo "0" > /sys/class/gpio/gpio31/value

      cat /sys/class/gpio/gpio31/value  <--- 0, good.

       

      Now set up GPIO 14 as input:

       

      echo "14" >/sys/class/gpio/export

      echo "in" >/sys/class/gpio/gpio14/direction

      cat /sys/class/gpio/gpio14/value

       

      This does not read changes on IO2. However I can toggle the pull up resistor and it DOES detect this change:

       

      echo "0" >/sys/class/gpio/export

      echo "out" >/sys/class/gpio/gpio0/direction

      echo "0" >/sys/class/gpio/gpio0/value  <--- disables the pull up resistor

       

      cat /sys/class/gpio/gpio14/value  <----- shows 0

      echo "0" >/sys/class/gpio/gpio0/value  <--- enables the pull up resistor

      cat /sys/class/gpio/gpio14/value  <----- shows 1

       

      So the input is getting from the pull up resistor to processor. But not from IO2 to the processor.

       

      however changing to Cypress

       

      echo "1" > /sys/class/gpio/gpio31/value

       

      now enabling the Cypress Input

       

      echo "32" >/sys/class/gpio/export

      echo "in" >/sys/class/gpio/gpio32/direction

      cat /sys/class/gpio/gpio32/value

       

      This responds correctly to changes in input value.

       

      Am I missing something here?

      I based my settings on information from Intel Galileo - Programming GPIO From Linux - Malinov Family Web Presence