Configuring blinking led during boot

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

Yuval
Posts: 6
Joined: Sun Dec 04, 2016 6:22 pm

Configuring blinking led during boot

Mon Jan 30, 2017 2:55 pm

Hello,

I'm trying to configure the RGD Led on SAMA5D2 Xplained rev.B board to blink fast (50msec turn-off to turn-on) with the blue led during boot,
i added the following to the .dtsi of the demo image:

Code: Select all

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay";

		red {
			label = "red";
			gpios = <&pioA 38 GPIO_ACTIVE_LOW>;
		};

		green {
			label = "green";
			gpios = <&pioA 37 GPIO_ACTIVE_LOW>;
		};

		blue {
			label = "blue";
			gpios = <&pioA 32 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "timer";
		};
	};
The result is that the led blinking slowly, around 0.5sec from turn-off to turn-on
in the manual that i found there is this definition:
"timer" - LED flashes at a fixed, configurable rate
but i parsed any example i found and didn't find anywhere how to configure this rate.

Can anyone tell me how should i configure the rate?

Thanks
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Configuring blinking led during boot

Tue Jan 31, 2017 12:43 am

Refer to Documentation/leds/leds-class.txt:

Code: Select all

The timer trigger will periodically change the LED brightness between
LED_OFF and the current brightness setting. The "on" and "off" time can
be specified via /sys/class/leds/<device>/delay_{on,off} in milliseconds.
Regards
Yuval
Posts: 6
Joined: Sun Dec 04, 2016 6:22 pm

Re: Configuring blinking led during boot

Tue Jan 31, 2017 11:04 am

Thanks but this is not what i asked.

I know how to handle the leds from user space, i asked how to configure its default in the Device Tree so it will blink during the boot.
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Configuring blinking led during boot

Tue Jan 31, 2017 9:39 pm

Yuval wrote:this is not what i asked.
...
i asked how to configure its default in the Device Tree so it will blink during the boot.
Only in your mind.
Your original post does not even contain the words "Device Tree".
Yuval
Posts: 6
Joined: Sun Dec 04, 2016 6:22 pm

Re: Configuring blinking led during boot

Wed Feb 01, 2017 11:38 am

i mentioned that i need the LED to blink during boot and i mentioned that the attached code is from .dtsi file (that is clearly the source of the Device tree blob)
Anyway, i'm sorry if i was not clear enough and i appreciate you trying to help me.

Still, i will be happy to get an answer now when i explained my self (if you still think i need to provide more details on my case please tell me).


Thanks
blue_z
Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Configuring blinking led during boot

Thu Feb 02, 2017 12:38 am

There is no configuration of trigger-timers for leds-gpio through the Device Tree.
The leds-gpio device class is intended to be portable, and sysfs is the interface to configure and control these devices.
Not all arches use Device Tree (aka Open Firmware).
Inspect the LED trigger-timer driver, drivers/leds/trigger/ledtrig-timer.c, and also its parent directory, and you'll find minimal references to Device Tree, e.g. #include <linux/of.h>.

You haven't bothered to define what this blinking LED represents.
Your specification of "blinking led [sic] during boot" is so ambiguous that I was compelled to ignore it.

IMO "booting" begins with power-on/reset, and ends with the first log-on prompt.
There simply is no timer-based method for blinking an LED during the multi-stage boot sequence.
An init script that configured the LED through sysfs near the end of the boot sequence would have to suffice.
Even if you wrote a Linux device driver to control the LED, it couldn't blink until the kernel has been loaded plus a second or two for the driver to be initialized. Depending on the initializations, this driver might be only a second or two sooner than an init script.

Regards

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest