Topics

nrf52 overlay file to reconfigure GPIO for buttons and leds

frv
 

Hi all,

I want to reconfigure the LEDs and Button's GPIO pins.

I have this overlay file as content:

/*
 * Copyright (c) 2017 Shawn Nock <shawn@...>
 * Copyright (c) 2017 Linaro Limited
 *
 * SPDX-License-Identifier: Apache-2.0
 */
 
&leds {
        compatible = "gpio-leds";
        led0: led_0 {
                gpios = <&gpio0 7 GPIO_INT_ACTIVE_LOW>;
                label = "Red LED";
        };
        led1: led_1 {
                gpios = <&gpio0 8 GPIO_INT_ACTIVE_LOW>;
                label = "Green LED";
        };
        led2: led_2 {
                gpios = <&gpio0 9 GPIO_INT_ACTIVE_LOW>;
                label = "Yellow LED";
        };
};
 
&buttons {
        compatible = "gpio-keys";
        button0: button_0 {
                gpios = <&gpio0 4 GPIO_PUD_PULL_UP>;
                label = "Normal call button";
        };
        button1: button_1 {
                gpios = <&gpio0 5 GPIO_PUD_PULL_UP>;
                label = "Assistance call button";
        };
        button2: button_2 {
                gpios = <&gpio0 6 GPIO_PUD_PULL_UP>;
                label = "Yellow call button";
        };
};

But facing these compilation errors:
Error: nrf52_pca10040.dts.pre.tmp:479.1-6 Label or path leds not found
Error: nrf52_pca10040.dts.pre.tmp:494.1-9 Label or path buttons not found

Although leds and buttons in defined in the base dts file, it seems the & to leds and buttons can not be resolved?

Any idea's what I'm doing wrong, thank you.
Br,
Frank


frv
 

Hi,

I'm getting further but not completely there.

So I added these changes to my overlay file:

&button0 {
          gpios = <&gpio0 4 GPIO_PUD_PULL_UP>;
          label = "Normal call button";
        };
 
&button1 {
          gpios = <&gpio0 5 GPIO_PUD_PULL_UP>;
          label = "Assistance call button";
        };
 
&button2 {
          gpios = <&gpio0 6 GPIO_PUD_PULL_UP>;
          label = "Yellow call button";
};

I remapped for uart0 the pins to:

&uart0 {
     tx-pin  = <22>;
     rx-pin  = <23>;
     cts-pin = <24>;
     rts-pin = <25>;
     #status = "disabled";
};

I can control button0 which is now mapped to pin 4 but the  button1 and button2 which are resp. mapped to 5 and 6 I can't get to work.
Could it be that the pins 5 and 6 don't support GPIO pull_up?

Thanks,
Br,
Frank
 
 

frv
 

Hi all,

Finally resolved it all.

Br,
Frank