simandcure
Posts: 1
Joined: Fri Jul 10, 2020 8:55 am

GPIO state at boot

Fri Jul 10, 2020 9:00 am

Hello everyone,
Do someone knows if it is possible to fix the GPIO state at boot ? I'd like to control the state of GPIOs durig the boot sequence as I'm using relays.
Regards

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: GPIO state at boot

Fri Jul 10, 2020 1:12 pm

Hi.

You could try the "gpio" config command : viewtopic.php?f=117&t=208748

but you pi will still need to get to the point were this action is possible, so it may no be soon enough for your relays.

If its that your relay board is active low so the relays are switching on at boot, the other option is to add an interface circuit between the gpio and the relay board to make them active high.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

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

Re: GPIO state at boot

Fri Jul 10, 2020 2:45 pm

https://www.raspberrypi.org/documentati ... xt/gpio.md

you can also use config.txt to set the default states for gpio earlier in the boot process

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8739
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: GPIO state at boot

Fri Jul 10, 2020 3:37 pm

Follow the boot time default pulls as documented in section 6.2 of the SoC datasheet. If you don't then there will always be a slight glitch between power being applied and any form of software having taken over, processed whatever input, and set your GPIOs to any non-default setting.

By default GPIOs 0-8 pull up, whilst 9-27 pull down. No, those defaults can't be changed.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Idahowalker
Posts: 499
Joined: Wed Jan 03, 2018 5:43 pm

Re: GPIO state at boot

Fri Jul 10, 2020 4:18 pm

Have you tried using external pull-up/down resistors that will receive their power prior to the RPi4 doing its GPIO thing?
Without knowing why you are deleting my postings, I will not know how...

Return to “Advanced users”