This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I am looking for simple example of HW driver of QDEC for nrf5340.

Hi.
I am looking for simple example of using QDEC for nrf5340.
I want to use the Segger Embedded Studio.


Where can I find the example of some guide for HW driver for nrf5340pdk?
When I compile the project “blinky_pwm” I get the error “Unsupported board: pwm-led0 devicetree alias is not defined”. How can I define the correspond HW?

Parents
  • Hi,

    I am looking for simple example of using QDEC for nrf5340.

     Seems like we are missing some nRF5340 DTS, board and SoC defines for QDEC in NCS and Zephyr, but I will look into creating a simple example for you.

    Where can I find the example of some guide for HW driver for nrf5340pdk?

     We have this guide for working with the nRF5340, https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf5340.html

    When I compile the project “blinky_pwm” I get the error “Unsupported board: pwm-led0 devicetree alias is not defined”. How can I define the correspond HW?

     Seem to be missing this dts define for the nRF5340 PDK and DK. If you add this overlay file in the blink_pwm folder, it should work:

    The overlays can be found in this .zip file:

    blinky_pwm overlays.zip

    The overlay looks like this:

    / {
    	aliases {
    		pwm-led0 = &pwm_led0;
    	};
    };
    
    / {
    pwmleds {
    	compatible = "pwm-leds";
    	pwm_led0: pwm_led_0 {
    		pwms = < &pwm0 0x1c >;
    	};
    };
    };

  • Hi.
    It still doesn't work. I new in Zephyr. Correct me what I am doing wrong.


    I add these 2 files from zip (unpacked) in folder "v1.4.2\zephyr\samples\basic\blinky_pwm". I see the "nrf5340pdk_nrf5340_cpuapp.overlay" in the project space, in "dts files" . But it is still the same error (Unsupported board: pwm-led0...)

    I also tried: remove the second, "nrf5340dk_nrf5340_cpuapp.overlay" from the folder, remove the last curly bracket (it seems without some without opening). I also tried to edit "nrf5340pdk_nrf5340_cpuapp.dts" and add pwm-led0 to the file.
    How can I know what is included in the compilation? For example, in c file I add #error directive to get indication that this part included in compilation.

  • I changed the file 
    "v1.4.2\zephyr\boards\arm\nrf5340dk_nrf5340\nrf5340_cpuapp_common.dts"

    I added the correspond lines form "nrf5340pdk_nrf5340_cpuapp.overlay" to it: added pwmleds in devices node and correspond line in aliases node.

    Now, project is working. Please, correct me if I did something wrong or if there is better way.

  • VadymS said:
    It still doesn't work. I new in Zephyr. Correct me what I am doing wrong.

    Some theories, (1) You might need to open/import the project again for the overlay to take effect. (2) Might need to check the "Clean Build Directory" when you open the project. or (3) Maybe you used the wrong board name, and therefore the overlay was not applied.

    VadymS said:
    Now, project is working. Please, correct me if I did something wrong or if there is better way.

     Great! The way you did it is the best way. It should have been in that file from the start, i.e. similar to how its done in e.g. boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts

Reply
  • VadymS said:
    It still doesn't work. I new in Zephyr. Correct me what I am doing wrong.

    Some theories, (1) You might need to open/import the project again for the overlay to take effect. (2) Might need to check the "Clean Build Directory" when you open the project. or (3) Maybe you used the wrong board name, and therefore the overlay was not applied.

    VadymS said:
    Now, project is working. Please, correct me if I did something wrong or if there is better way.

     Great! The way you did it is the best way. It should have been in that file from the start, i.e. similar to how its done in e.g. boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts

Children
Related