Page 1 of 1

NANOPI Neo 512M - GPIO Status on boot

Posted: Mon Dec 09, 2024 11:38 am
by marino-mrc
Hello,
I'm using the NanoPI Neo 512M with OpenWrt and I wrote a C application that uses some GPIO lines.
Everything works as expected, but when I power on the NanoPI board, I see GPIO lines to quickly "flap". It's easy to recognize because there are some leds connected to the GPIO lines.
Is it possible to set the status of GPIO lines (or some of them) as low output when the board starts? I'm not talking about OpenWrt: after the OS starts, I know it's easy to do that. I want to set the status in the bootloader or somewhere at the very early stage of the boot process.

Thank you.
Marco

Re: NANOPI Neo 512M - GPIO Status on boot

Posted: Mon Mar 24, 2025 4:03 am
by ValeriePate
Have you tried setting the GPIO state during boot by modifying the bootloader (like U-Boot)? :?:

Re: NANOPI Neo 512M - GPIO Status on boot

Posted: Mon Mar 24, 2025 5:02 am
by HowardLivingston
marino-mrc wrote:
Hello,
I'm using the NanoPI Neo 512M with OpenWrt and I wrote a C application that uses some GPIO lines.
Everything works as expected, but when I power on the NanoPI board, I see GPIO lines to quickly "flap". It's easy to recognize because there are some leds connected to the GPIO lines.
Is it possible to set the status of GPIO lines (or some of them) as low output when the board starts? I'm not talking about OpenWrt: after the OS starts, I know it's easy to do that. I want to set the status in the bootloader or somewhere at the very early stage of the boot process.

Thank you.
Marco

You can set GPIO states in U-Boot before the OS starts.
Modify the Device Tree: Use gpio-hog to set default states:
gpio-hog {
gpios = <&gpio 17 0>; // GPIO number and direction
output-low; // or output-high
line-name = "led_control";
};
Use U-Boot Commands:
gpio clear <gpio_number> # Set low
gpio set <gpio_number> # Set high
Add these to the boot script or U-Boot environment. This should prevent GPIO flapping during startup.