thingy53 rgb_led sample

I'm trying to test the RGB led on the thingy53.

Using the sample:
C:\ncs\v2.6.0\zephyr\samples\basic\rgb_led
which gives errors about the devices error: '__device_dts_ord_DT_N_ALIAS_red_pwm_led_P_pwms_IDX_0_PH_ORD' undeclared
I would have thought those would be defined just as they are on the thingy52.

I found the following which provided some devicetree overlays, which I have tried without success.
https://devzone.nordicsemi.com/f/nordic-q-a/73245/controlling-rgb-led-on-nordic-thingy-52-using-nrf52-sdk

Am I supposed to create an overlay for thingy53 to use the RGB led?  Can you help me get one that works?  I have tried attached.

thingy53_nrf5340_cpuapp.overlay

  • I'm not sure what happened when I tested it before.

    I'm not using vscode, but the command line west build -b thingy53_nrf5340_cpuapp .

    That worked!  Thank you for the help.

  • Hehe no problem. 

    Once again, please have a look at the DevAcademy for further info on how NCS works.

    Regards,

    Elfving

  • Using the same board overlay and code I tried to use the thingy91.
    west build -b thingy91x_nrf5340_cpuapp . --build-dir thingy91build

    C:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_N_ALIAS_bluepwm_P_pwms_IDX_0_PH_ORD' undeclared here (not in a function)
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

    the other i2c rtc device is also showing similar. 

    It looks like they are defined as led0-2; I set those alias.

    aliases {
            redpwm = &led0;
            greenpwm = &led1;
            bluepwm = &led2;
    }


    Doing that clears more of the errors. But still leads to 

    C:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_44' undeclared here (not in a function); did you mean '__device_dts_ord_46'?
       89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
      137 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    C:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
       89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                 ^~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
      216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))


    I need to spend more time with the NCS docs you pointed at; I did define an overlay the same as the 53 and attempt it from within vscode as well.

    Should the thingy91 require a different overlay to support the rgb leds?  I'm surprised the thingy53 required the custom device overlay to get the rgb sample working.  Looks like I will have to maintain separate overlays for the 53 and 91?


  • Ah yes the different boards are made a bit differently, which means that you'll unfortunately have to work a bit on these overlay files to get things working. 

    tldr said:
    I'm surprised the thingy53 required the custom device overlay to get the rgb sample working.

    Like I said, this being something you have to do is because it comes directly from Zephyr. The samples made my Nordic should work by default on all of our boards (.. or atleast the ones we list as supported by a certain sample, though it should work on more than what is listed here but we only list the ones we've tested). 

    The Thingy91 really stands out, as the nRF9160 can't do any BLE on its own, which is why we give the board an nRF5340 as well. And now you have two nRFs on one PCB, with some LEDs connected to the one, and some to the other. The dts file is bound to be a bit different.

    As a starting point in order to get familiar with NCS it might be easier to work with samples from us, but also DKs instead of Thingys.

    I can look further into this if you want, but that is the cause of the difference between the Thingy53 and 91.

    Regards and have a good week-end!

    Elfving

  • Its definitely more complicated than just doing aliases.  I can focus on the 53; but I'm interested in the thingys and not the DK boards at this time.

    The first error is cryptic and I'm not sure 
    C:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_44' undeclared here (not in a function); did you mean '__device_dts_ord_46'?
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    C:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y

    looking at the dts for the 91 I don't see any i2c defined either.  Based on your details about the two chips and the lack of BLE on one vs the other; sounds like the thingy91 is quite a bit of work to get the same code working on both.  Again will need to define the buzzer that does not get defined either.

    I understand it is not a sample from nordic; would be nice to use names that match upstream so that simple examples just work (at least for the rgb; its like hello world).

Related