mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 00:03:33 +08:00
Bugfix: corrects the ARR calculation for the PWM timer
The calculation of the ARR on the PWM timer did not subtract 1 from the timer period calculation to get the ARR value.
This commit is contained in:
committed by
David Sidrane
parent
919b3a218a
commit
38a4c1e90b
@@ -457,7 +457,7 @@ static int timer_set_rate(unsigned timer, unsigned rate)
|
||||
{
|
||||
|
||||
/* configure the timer to update at the desired rate */
|
||||
rARR(timer) = BOARD_PWM_FREQ / rate;
|
||||
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
|
||||
|
||||
/* generate an update event; reloads the counter and all registers */
|
||||
rEGR(timer) = GTIM_EGR_UG;
|
||||
|
||||
Reference in New Issue
Block a user