odroid-n2:application_note:led_control

'ODROID-N2' on this page refers to the ODROID-N2 series (N2, N2+, N2L).

How to Control Blue Status LED

We can control the blue LED with editing the trigger mode in sysfs.

The red LED is hard-wired to the power input rail so that cannot be changed.

Simply you can turn on/off that with putting an option using echo command.

Do echo none to turn off.

target
root@odroid:~# echo none > /sys/class/leds/blue\:heartbeat/trigger

Do echo MODE to turn on with MODE.

target
# Turn on that solidly.
root@odroid:~# echo default-on > /sys/class/leds/blue\:heartbeat/trigger
 
# Heartbeat mode. This is the original state.
root@odroid:~# echo heartbeat > /sys/class/leds/blue\:heartbeat/trigger

There are many other modes you can select. But some of them may now work. This is an example for N2.

target
root@odroid:~# cat /sys/class/leds/blue\:heartbeat/trigger
none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock timer oneshot [heartbeat] backlight gpio cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 default-on transient panic rc_feedback emmc sd

netdev trigger will blink the blue led if there's network traffic.

  • Requirement for N2: Ubuntu 18.04 kernel 4.9.230-76, Ubuntu 20.04 kernel 4.9.230-95
  • Requirement for C4: Ubuntu 20.04 kernel 4.9.230-29
  • Requirement for XU4: Kernel 5.4

Enable netdev trigger:

target
echo netdev > /sys/class/leds/blue\:heartbeat/trigger

Set the interface to be monitored:

target
echo eth0 > /sys/class/leds/blue\:heartbeat/device_name

Interval in mS for blinking, lower is faster blinking, higher is slower, minimum is around 40

target
echo 40 > /sys/class/leds/blue\:heartbeat/interval

Link: Should we monitor if the link is up or down? (Link = Physical cable).

1 we monitor link status, the led behaviour is: on when link is up, flashing when there's activity.
0 we don't monitor link status, the led behaviour is: always off, flashing when there's activity.

target
echo 0 > /sys/class/leds/blue\:heartbeat/link

RX/TX Blinking

Enable RX Blinking

target
echo 1 > /sys/class/leds/blue\:heartbeat/rx

Enable TX Blinking

target
echo 1 > /sys/class/leds/blue\:heartbeat/tx
  • If you want to turn the LED off automatically in boot process, add echo none > /sys/class/leds/blue\:heartbeat/trigger in /etc/rc.local file.

The Red LED on the HC4 and the N2L board are not hard-wired and you can turn it off by software.
The GPIO number of the red LED on the HC4 board is 503 (GPIOAO.BIT7)
The GPIO number of the red LED on the N2L board is 502 (GPIOAO.BIT6)

target
# Export GPIO
root@odroid:~# echo 503 > /sys/class/gpio/export
 
# To set as Output 
root@odroid:~# echo out > /sys/class/gpio/gpio503/direction
 
# Output as high to turn it on.
root@odroid:~# echo 1 > /sys/class/gpio/gpio503/value
 
# Output as low to turn it off.
root@odroid:~# echo 0 > /sys/class/gpio/gpio503/value
target
# Export GPIO
root@odroid:~# echo 502 > /sys/class/gpio/export
 
# To set as Output 
root@odroid:~# echo out > /sys/class/gpio/gpio502/direction
 
# Output as high to turn it on.
root@odroid:~# echo 1 > /sys/class/gpio/gpio502/value
 
# Output as low to turn it off.
root@odroid:~# echo 0 > /sys/class/gpio/gpio502/value
2020/03/19 09:54 · luke.go
  • odroid-n2/application_note/led_control.txt
  • Last modified: 2020/04/23 18:06
  • by luke.go