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

What is the max frequency the PWM peripheral can produce on the nRF51822?

I want to drive motors at 40kHz and am wondering if I will be able to do this with the nRF51822. If not 40kHz, I might be able to go as low as 15kHz. What is the resolution and maximum frequency I can generate while also using the S110 soft device (e.g. maintaining ble communications).

Parents
  • Hi

    The implementation in this PWM library should be pretty much independent of the CPU. Only if you intend to update the PWM duty cycle you need to use the CPU.

    The CPU is blocked for some time during BLE radio transmission but the PWM will still be uninterrupted since it is maintained by TIMER+PPI+GPIOTE hardware peripherals which do not need the CPU. So I think 40kHz should be no problem. You might experience though up to 6ms delay when you want to update the duty cycle of the PWM, since the softdevice can block the CPU for up to 6ms.

  • To generate a sine wave at 40 kHz, the PWM duty cycle has to be updated x times as many times, where x is the amount of points in the sine wave. For a gritty sine wave with 25 points you would already need to update the duty cycle at 1 MHz. In the examples you show the CPU is also used to update the sine waves. The maximum PMW frequency I managed to get is 250 kHz and a maximum duty cycle update frequency of 8 kHz, which is by far not enough to make a sine wave at 40 kHz.

Reply
  • To generate a sine wave at 40 kHz, the PWM duty cycle has to be updated x times as many times, where x is the amount of points in the sine wave. For a gritty sine wave with 25 points you would already need to update the duty cycle at 1 MHz. In the examples you show the CPU is also used to update the sine waves. The maximum PMW frequency I managed to get is 250 kHz and a maximum duty cycle update frequency of 8 kHz, which is by far not enough to make a sine wave at 40 kHz.

Children
No Data
Related