Andy Posted November 19, 2021 Posted November 19, 2021 I like to attach an additional LED to my Core on any GPIO that is also going to switch on as soon as the Core boots (similar to the red one). This way I can give the user a feedback that the core is now booting. Is there a way to achieve this?
Werner Posted November 19, 2021 Posted November 19, 2021 Moved to Common issues / peer to peer technical support
mhel Posted November 19, 2021 Posted November 19, 2021 I'm not sure what device you have, but on the board I have this is used on the device tree leds { compatible = "gpio-leds"; user_led: led-1 { label = "ctf-blue"; linux,default-trigger = "default-on"; default-state = "on"; gpios = <&gpio2 RK_PB0 1>; }; }; and lights up the led as it boot, it's not an activity led tho.
Andy Posted November 19, 2021 Author Posted November 19, 2021 vor 4 Stunden schrieb mhel: I'm not sure what device you have, but on the board I have this is used on the device tree leds { compatible = "gpio-leds"; user_led: led-1 { label = "ctf-blue"; linux,default-trigger = "default-on"; default-state = "on"; gpios = <&gpio2 RK_PB0 1>; }; }; and lights up the led as it boot, it's not an activity led tho. hmm thx I use a NanoPi NEO Core I now decopiled sun50i-h5-nanopi-neo-core2.dtb and have does entries: leds { compatible = "gpio-leds"; pwr { label = "nanopi:red:pwr"; gpios = <0x38 0x00 0x0a 0x00>; linux,default-trigger = "default-on"; }; status { label = "nanopi:green:status"; gpios = <0x0c 0x00 0x0a 0x00>; linux,default-trigger = "heartbeat"; }; }; So i don't won't to brick my core so can I just add this: ledBoot { label = "ctf-red"; linux,default-trigger = "default-on"; default-state = "on"; gpios = ????; }; but how do I define the GPIOS?
mhel Posted November 20, 2021 Posted November 20, 2021 You can use whatever gpio is available. And you can group it with your leds. leds { compatible = "gpio-leds"; pwr { label = "nanopi:red:pwr"; gpios = <0x38 0x00 0x0a 0x00>; linux,default-trigger = "default-on"; }; status { label = "nanopi:green:status"; gpios = <0x0c 0x00 0x0a 0x00>; linux,default-trigger = "heartbeat"; }; ledBoot { label = "just_a_name"; linux,default-trigger = "default-on"; default-state = "on"; gpios = <3 7 0 0>; // Gpio3 pin 7 ? ? }; }; Whatever gpio is available for you. If you use a gpio not used anywhere, you won't brick your board. Why did you have to decompile the dtb? if the source is available for your board then you can look for the dts file an you can see how the gpios are defined.
mhel Posted November 20, 2021 Posted November 20, 2021 So your dts files appear to have this: leds { compatible = "gpio-leds"; status { label = "nanopi:blue:status"; gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; }; pwr { label = "nanopi:green:pwr"; gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; default-state = "on"; }; }; So you have to do it like gpios = <&pio 3 7 0>; // gpio3 pin 7 active_high or maybe 1 for active high.
Andy Posted November 20, 2021 Author Posted November 20, 2021 thx a lot for the help hope to try this soon
Recommended Posts