Can't override pin assignment in .overlay

Hello,

I'm trying to declare custom GPIO on pin that are already used by the default dts of the nRF7002-DK. I'm currently testing on P0.11 that is used by SPI4.

My code is quite simple and toggle a LED, a custom GPIO no used by default and a custom that is already used by default. Only the two firsts are effectively toggling, the custom GPIO that is used by default remains at 0. I tried with several pins and the result is always the same.

My code :

#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>

#define GPIOCUS0 DT_ALIAS(gpiocus0)
#define GPIOCUS1 DT_ALIAS(gpiocus1)
#define LED0_NODE DT_ALIAS(led0)

static const struct gpio_dt_spec gpioTest = GPIO_DT_SPEC_GET(GPIOCUS0, gpios);
static const struct gpio_dt_spec gpioTest1 = GPIO_DT_SPEC_GET(GPIOCUS1, gpios);
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);

void main( void ) {

	gpio_pin_configure_dt(&gpioTest, GPIO_OUTPUT_ACTIVE);
	gpio_pin_configure_dt(&gpioTest1, GPIO_OUTPUT_ACTIVE);
	gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);

	while(1){
		gpio_pin_set_dt(&gpioTest, 1);
		gpio_pin_set_dt(&gpioTest1, 1);
		gpio_pin_set_dt(&led, 1);
		printk("ON\n");
		k_msleep(500);
		gpio_pin_set_dt(&gpioTest, 0);
		gpio_pin_set_dt(&gpioTest1, 0);
		gpio_pin_set_dt(&led, 0);
		printk("OFF\n");
		k_msleep(500);
	}	
}

My overlay file :

/{
    gpioCustom{
        compatible = "gpio-keys";
        gpioCus0: gpioCus0{
            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
            label = "Custom";
        };

        gpioCus1: gpioCus1{
            gpios = < &gpio0 26 GPIO_ACTIVE_HIGH >;
            label = "Custom2";
        };
    };

    aliases{
        gpiocus0 = &gpioCus0;
        gpiocus1 = &gpioCus1;
    };
};

/delete-node/ &spi4;

Has anyone got stuck on a similar issue or im I missing something somewhere ?

Thank you

Parents Reply Children
  • Hello again, and sorry for being this slow. There can be some delays on devzone during this vacation season.

    Since you got it working on P0.12 I assume you've understood dts side of this problem. If not, using the new "devicetree action" in VSC might make it a bit easier.

    The issue with P0.11 is that it is used by default as the SW0 connection to the interface chip on the DK. You can see this somewhat explained on the back of the DK as well. 

    If you do still want use this pin though (and not use the debugger of the DK anymore) you can disable the interface MCU on the SW6, and then solder SB14. You would then have to program the DK using an external programmer. 

    Regards,

    Elfving

Related