1

I have a question related to What is the power on state of the GPIOs?

I am aware that GPIO lines on the Raspberry Pi have a defined Pull-Up/-Down state at power up. However, there seems to be an undocumented timing aspect. All of the following oscilloscope traces have been recorded on an RPi4/5 without an SD card.

The following image shows an oscilloscope trace of an RPi4 starting up. 3.3V and 5V lines are connected to the respective power rails, GPIO is connected to GPIO20:

Scope trace of RPi4 power up sequence

I expected GPIO20 to have a pull-down active at power up, but that's not quite happening. One can see that the GPIO pin is first floating, catching a nice 50 Hz noise. Then 5V comes up and a bit later 3.3V as well. And then there's a short spike on the GPIO line. At this point, the GPIO line still does not have a pull-down enabled, the noise is still visible after the spike. Then the pull-down finally becomes active.

The same behavior applies for GPIO pins with a pull-up. This is the same trace for GPIO7: Scope trace of RPi4 power up sequence with pull up

Again there is a spike on the GPIO line before the pull up becomes active.

The impedance of this spike seems to be quite high, here is GPIO20 again, with a 100k pull-down inserted: Scope trace of RPi4 power up sequence with extern pull down The noise is gone and the spike is signifanctly flattened.

Edit: As suggested by Seamus, I tried a different way of enabling power. Instead of connecting the USB connector, I left that plugged in and connected the power supply to the outlet instead. Result looks identical: Scope trace of RPi4 startup behavior

This behavior seems to be specific to the Broadcom GPIO controller. I tried the same experiment with an RPi5 and the behavior is less surprising: Scope trace of RPi5 power up sequence

Question:

Is this timing behavior documented anywhere? I could not find a reference to it in the BCM2711 documentation: https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf

Edit: As was helpfully pointed out to me, the RPi4 has a BCM2711. Edited the question.

7
  • The trace labels are on the left? Didn't know that the Pi4 has a different GPIO chip, whenever the question of startup GPIO config comes up, the BCM2835 doc seems to be referenced.
    – sAm_vdP
    Commented May 6 at 12:27
  • 1
    Interesting traces on the RPi4. A question: How did you "apply power" to the RPi4... was it by plugging in the USB cable to the connector? If so, that could explain some of the differences. Also, the RPi4 has a different voltage regulator than the RPi5 - which could also explain it. Finally: Are you worried about some aspect of the RPi4's power-on behavior - or is this a curiosity question?
    – Seamus
    Commented May 6 at 16:10
  • 1
    I did indeed plug in the USB connector on both models. Is there a different approach that you would recommend trying? I could plug in the power supply instead? The root cause of this question is that we had a latch after a GPIO line, which was supposed to latch once the GPIO line goes high for the first time, but we observed that it latched immediately on power up. The issue was solved with a pull down resistor, so at this point the question is mere curiosity.
    – sAm_vdP
    Commented May 7 at 6:57
  • The only different approach might be the addition of a switch or relay in the USB power line to the Pi. That might eliminate some glitching you see on the GPIO. The manual plug-in seems a fairly crude way to apply power; if you're like me you often have to wiggle the connector a bit to get it to seat properly. I imagine that creates glitching, but that theory may be complete rubbish! I've made a minor edit to my answer based on your comment that may help.
    – Seamus
    Commented May 7 at 17:17
  • Your RPi5 measurement was definitely cleaner - and the 3V3 line comes up much more quickly. If this (RPi5 msmt) was also triggered by "plugging in" the USB power connector, this is a clearly improved situation !
    – Seamus
    Commented May 7 at 17:26

1 Answer 1

1

AFAIK, the timing behavior you've observed is not documented anywhere. This is not surprising because the Raspberry Pi organizations and Broadcomm treat the firmware as proprietary. And so, while the GPIO Block Diagram shown in Figure 4 of your referenced document is presumably accurate, it's readily apparent that its behavior is governed by the various registers and I/O functions that are not documented (i.e. the firmware).

Which is exactly why measurements like the ones you have taken are necessary for sorting out the design of peripheral devices that will interface to the RPI's GPIO.

And as I mentioned in my comment, some of your observations may be explained by how you connected power, and the operation of the PMIC (Power Management IC (MXL7704)) as it brings up the various power buses in an orderly fashion.

Your comment suggests that you're designing a board to interface with the RPi. If that's the case, I'd suggest that you handle all the logic on your design with a long duration power-on-reset. IOW, your design should give the RPi a long time to get over its power-on convulsions before relying upon any GPIO as input.

Also note that the BCM2711 documentation you've referenced is very similar to the BCM2835 documentation - at least in regard to the chapters (5 & 6 respectively) that cover GPIO. You may have noted the very similar wording between para 5.1 and 6[.0] of the two documents; one difference being the addition of a fourth interrupt line in the 2711.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.