Skip to main content
dtarrago
Associate III
March 1, 2017
Solved

STM32L4 PWM with LPTIM

  • March 1, 2017
  • 1 reply
  • 1177 views
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
This topic has been closed for replies.
Best answer by waclawek.jan

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

1 reply

waclawek.jan
waclawek.janBest answer
Super User
March 1, 2017

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