Power & Source of Big Ideas

NANOPI Neo 512M - GPIO Status on boot

Moderators: chensy, FATechsupport

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
Have you tried setting the GPIO state during boot by modifying the bootloader (like U-Boot)? :?:
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.

Who is online

In total there are 35 users online :: 0 registered, 0 hidden and 35 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 35 guests