2 Replies Latest reply on Jul 13, 2015 9:43 AM by dump_truck

    Edison GPIO pin configuration on boot

    dump_truck

      Hey everybody,

       

      I'm using the Edison's GPIOs to control several transistors, which control a motor and a tri-color LED. The default state for a GPIO on boot seems to be 'in' for direction, with a high-impedance state. I'd like to have them set to 'out' with a value of 0 on boot so that my motor and LED will both be turned off, given all the circuit-business that can pull a high-z pin to 1. The pins in question are 12, 13, 182, and 183 (pwms 0,1,2, and 3).

       

      I can easily change the pin config in runtime through the console/c programs by running a series of commands like:

       

      echo 12 > export

      echo out > direction

       

      but these configurations are wiped on reboot.

       

      I've written scripts to set the configuration and run them at boot by attaching them to init.d, but the delay between the actual boot and when these scripts are executed can be on the order of seconds. This is way too long to have a motor running on startup.

       

      My question is whether there's any way to set the default pin configuration so that it persists between boots without having to run a delayed script each time the Edison starts up?

       

      Thanks,

      Peter