How to Modify the Heartbeat LED Pin on the RK3568 SOM
In embedded development, LED indicators are one of the most intuitive ways to monitor system status. The heartbeat LED is particularly crucial, as it uses periodic blinking to indicate that the system is running normally. This article will take the RK3568 SOM from Hangzhou Weathink Electronics as an example and provide a detailed guide on how to modify the default GPIO pin for the heartbeat LED in a Linux environment, directing it to your specified hardware LED.
1. Determine the Hardware and Pin
First, you need to confirm the LED pin used for the heartbeat light on your hardware. In this example, we assume the heartbeat LED is connected to the GPIO1_A4 pin.
To map GPIO1_A4 to the Linux kernel, we need to know its corresponding GPIO number. On Rockchip platforms, GPIO numbers are typically represented in the format &gpio

2. Device Tree Modification
The Linux kernel manages hardware resources through the device tree. To modify the heartbeat LED pin, we need to edit the device tree file, usually located in the arch/arm64/boot/dts/rockchip/directory, with a filename similar to rk3568-xxxx-board.dts.
In the device tree file, you need to locate or add a node named leds, which defines all the LEDs in the system. Within the ledsnode, add a sub-node named led-aliveto configure the heartbeat LED.
Here’s the specific modification code to add to your device tree file:
// The leds node defines all LEDs in the system
leds {
compatible = "gpio-leds"; // Compatibility property, specifying the use of GPIO-controlled LED drivers
// The led-alive sub-node configures the heartbeat LED
led-alive {
status = "disabled"; // Disabled by default, controlled by the led-trigger
gpios = <&gpio1 rk_pa4="" gpio_active_high="">; // Key configuration: specifies the LED is connected to GPIO1_A4
default-state = "off"; // The LED is off by default after system boot
linux,default-trigger = "heartbeat"; // Sets the default trigger for the LED to "heartbeat"
function = LED_FUNCTION_HEARTBEAT; // Specifies the LED's function as a heartbeat indicator
};
};
Key Property Explanations:
gpios = <&gpio1 rk_pa4="" gpio_active_high="">: This is the most critical line. It tells the kernel that the heartbeat LED is connected to GPIO1_A4. GPIO_ACTIVE_HIGHmeans the LED lights up when the GPIO output is high. If your hardware lights up on a low signal, use GPIO_ACTIVE_LOWinstead.
linux,default-trigger = "heartbeat": This line specifies the LED’s default behavior. After system boot, the kernel’s heartbeat driver will automatically take over this LED, causing it to blink periodically.
status = "disabled": This is typically used to predefine a node in the device tree without enabling it by default. In this case, the heartbeat trigger will automatically enable the LED, so the disabledstatus here does not affect the heartbeat LED’s functionality.
After making these changes, you need to recompile the device tree and update it on the core board.
3. Verification and Testing
After the core board boots, observe the physical LED:
If you have correctly connected the hardware LED, it should now blink at a slow, steady frequency.
4.Summary
By following these steps, you can successfully modify the heartbeat LED pin on the RK3568 SOM from Hangzhou Weathink Electronics to your specified GPIO. This method also applies to configuring other indicator LEDs based on the gpio-ledsdriver.

