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

using SDK 15.0 and PCA10040: would like to create a repeating sawtooth waveform using PWM and easyDMA

Hi Everyone,

I've looked around at the Nordic documentation before asking this question but can't find any good example.    I am looking for an example to create a repetitive waveform using the PWM hardware and easyDMA.   There will be a simple RC filter on the PWM pin.

The requirement:   generate a repeating PWM waveform from 'N' points stored in an array.   These numbers could be 100 values from 10 to 220, as an example.

I want to update the PWM with a new value at a 38kHz rate.    The hope is that operation of the BLE radio won't interrupt the generation of the ramp waveform.

Has anyone created or seen some some code to accomplish this?   I'd appreciate seeing it if you have.

I'm currently using the post I found here as a rough example,    devzone.nordicsemi.com/.../nrf52832-pwm-sequence-endlessly-by-easydma        but it's for an earlier SDK and I'm using a PCA10040 with SDK 15.0.       Surprisingly, there are no useful example for PWM and easyDMA in SDK 15.0

Thanks,

Mark

Parents
  • Hi,

    Surprisingly, there are no useful example for PWM and easyDMA in SDK 15.0

    Have you seen the PWM driver example in the SDK ? 

    You can find the source code and the project file of the example in the following folder: 

    <SDK_InstallFolder>\examples\peripheral\pwm_driver

    The example consist of 5 different demos, showing different ways to use the PWM driver, also with EasyDMA.

    The requirement:   generate a repeating PWM waveform from 'N' points stored in an array.   These numbers could be 100 values from 10 to 220, as an example.

    That should be doable. Put your 'N' points in the seq_values array, and remember to use the NRF_DRV_PWM_FLAG_LOOP flag when you start the playback.

Reply
  • Hi,

    Surprisingly, there are no useful example for PWM and easyDMA in SDK 15.0

    Have you seen the PWM driver example in the SDK ? 

    You can find the source code and the project file of the example in the following folder: 

    <SDK_InstallFolder>\examples\peripheral\pwm_driver

    The example consist of 5 different demos, showing different ways to use the PWM driver, also with EasyDMA.

    The requirement:   generate a repeating PWM waveform from 'N' points stored in an array.   These numbers could be 100 values from 10 to 220, as an example.

    That should be doable. Put your 'N' points in the seq_values array, and remember to use the NRF_DRV_PWM_FLAG_LOOP flag when you start the playback.

Children
No Data
Related