cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 PWM with LPTIM

dtarrago
Senior
Posted on March 01, 2017 at 16:29

I'm working with STM32L475 and I'm using LPTIM to create a PWM signal. LSE clock is used (because I will use Stop mode), and period is set to 31 in ordet to generate 1kHz signal. PWM is working fine and dutycycle is modified according to the pulse value I set to the 'HAL_LPTIM_PWM_Start' function. Nevertheless, when I try to set PWM signal to 100% or 0%, the output signal looks similar to the one I have when dutycycle is set to 99% or 1%. Do you know why I get such behaviour?

#lptim #stm32l4 #pwm
1 ACCEPTED SOLUTION

Accepted Solutions

Posted on March 02, 2017 at 00:39

This is the limitation of LPTIMs hardware. The period is (LPTIM_ARR+1) x prescaled_clock_cycle, and pulse width is (LPTIM_CMP+1) x prescaled_clock_cycle, with LPTIM_CMP = 0...(LPTIM_ARR-1), as required by RM.

Pity the RM does not explain this clearly.

JW

View solution in original post

1 REPLY 1

Posted on March 02, 2017 at 00:39

This is the limitation of LPTIMs hardware. The period is (LPTIM_ARR+1) x prescaled_clock_cycle, and pulse width is (LPTIM_CMP+1) x prescaled_clock_cycle, with LPTIM_CMP = 0...(LPTIM_ARR-1), as required by RM.

Pity the RM does not explain this clearly.

JW