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.

sAm_vdP
  • 123
  • 4

1 Answers1

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.

Seamus
  • 23,558
  • 5
  • 42
  • 83