Skip to content
Snippets Groups Projects
Commit 0705d6c8 authored by David Sidrane's avatar David Sidrane Committed by Daniel Agar
Browse files

stm32 drv_io_timer: Prevent glitch on PWM outputs (#11453)

Rate changes were doing an asynchronous register reload via the EGR_UG. This could extend a PWM pulse up to 2X.

This fix removes the asynchronous update. The net effect is the the rate change will occur on the next counter expiration. The worst case is the rate change is delayed by 20 Ms.
parent b01e470f
No related branches found
No related tags found
No related merge requests found
......@@ -461,12 +461,9 @@ static int allocate_channel(unsigned channel, io_timer_channel_mode_t mode)
static int timer_set_rate(unsigned timer, unsigned rate)
{
/* configure the timer to update at the desired rate */
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
/* generate an update event; reloads the counter and all registers */
rEGR(timer) = GTIM_EGR_UG;
rARR(timer) = (BOARD_PWM_FREQ / rate) - 1;
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment