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

  • Hello David,

    So first of all, the rgb_led sample is a sample directly from Zephyr, which means it might not work right out of the box with a Nordic board. Though with something as basic as this it should be an easy fix. 

    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

    I'm not really seeing the overlay files here, this case seems to be refering to how to do it in the old nRF5SDK, which is not the new Zephyr based nRF Connect SDK.

    So if we have a look at the main file of the sample, we see some references to names of nodes and aliases that are not used in the thingys DTS files (red_pwm_led vs red_led_pwm for instance). An overlay file would be used to change the board, and for instance the aliases used so yeah you can make one of those and add this to it:

    / {
    
        aliases{
    		redpwm = &red_led_pwm;
    		greenpwm = &green_led_pwm;
    		bluepwm = &blue_led_pwm;
    
        };
    };

    And you could also change these lines in the main.c file.

    static const struct pwm_dt_spec red_pwm_led =
    	PWM_DT_SPEC_GET(DT_ALIAS(redpwm));
    static const struct pwm_dt_spec green_pwm_led =
    	PWM_DT_SPEC_GET(DT_ALIAS(greenpwm));
    static const struct pwm_dt_spec blue_pwm_led =
    	PWM_DT_SPEC_GET(DT_ALIAS(bluepwm));
    

    For more info how to work with overlay files, dts etc.I would recommend having a look in our DevAcademy.

    Regards,

    Elfving

  • I just changed the overlay to be just what you supplied and I also changed thee names in DT_ALIAS().

    C:/ncs/v2.6.0/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_DT_N_ALIAS_redpwm_P_pwms_IDX_0_PH_ORD' undeclared here (not in a function)
    89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
    | ^~~~~~~~~
    C:/ncs/v2.6.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
    137 | #define _DO_CONCAT(x, y) x ## y

    Still having trouble with the sample.  thanks for your quick response.

  • What version of the board are you building for? Could you send me your project?

    Regards,

    Elfving

  • How do I find the version of the board?2438.rgb_led.zip  Sample attached.

    I'm using an nrf5340dk and a thingy53.

  • When you add a build configuration to build the project you can see that there are many options. You can also see the same thing after building in the drop-down menu on your applications.

    I just tried building the project you sent for the thingy53_nrf5340_cpuapp and it worked on my side.

    Regards,

    Elfving

Related