Can't write GPIO value from terminal

Discussion in 'Troubleshooting' started by ajdale, Apr 24, 2014.

  1. ajdale

    ajdale New Member

    Apr 17, 2014
    Likes Received:
    Hi everyone

    I am trying to write my GPIO pin values from terminal. However, attempting to set the value of a GPIO pin does nothing. Setting the direction of the GPIO pin to 'out' and then writing the value with 'echo 1 > value' doesn't actually change the value. 'cat value' prints 0.

    I am using physical pin 11 (gpio9) however it affects many other pins as well. I haven't tried absolutely every single one.

    My permissions on the file are set correctly as far as I can tell, and no resource is in use by any process:


    This shows the problem:


    It also appears not to be an inconsistency with between pin and file state, as the LED I have plugged into the physical pin does not illuminate either. I had it working briefly the other day. Any ideas on why toggling the values is not working would be appreciated.

    What can cause this issue? I am on Linaro Ubuntu 12.04.

    After doing some testing I switched to Debian, where the issue did not appear.
    I ran the exact same commands as above, and while I noticed an inconsistency between the physical state of the pin and the value of the "value" file, the pin itself did turn the LED on.

    Switching back to Ubuntu afterwards gave the same results. Pin physically works, but value file is incorrect.

    So I suppose the question has changed to: What could cause this to happen? Previously my UDOO was running for a couple days before I found the GPIO pins were not working period.
  2. udooquestions

    udooquestions New Member

    Apr 7, 2014
    Likes Received:
    I'm having the exact same problem. Nothing I do makes the state in the /value file change. I've tried it both on Linaro Ubuntu 12.04 and UDOObuntu Beta 2.

    Since the time that you've posted this question, have you gotten any further insight as to what may be causing this? (I haven't been able to get UDOO support give me any clues yet).
  3. ekirei

    ekirei Administrator

    Jun 14, 2013
    Likes Received:

    the GPIOs can be set in output or in input.

    When you set the GPIO in output you can change the value by echo in the value file but you can't read the value of the pin you set because you are in output mode. The value you read with cat is random or always 0, i don't know exactly, however the value is not the one you expected.

    When you set the GPIO in input you can read the value file with cat and see the right logical level (1 or 0) but it isn't the same value you set when the pin was in output because the pin mode is now changed in input. Probably you are now reading the value imposed to the pin by the Arduino side or by an external voltage.

    if you want to test the physycal and files pins are working right you need to connect two pins and set one in output and one in input.

Share This Page