8 years, 9 months ago.

Hardware timer on nRF51822

I am trying to achieve a 15.625 kHz (doesn't have to be exact) frequency PWM signal with a 10-bit duty cycle resolution on the nRF51822. The chip has a 16 mHz clock, so it should work, but I am not getting there with the PwmOut lib. Is it using hardware timers on the nRF51822? Is there something else I am missing?

Thanks in advance, Tom

Question relating to:

1 Answer

8 years, 7 months ago.

/mbed-src/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/pwmout_api.c

  1. define TIMER_PRECISION 4 4us ticks
  2. define TIMER_PRESCALER 6 4us ticks = 16Mhz/(2^6)

By default the timer prescaler is set to 4uS steps.