I want to program BTN1. For this I used the definition sw0 of nrf54l15 but that doesn't work (SW crash).
What overlay structure should be used?
AI suggested the overlay which I include below (AI_Overlay.txt).
Since the zephyr DTS already contains button definitions for nrf54l15 (not Tag) the second overlay suggestion should be used.
In any case I tried both, also changing the alias sw0 by another name (btn1).
I added these changes to the exiting board overlay nrf54l15dk_nrf54l15_cpuapp.overlay.
nRF54L15 Tag – BTN1 Overlay
The issue is that sw0 on the nRF54L15 DK maps to P1.13 (Button 0 on the DK), but on the nRF54L15 Tag, BTN1 is connected to P0.00. [Tag Buttons]
So if you're using the DK board target with the Tag hardware, the sw0 alias points to the wrong pin, causing a crash. You need to override it with a devicetree overlay that redefines sw0 to point to P0.00.
Here is the overlay structure you should use:
/ {
aliases {
sw0 = &btn1_tag;
};
buttons {
compatible = "gpio-keys";
btn1_tag: button_0 {
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN1";
};
};
};
Key points:
gpio0 0 maps to P0.00, which is where BTN1 is physically connected on the nRF54L15 Tag. [Tag Buttons]
GPIO_PULL_UP | GPIO_ACTIVE_LOW is the standard configuration for active-low buttons without external pull-up resistors (consistent with nRF54L15 button hardware). [DK Buttons & LEDs]
If the existing board DTS already defines a buttons node or sw0 alias, you may need to delete the conflicting nodes first:
/ {
aliases {
/delete-property/ sw0;
};
};
/delete-node/ &{/buttons/};
/ {
aliases {
sw0 = &btn1_tag;
};
buttons {
compatible = "gpio-keys";
btn1_tag: button_0 {
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "BTN1";
};
};
};