Zephyr: Migrate to SDK 2.1 from SDK 1.9.1

I have a custom board based on nRF52840 with some custom peripherals : LEDs, buzzer, buttons, etc

To get my app working I copied the  nrf52840dk_nrf52840  board from the 1.9.1 SDK  and modified the dts file to add my peripherals according to the shematics, and it all worked great

Everything broke in 2.1 - I get undefined labels, overlapping pin assignments and lots  of other errors - can provide the whole list if needed
I'm new to dts and was wondering if there is a better approach that does not require copying the original board.
Is this what overlays are for? Can you point me to the documentation and samples how to customize a standard board dts with peripherals?
Thank you 
Parents Reply Children
  • OK, the update went smoother than I expected  - the pinctrl and namespace scripts really helped

    It compiles an (mostly) runs but some things do not work.

    I have vibrator on my board that is accessed via a GPIO pin which is defined as follows in the dts

    custom_pins {
            compatible = "gpio-keys";

            vibrator: vibrator_1 {
                gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
                label = "Vibrator pin";
            };
         
        };
    It is  also in the aliases list:
    aliases:{
    vib1 = &vibrator;
    };
    In the code I have this

    #define VIBR_NODE   DT_ALIAS(vib1)
    #define VIB_LABEL   DT_LABEL(VIBR_NODE)

    But when I call  device_get_binding(VIB_LABEL)

    it returns NULL.

    I tried using 

    GPIO_DT_SPEC_GET(VIBR_NODE   , gpios) but that does not compile
     
    What am I missing?
    Thanks
  • Update
    Got it to work 

    #define VIBR_NODE_ALIAS   DT_ALIAS(vib1)
    // This method works in SDK 2.1 
    static const struct gpio_dt_spec dt_spec =  GPIO_DT_SPEC_GET_OR(VIBR_NODE_ALIAS, gpios, {0});
    Then in the code use dt_spec.port which the pointer to struct device
     My port to SDK2.1.1 is now complete
    Thank you all for help .
  • Great! Glad to hear you figured it out.

    Regards,

    Elfving

Related