Alternative Heartbeat LED

  • Operation confirmed with our ODROID-C2 on 3.14.79-117 kernel.

You can remap the blue heartbeat LED to other pin.

The default GPIO pin for the heartbeat signal is GPIOAO_13.

Check this out.

        leds: gpio_leds {
                compatible = "gpio-leds";

		pinctrl-names = "led_pins";
		pinctrl-0 = <&led_pins>;

                /* Blue LED */
                heartbeat {
                        label = "blue:heartbeat";
                        gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "heartbeat";

The gpios property in the heartbeat child node has 3 parameters, &gpio_ao, GPIOAO_13, GPIO_ACTIVE_LOW.

  • &gpio_ao indicates a pin bank for a pin that would be used.
  • GPIOAO_13 indicates a pin for a heartbeat LED.
  • GPIO_ACTIVE_LOW is a flag for when the GPIO pin will be active. If in GPIO_ACTIVE_LOW, this GPIO pin is active when the output signal is 0.

The written pin GPIOAO_13 by default indicates a blue LED on the board so that the LED is heartbeat-ing as we expected.
So if you want to use the other GPIO pin for an alternative, you can easily achieve that by changing the pin bank and pin number at that line.
A tool, device-tree-compiler, can make you do that easier.

Install device-tree-compiler by the following commands.

root@odroid64:~# apt install device-tree-compiler

Now you can use fdtget and fdtput commands which makes us editing DTS without bothersome building a new kernel.

First, find out what is the current parameters in the gpios property.

root@odroid64:~# fdtget /media/boot/meson64_odroidc2.dtb /gpio_leds/heartbeat gpios
37 13 1

We already know that the parameters of gpios property are: <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>.
This result shows them in order in number.

That result let us know that the pin bank &gpio_ao is shown as number 37.
In the same way, I've found that the &gpio pin bank commonly used at the 40 pin header is shown as number 19.

And you can refer to include/dt-bindings/gxbb.h file to know the number of a pin.
There're only 3 groups used at the 40 pin header, GPIOX, GPIOY, GPIODV. See the table below.
You can't use all of the pins below but just some of them. Please refer to this page: Expansion Connectors

0 92 11 103 22 114 0 75 11 86 24 69
1 93 12 104 1 76 12 87 25 70
2 94 13 105 2 77 13 88
3 95 14 106 3 78 14 89
4 96 15 107 4 79 15 90
5 97 16 108 5 80 16 91
6 98 17 109 6 81
7 99 18 110 7 82
8 100 19 111 8 83
9 101 20 112 9 84
10 102 21 113 10 85

Lastly, GPIO_ACTIVE_{HIGH|LOW} is the only thing you should choose.

If the positive(+) side of the LED is connected to 3.3V via a register, and the negative(-) side of the LED is connected to the GPIO pin you set, you should use GPIO_ACTIVE_HIGH.
Or if the positive(+) side of the LED is connected to the GPIO pin you set via a register, and the negative(-) side of the LED is connected to the ground, you should use GPIO_ACTIVE_LOW.
Actually it depends on your system, choose the proper one by the environment you're in.
And the number of these options are,


Refer to include/dt-bindings/gpio/gpio.h file to see the actual definition.

Now we know everything we should know.
Finally we can make the other pin at the 40 pin header as a heartbeat LED.

To test, I've connected our Tinkering Kit to my C2.
And I've set the test environment with a register and a LED that sets with the positive(+) side of the LED is connected to the GPIO pin #13 via a 330Ω register, and the negative(-) side of the LED is connected to the ground.
Please see the picture below.

On C2, it does by simply enter the proper command.
Since I've connected the pin at the GPIO pin #13(GPIOX_11), I'll enter 96(pin bank) 103(pin number) as first two parameters.
And I need to add a parameter 0(GPIO_ACTIVE_LOW) to show the heartbeat properly.

Don't forget that you should reboot to have effect.

root@odroid64:~# fdtput /media/boot/meson64_odroidc2.dtb /gpio_leds/heartbeat gpios 96 103 0
root@odroid64:~# reboot

After the reboot, the LED heartbeats like a blue LED on the board before.

You can check whether the changes written in Device Tree well or not.

root@odroid64:~# fdtget /media/boot/meson64_odroidc2.dtb /gpio_leds/heartbeat gpios
96 103 0

To back to the default, enter the following commands.

root@odroid64:~# fdtput /media/boot/meson64_odroidc2.dtb /gpio_leds/heartbeat gpios 37 13 1
root@odroid64:~# reboot

Surely you can use the other pin you want by following this guide.

  • odroid-c2/application_note/external_connector/alternative_heartbeat_led.txt
  • Last modified: 2020/03/31 15:44
  • by tony.hong