1

I would like to set the output of GPIO 12 and 26 to on while the RPi is booting, and then turn them off when startup is complete. Can I use config.txt for this?

Something like:

# Set GPIO12 and 26 to be outputs set to 1
gpio=12,26=op,dh

How would I then turn off the GPIO? I want to use these particular GPIO because I already have LEDs on them, as opposed to GPIO 14 which would require another LED.

2 Answers 2

5

The easiest way to set pin state shortly after boot is to use the gpio config command in config.txt.

NOTE The syntax is based on the raspi-gpio utility -
raspi-gpio help will show commands.

See https://www.raspberrypi.com/documentation/computers/config_txt.html#gpio-control

NOTE this is not strictly at boot, this is done by Device Tree but very early in the boot process. On boot all pins are set as inputs.

You will have to write your own procedure to change them (using any of the normal methods).

0

The problem is, that the Pin configuration is only active during startup phase. For example:

Set GPIO12 to be an output set to 1

gpio=12=op,dh

this command sets GPIO12 only high during startup and later automatically back to default state).

1
  • 1
    This space is reserved for answers to the original question. It looks like you should have created a comment instead. Commented Aug 1, 2021 at 20:11

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.