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

NRF52 help configuring TIMER + DMA + PWM

I need help configuring TIMER + DMA + PWM ( nrf52 ).

I would like to set the value of PWM with an interval of 100 ms and PWM configured to frequency of 20-40kHz.

Optinal use of EasyDMA for the PWM module is redundant over the resources used and the frequency of the PWM is not fixed.

Typically when using DMA, data at a specified interval is copied to pre-configured PWM module.

We are using the NRF52832 and the documentation describes EasyDMA in the context of using peripherals but, I did not find an implementation description for the mode copy RAM to peripheral register with timer set interval.

Does anyone know how to implement such a system?

Parents
  • Hi

    Do you have any experience with the TIMER and PPI modules?

    If you configure the PWM in the NextStep mode it will only read a new value from the buffer once you activate the NEXTSTEP task:

    NRF_PWM0->TASKS_NEXTSTEP = 1;
    

    By using the PPI controller you can connect one of the TIMER COMPARE events to the NEXTSTEP task, to have the timer control the PWM update frequency.

    Before you do this you can set up a RAM buffer for the PWM to read from, so that you can run the PWM in the background without having to continuously feed it new data.

    Best regards
    Torbjørn

  • hello, the code in the example works on the PWM frequency 25KHz but nrf5d dk can not start correctly at 50 kHz

    pwm is integrated into the working project. I'll make an example later

    examples from the library are designed for a small frequency of 1 kHz

    if you have an example at 50 kHz or hex for nrf52 DK with implemented PWM. happy to check on nrf52 DK

    In any way it is impossible to generate a correct signal. what are the peaks is the way out but it's wrong.

    devzone.nordicsemi.com/.../

    this example generates only 222 kHz perhaps this will tell where the problem. is compiled on nrf52 dk keil, my project sdk_config.h

Reply
  • hello, the code in the example works on the PWM frequency 25KHz but nrf5d dk can not start correctly at 50 kHz

    pwm is integrated into the working project. I'll make an example later

    examples from the library are designed for a small frequency of 1 kHz

    if you have an example at 50 kHz or hex for nrf52 DK with implemented PWM. happy to check on nrf52 DK

    In any way it is impossible to generate a correct signal. what are the peaks is the way out but it's wrong.

    devzone.nordicsemi.com/.../

    this example generates only 222 kHz perhaps this will tell where the problem. is compiled on nrf52 dk keil, my project sdk_config.h

Children
No Data
Related