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
  • Hello Andy,

    First of all, when it comes to getting familiar with dts etc., I would also recommend taking a look at the DevAcademy (this also mentions certain differences between the NCS versions that might be interesting to you). You'll probably find the majority of your questions on dts answered there. It's true like you say that overlay files can be very helpful when you only want minor changes. The overlay file lets you modify certain parts of the dts file by simply adding the overlay. 

    I'm new to dts and was wondering if there is a better approach that does not require copying the original board.

    When it comes to a custom board it might be that it pays off to modify the board file of the DK instead. One reason for this is that it might be hard to know about all the different files you need. For more on this you can for instance take a look at this webinar, though I believe this part might be covered in DevAcademy as well.

    Can you point me to the documentation and samples how to customize a standard board dts with peripherals?

    You can for instance have a look here.

    Everything broke in 2.1 - I get undefined labels, overlapping pin assignments and lots  of other errors - can provide the whole list if needed

    Yes, unfortunately there are a few differences between these versions of NCS. I would recommend (like Jtrueb also did below) to take a look at the release notes and migration guides. One thing to mention that is rather new in NCS 2.0 is the new pinctrl API. You can convert to this new setup using the migration script.

    There might be bigger differences between the two NCS versions that I've currently overlooked, let me know if you have questions about any one in particular.

    Regards,

    Elfving

  • Thank you both very much. That's a good start. The pinctl conversion script worked fine . I may have more questions as I go through all my peripherals, will update here.

  • Great! Let me know when you do.

    Regards,

    Elfving

  • 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
Reply
  • 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
Children
Related