Overlay conflict with dts

Hello,

I have a project for the nRF52811 using the nRF Connect SDK. As I understand, it’s not recommended to modify the main .dts file directly; instead, changes should be made through an .overlay file.

However, when I add a button to my overlay on a pin that’s already used in the .dts file (e.g., gpio0 pin 9), I get a warning saying: pin 9 of gpio0 already assigned to &led2. I found a suggestion to remove the original pin assignment in the overlay using:

/delete-node/ &led2;

/delete-property/ led2;

But when I do this, it causes an error in the original .dts file in the aliases section: led2 = &led2; -> unknown reference to &led2.

So, I'm unsure of the correct approach here. Should I modify the original .dts file directly? Should I create my own .dts file that isn’t part of the SDK? Or is there a clear guide on how to handle these conflicts properly?

Thank you very much for your help!

Parents Reply Children
  • Thank you. But still error:

    This is in my overlay:

      aliases{
            btntx1 = &btntx1;
            btntx2 = &btntx2;
            btntx3 = &btntx3;
            btntx4 = &btntx4;
            adcbat = &adcbat;
            adcbat2 = &adcbat2;
            userledgreen = &ledtxgreen;
            userledred  = &ledtxred;
            /delete-property/ led0;
            /delete-property/ led1;
            /delete-property/ led2;
            /delete-property/ led3;
        };
    
        /delete-node/ leds;
    But in .dts file is error becasue the aliases for led0,1,2,3 are undefined:
    aliases {
            led0 = &led0;
            led1 = &led1;
            led2 = &led2;
            led3 = &led3;
            pwm-led0 = &pwm_led0;
            sw0 = &button0;


    What else is wrong? Thank you
    in  .dts: 
  • Do you see warnings in the build output as well (can be viewed by opening the terminal view in VS code). The warnings may be a false positive given by the DT extension. To confirm this, you may check the generated zephyr.dts file in your build folder to see if the aliases and leds node are present or not.

  • OK, looks like the problem is only in VSCode extension now: 

  • Thanks for confirming. I will report this internally.

    I have a project for the nRF52811 using the nRF Connect SDK. As I understand, it’s not recommended to modify the main .dts file directly; instead, changes should be made through an .overlay file.

    The other recommended alternative is to create your own board file.

Related