hooverphonique
Posts: 20
Joined: Wed Nov 06, 2019 2:10 pm

CM4: GPIO's, pull, and shutdown

Fri Sep 17, 2021 12:52 pm

Hi,

1. the BCM datasheet lists some default pull-up/down data for the GPIO's - are these hardwired in silicon, or some default set by some early boot code (i.e. can it be changed) ?
2. if the *default* pull of a pin can't be changed, what is the recommended external resistor value to reverse the pull until software is ready to change the GPIO settings ?
3. If the 3v3 rail is left powered (i.e. GLOBAN_EN high) after running the linux shutdown command, and GPIO_VREF=3v3, is the entire GPIO section still powered, and keeps its in/out/pull settings?
4. If 3) is yes, I suppose no damage will occur by having external voltages between 0v and 3v3 on a GPIO input after software shutdown!?

dp11
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 636
Joined: Thu Dec 29, 2011 5:46 pm

Re: CM4: GPIO's, pull, and shutdown

Fri Sep 17, 2021 1:25 pm

1) some CM4 pins have explicit hardware pulls ( e.g. 1.8K) and they are documented in the CM4 datasheet.

2) Using ohms law and the figures given in the datasheet you should be able to calculate a suitable value

3) yes

4) yes, see the Vgpio specification in the CM4 datasheet

Which pins are you specifically thinking about and what do you want to do with them?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4116
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: CM4: GPIO's, pull, and shutdown

Fri Sep 17, 2021 1:28 pm

The default pulls are hardwired, i.e. these are the values of the pulls asserted at reset, but they can obviously be changed subsequently. Following the default pulls is useful if trying to avoid glitches on a line, e.g. for the gpio-poweroff signal.

cleverca22
Posts: 4647
Joined: Sat Aug 18, 2012 2:33 pm

Re: CM4: GPIO's, pull, and shutdown

Fri Sep 17, 2021 3:40 pm

hooverphonique wrote:
Fri Sep 17, 2021 12:52 pm
3. If the 3v3 rail is left powered (i.e. GLOBAN_EN high) after running the linux shutdown command, and GPIO_VREF=3v3, is the entire GPIO section still powered, and keeps its in/out/pull settings?
PhilE wrote:
Fri Sep 17, 2021 1:28 pm
The default pulls are hardwired, i.e. these are the values of the pulls asserted at reset, but they can obviously be changed subsequently. Following the default pulls is useful if trying to avoid glitches on a line, e.g. for the gpio-poweroff signal.
also of note, when you tell linux to "shutdown" it will actually reboot, and then the firmware in the SPI eeprom will pause in the middle of the bootup cycle (before ram is online)
because of that, it will revert back to the reset default, and only obey gpio= lines in bootconf.txt (in the SPI eeprom config)

using either a strong pull in hardware, or modifying your circuit to agree with the default pull, will avoid any glitching during such resets

hooverphonique
Posts: 20
Joined: Wed Nov 06, 2019 2:10 pm

Re: CM4: GPIO's, pull, and shutdown

Sat Sep 18, 2021 4:36 pm

dp11 wrote:
Fri Sep 17, 2021 1:25 pm
1) some CM4 pins have explicit hardware pulls ( e.g. 1.8K) and they are documented in the CM4 datasheet.

2) Using ohms law and the figures given in the datasheet you should be able to calculate a suitable value
Which pins are you specifically thinking about and what do you want to do with them?
I am specifically talking about the pulls internal to the BCM SOC.

I'm in the process of designing a carrier board which uses 1 SPI, 1 I2C, 2 UARTs, 1 PWM and a bunch of single GPIO inputs and outputs.
I want those of the above signals which will become outputs once the software has started, to behave in a compatible way while the system boots and when shut down.

hooverphonique
Posts: 20
Joined: Wed Nov 06, 2019 2:10 pm

Re: CM4: GPIO's, pull, and shutdown

Mon Sep 20, 2021 8:35 am

cleverca22 wrote:
Fri Sep 17, 2021 3:40 pm
also of note, when you tell linux to "shutdown" it will actually reboot, and then the firmware in the SPI eeprom will pause in the middle of the bootup cycle (before ram is online)
because of that, it will revert back to the reset default, and only obey gpio= lines in bootconf.txt (in the SPI eeprom config)

using either a strong pull in hardware, or modifying your circuit to agree with the default pull, will avoid any glitching during such resets
That's useful to know.

I just had a look at the BCM2711 datasheet again (pages 73-78), and either the document is wrong, or I am misunderstanding something, because the PUP_PDN register documentation lists all GPIOs as default to pull-down, whereas the alternate function assignment table lists a mix of pull-up/-down.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4116
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: CM4: GPIO's, pull, and shutdown

Mon Sep 20, 2021 9:40 am

The documentation will be based on the overall chip information from Broadcom, which has been known to diverge from reality - this is one of those cases.

I've just (with dp11 looking over my shoulder) reset the SoC, preventing it from executing any instructions, and read the 2711 GP_PUP_PDN_CTRL registers, and the results match the alt function table, i.e.:

Code: Select all

00-08 = UP/HIGH
09-27 = DOWN/LOW
28-29 = NONE
30-33 = DOWN/LOW
34-36 = UP/HIGH
37-43 = DOWN/LOW
44-45 = NONE
46-57 = UP/HIGH

Return to “Compute Module”