Unsupported Pin GPIO error with SDK 2.6.0

Hi,

We have developed our code against SDK 2.3.0 and I wanted to try to upgrade the SDK to 2.6.0. I had to remove CONFIG_OPENTHREAD_CHILD_SUPERVISION from my prj.conf, but after that the project was build. But when I flashed the new hex, it seems just hanged. There are no other code changes.

I tried debugging from the start to see where this happens. It occurs from the call to dk_leds_init (). 

I can trace the execution path down to 

static inline int z_impl_gpio_pin_configure(const struct device *port,
                        gpio_pin_t pin,
                        gpio_flags_t flags)
in gpio.h.
The error occurs in the line 1001.
__ASSERT((cfg->port_pin_mask & (gpio_port_pins_t)BIT(pin)) != 0U"Unsupported pin");
There are no changes to the device tree. 
This is what I have in leds section of my device tree overlay. 
	leds {
		compatible = "gpio-leds";
		led0: led_0 {
			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;  // Rev1.0 	0.16-Blue
			label = "Blue LED";
			status = "okay";
		};
		led1: led_1 {
			gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;	// Rev1.0 	0.20-Red
			label = "RED LED";
			status = "okay";
		};
		led2: led_2 {
			gpios = <&gpio0 26  GPIO_ACTIVE_HIGH>;	// Rev1.0 	0.17-GREEN
			label = "Green LED";
			status = "okay";
		};
		led3: led_3 {
			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;	// NTC_EN	Rev 1.0 - 1.9
			label = "NTC_EN";
			status = "okay";
		};
		led4: led_4 {
			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;  // This is to compansate for Rev 1.2 with Minew and without Minew designs
			label = "Blue1 LED";
			status = "okay";
		};
		led5: led_5 {
			gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;	// This is to compansate for Rev 1.2 with Minew and without Minew designs
			label = "RED1 LED";
			status = "okay";
		};
	};
What could be going wrong here?
Cheers,
Kaushalya
Parents
  • What was the pin number that is giving the error? 

    Can you show the code snippet of how you call this? or maybe step to see if port_pin_mask have value different in v2.6.0 than in v2.3.0? If So, then maybe the GPIO driver configuration is not set correctly. Are you sure that CONFIG_GPIO_NRFX is set in your prj.conf? check the ".config" file in your build folder to see if this is set to y.

Reply
  • What was the pin number that is giving the error? 

    Can you show the code snippet of how you call this? or maybe step to see if port_pin_mask have value different in v2.6.0 than in v2.3.0? If So, then maybe the GPIO driver configuration is not set correctly. Are you sure that CONFIG_GPIO_NRFX is set in your prj.conf? check the ".config" file in your build folder to see if this is set to y.

Children
  • Hi Susheel,

    What was the pin number that is giving the error?

    Thanks for your reply. The error comes from the first, GPIO_0, Pin 23. 

    Can you show the code snippet of how you call this?

    In my code it starts with

    ret = dk_leds_init();

    dk_leds_init () function is defined in dk)buttons_and_leds.c. It defines leds [] as

    #define GPIO_SPEC_AND_COMMA(button_or_led) GPIO_DT_SPEC_GET(button_or_led, gpios),
    
    static const struct gpio_dt_spec leds[] = {
    #if DT_NODE_EXISTS(LEDS_NODE)
    	DT_FOREACH_CHILD(LEDS_NODE, GPIO_SPEC_AND_COMMA)
    #endif
    };

    in dk_leds_init () function 

    err = gpio_pin_configure_dt(&leds[i], GPIO_OUTPUT);

    gpio_pin_configure_dt (...) is defined in gpio.h.

    maybe step to see if port_pin_mask have value different in v2.6.0 than in v2.3.0

    Yes they are different!! In 2.3.0 it is 0xffffffff and in 2.6.0 it is 0xff01f8bc. I previously didnt have the CONFIG_GPIO_NRFX enabled in my prj.conf. But even with that enabled, no difference to end result. Following are two screen shots of the debug window highlighting the differences.

    Only other difference I did between the two builds is enabling/disabling  CONFIG_OPENTHREAD_CHILD_SUPERVISION, which I doubt has any influence.

    Whats going on here?

    Cheers,

    Kaushalya

Related