Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Use a GPIO to turn on LED right from booting

Featured Replies

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?

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.

  • Author
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?

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.

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.

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.