drivers: pwm: pwm_nrf5_sw: Fix calculation of cycles per second

The nRF5x HF timer base frequency is 16 MHz, not 16777216 Hz.

The improved accurracy of the PWM signal was verified with an
oscilloscope on a BBC micro:bit.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit is contained in:
Henrik Brix Andersen 2018-05-31 14:00:33 +02:00 committed by Carles Cufí
commit f5310d5b54

View file

@ -208,7 +208,7 @@ static int pwm_nrf5_sw_get_cycles_per_sec(struct device *dev, u32_t pwm,
config = (struct pwm_config *)dev->config->config_info; config = (struct pwm_config *)dev->config->config_info;
/* HF timer frequency is derived from 16MHz source and prescaler is 0 */ /* HF timer frequency is derived from 16MHz source and prescaler is 0 */
*cycles = 16 * 1024 * 1024; *cycles = 16000000UL;
return 0; return 0;
} }