diff options
-rw-r--r-- | os/hal/platforms/STM32/pwm_lld.c | 13 | ||||
-rw-r--r-- | readme.txt | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/os/hal/platforms/STM32/pwm_lld.c b/os/hal/platforms/STM32/pwm_lld.c index 6a0cf311a..335c0c8bd 100644 --- a/os/hal/platforms/STM32/pwm_lld.c +++ b/os/hal/platforms/STM32/pwm_lld.c @@ -87,8 +87,9 @@ static void stop_channels(PWMDriver *pwmp) { pwmp->pd_tim->CCR2 = 0; /* Comparator 2 disabled. */
pwmp->pd_tim->CCR3 = 0; /* Comparator 3 disabled. */
pwmp->pd_tim->CCR4 = 0; /* Comparator 4 disabled. */
- pwmp->pd_tim->CCMR1 = 0; /* Channels 1 and 2 frozen. */
- pwmp->pd_tim->CCMR2 = 0; /* Channels 3 and 4 frozen. */
+ /* Channels forced to idle.*/
+ pwmp->pd_tim->CCMR1 = TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2M_2;
+ pwmp->pd_tim->CCMR2 = TIM_CCMR2_OC3M_2 | TIM_CCMR2_OC4M_2;
}
#if STM32_PWM_USE_TIM2 || STM32_PWM_USE_TIM3 || STM32_PWM_USE_TIM4 || \
@@ -504,22 +505,22 @@ void pwm_lld_disable_channel(PWMDriver *pwmp, pwmchannel_t channel) { switch (channel) {
case 0:
pwmp->pd_tim->CCR1 = 0;
- pwmp->pd_tim->CCMR1 = pwmp->pd_tim->CCMR1 & 0xFF00;
+ pwmp->pd_tim->CCMR1 = (pwmp->pd_tim->CCMR1 & 0xFF00) | TIM_CCMR1_OC1M_2;
pwmp->pd_tim->DIER &= ~TIM_DIER_CC1IE;
break;
case 1:
pwmp->pd_tim->CCR2 = 0;
- pwmp->pd_tim->CCMR1 = pwmp->pd_tim->CCMR1 & 0x00FF;
+ pwmp->pd_tim->CCMR1 = (pwmp->pd_tim->CCMR1 & 0x00FF) | TIM_CCMR1_OC2M_2;
pwmp->pd_tim->DIER &= ~TIM_DIER_CC2IE;
break;
case 2:
pwmp->pd_tim->CCR3 = 0;
- pwmp->pd_tim->CCMR2 = pwmp->pd_tim->CCMR2 & 0xFF00;
+ pwmp->pd_tim->CCMR2 = (pwmp->pd_tim->CCMR2 & 0xFF00) | TIM_CCMR2_OC3M_2;
pwmp->pd_tim->DIER &= ~TIM_DIER_CC3IE;
break;
case 3:
pwmp->pd_tim->CCR4 = 0;
- pwmp->pd_tim->CCMR2 = pwmp->pd_tim->CCMR2 & 0x00FF;
+ pwmp->pd_tim->CCMR2 = (pwmp->pd_tim->CCMR2 & 0x00FF) | TIM_CCMR2_OC4M_2;
pwmp->pd_tim->DIER &= ~TIM_DIER_CC4IE;
break;
}
diff --git a/readme.txt b/readme.txt index cc4740a7a..2ab8e1160 100644 --- a/readme.txt +++ b/readme.txt @@ -65,6 +65,8 @@ *****************************************************************************
*** 2.1.4 ***
+- FIX: Fixed PWM channels return to IDLE state in STM32 PWM driver (bug
+ 3114467)(backported to 2.0.8).
- FIX: Fixed wrong initializer macros in STM32 PWM driver (bug 3114319).
- FIX: Fixed syntax error in STM32 PWM driver(bug 3114266).
- FIX: Fixed typo in board name (bug 3113574)(backported to 2.0.7).
|