This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

device_get_binding returning NULL for a custom board (blinky example)

I created a simple custom board (in VS Code 'Create a new board' Wizard) based on nrf9160 secure.

I copied the LED part of the original dts and I want to run blinky.

At first it worked, then somehow somewhere it stopped working. I traced the issue down to the function device_get_binding() that keeps returning NULL for my custom board even though all applicable settings and pins are identical.

I have tried the same with nrf52840 and nrf52832 and I get the same result.

The frustrating part is that it did work and stopped working all of a sudden - Is there some global setting that I could have accidently changed?

Parents
  • Hello Eduan, can you share the device tree you are using and show the definition of LED0 ?

  • Hi, this is the dts file for the nrf52832 example:

    // Copyright (c) 2022 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52832_ciaa.dtsi>
    
    / {
    	model = "act";
    	compatible = "nordic,act";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			/* ANNA-B1 GPIO_29 */
    			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
    			label = "Red LED";
    		};
    		led1: led_1 {
    			/* ANNA-B1 GPIO_30 */
    			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    			label = "Green LED";
    		};
    		led2: led_2 {
    			/*ANNA-B1 GPIO_31 */
    			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
    			label = "Blue LED";
    		};
    	};
    
    	aliases {
    		led0 = &led0;
    		led1 = &led1;
    		led2 = &led2;
    	};
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x3e000 0x32000>;
    		};
    		scratch_partition: partition@70000 {
    			label = "image-scratch";
    			reg = <0x70000 0xa000>;
    		};
    		storage_partition: partition@7a000 {
    			label = "storage";
    			reg = <0x7a000 0x6000>;
    		};
    	};
    };
    
    

Reply
  • Hi, this is the dts file for the nrf52832 example:

    // Copyright (c) 2022 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52832_ciaa.dtsi>
    
    / {
    	model = "act";
    	compatible = "nordic,act";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			/* ANNA-B1 GPIO_29 */
    			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
    			label = "Red LED";
    		};
    		led1: led_1 {
    			/* ANNA-B1 GPIO_30 */
    			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    			label = "Green LED";
    		};
    		led2: led_2 {
    			/*ANNA-B1 GPIO_31 */
    			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
    			label = "Blue LED";
    		};
    	};
    
    	aliases {
    		led0 = &led0;
    		led1 = &led1;
    		led2 = &led2;
    	};
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0x32000>;
    		};
    		slot1_partition: partition@3e000 {
    			label = "image-1";
    			reg = <0x3e000 0x32000>;
    		};
    		scratch_partition: partition@70000 {
    			label = "image-scratch";
    			reg = <0x70000 0xa000>;
    		};
    		storage_partition: partition@7a000 {
    			label = "storage";
    			reg = <0x7a000 0x6000>;
    		};
    	};
    };
    
    

Children
No Data
Related