6

Can't seem to find a solid answer to the power on state (before the O/S loads) of the GPIO pins. IE Do the pins default state set to input/output pull ups enabled etc.. My quick analysis has shown some pins are at 3.3V and some at 0V which is okay. But interested to know if GPIO states are consistent between board and/or firmware revisions.

Ghanima
  • 15,578
  • 15
  • 58
  • 113
robert
  • 61
  • 1
  • 1
  • 3
  • 1
    I had a look at that answer before I answered. It doesn't answer the question. – joan Jul 20 '16 at 08:29
  • @joan, if the same answer could be given to both questions (whether said answer actually exists or not) it's technically a dupe. So by the book one should be closed as a dupe. If you think it not answered on the other side (and your answer does provide additional input, as it would seem) then another answer should be added at the referenced question. (Though as always feel free to have a community vote on reopening; e.g *board and/or firmware revisions* is not addressed over there.) – Ghanima Jul 20 '16 at 10:52
  • 1
    @Ghanima I take your point. However there is an awful lot of historical baggage with wrong answers with high votes. Adding a new answer to those serves little purpose as the only answer seen will be the highly voted wrong answer. – joan Jul 20 '16 at 11:25
  • Correct, part answered. Yes PG 102 BCM2835 clearly defined the state of power up, but firmware kicks in at some point which could alter the state of the GPIO. Hence I feel the questions still remains unanswered. – robert Jul 20 '16 at 22:20
  • Information from the future: https://www.raspberrypi.org/documentation/configuration/pin-configuration.md – Sarien Apr 30 '20 at 22:06
  • Updated link: https://www.raspberrypi.com/documentation/computers/configuration.html#device-pins-during-boot-sequence – fearless_fool Aug 12 '22 at 15:49

1 Answers1

11

That is easy to answer.

The power on state is defined in BCM2835 ARM Peripherals page 102.

Basically all GPIO are in INPUT mode, GPIO 0-8 have pull-ups to 3V3 enabled, GPIO 9-27 have pull-downs to 0V enabled.

If you are interested in the other GPIO look at the table.

Of course all this can be changed during the boot process, e.g. by device tree etc.

joan
  • 67,803
  • 5
  • 67
  • 102
  • I've seen this basic answer several places online, and the counter-observation is typically that the that table that you reference is "Alternative Function Assignments." That doesn't give confidence that the column giving "pull" really represents the default state, as you've claimed here. I'm not saying you're wrong - but I'm not convinced and I've very interested in a definitive answer. – Brick Apr 16 '17 at 17:36
  • @Brick Easy to test, power down, remove SD card, power up. Check pulls. – joan Apr 16 '17 at 17:40
  • Your suggestion is also in one of the other threads that I'm reading, and this is the reply: "Yes but that does not give you the default power up state. It gives you the state after the boot code ROM inside the chip has been run." ("Grumpy Mike" at Tue Dec 04, 2012 11:55 am in this thread https://www.raspberrypi.org/forums/viewtopic.php?t=24491). He points to Tables 6-28 through 6-30 in the same document that you cited as being more relevant. I don't claim to know the answer - Still searching for something clear and definitive. – Brick Apr 24 '17 at 20:03
  • Oh, and I see now that you are also on the thread that I'm mentioning, so this clearly isn't news to you. I read to the end of the thread, however, and I remained unclear on the final answer as the two (or more) sides never seemed to converge on a single answer. – Brick Apr 24 '17 at 20:06
  • 1
    @Brick If you don't believe the documentation and you don't believe empirical evidence you are rather stuck. – joan Apr 24 '17 at 20:31
  • It seems there's the question of when you measure. There are several things that happen, some of them in rapid sequence. I want to connect something that may be sensitive to a transient state - if it exists - between first connection of power and what I'll get if I measure in the steady state once all hardware and any on-chip firmware run. I don't have a good way to measure that. I'd tend to believe the documents on if I felt I had a clear understanding of what it's saying. – Brick Apr 24 '17 at 21:14
  • @Brick, at the end of page 100 the following sentence confirms that the table at page 102 shows the default pull state: "The Alternate function table also has the pull state which is applied after a power down" – Carlos B. Feitoza Filho Jun 03 '19 at 21:33