locked
Raspberry Pi GPIO state at boot. RRS feed

  • Question

  • Is there a way to set the GPIO state at boot? Currently GPIO pins seem to be set to output and high at boot, and only change when my(startup) app runs. In my case, it would be nice is the GPIO pins would stay as high-impedance inputs during boot, until my app initialises them in the correct state for the attached components.

    Thanks,

    Pieter

    Saturday, May 2, 2015 8:23 PM

Answers

  • The BCM2836 SOC has well-defined power on reset states for pins, which are documented in the datasheet and in this table:

    http://elinux.org/RPi_BCM2835_GPIOs

    There is no way to change the power-on reset state of a pin. When the SOC powers on, the pins will always be in this state.

    All of the pins on Raspberry Pi are inputs by default, and have either a pull up or pull down resistor enabled. I think the high state you're seeing is the pull up resistor.

    When you open pin, it is in its power-on reset state. Windows doesn't touch the pins until you open them and explicitly change them by calling SetDriveMode() or Write(). 


    Tuesday, May 5, 2015 3:38 AM

All replies

  • The BCM2836 SOC has well-defined power on reset states for pins, which are documented in the datasheet and in this table:

    http://elinux.org/RPi_BCM2835_GPIOs

    There is no way to change the power-on reset state of a pin. When the SOC powers on, the pins will always be in this state.

    All of the pins on Raspberry Pi are inputs by default, and have either a pull up or pull down resistor enabled. I think the high state you're seeing is the pull up resistor.

    When you open pin, it is in its power-on reset state. Windows doesn't touch the pins until you open them and explicitly change them by calling SetDriveMode() or Write(). 


    Tuesday, May 5, 2015 3:38 AM
  • They seem to be driven high at times. A low value resistor should be able to pull them low if they were in input state with a pull-up. That is not always the case.

     A new fresh image seems to do the trick. Everything now works as expected, at least for the GPIO that is.
    Wednesday, May 6, 2015 12:59 PM
  • On which pins are you seeing this behavior? Pins 0-8 are pullup by default and pins 9-31 are pulldown by default. Is it during the boot process that they're being driven high?
    Thursday, May 7, 2015 5:08 AM
  • I was seeing this in pin 4, 5 and 7 from time to time, and during boot. But that was not the only unexpected behaviour. So i put a new image on my sd card, and now all is as expected. Pins are not driven, and pulled up. I think my sd card suffered from some form of corruption. Shorting out the 5V and 3.3V lines may have had something to do with that.

    Thursday, May 7, 2015 6:26 PM