Skip to main content
Wleon.1
Associate III
March 4, 2020
Question

change LPTIM_CNT on TIM4

  • March 4, 2020
  • 2 replies
  • 678 views

Hi, is there a way to change LPTIM_CNT on TIM4 so that LPTIM_CNT = LPTIM_CMP, this is because for every interrupt we need the PWM to skip some period. is there any sample code ?

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
March 4, 2020

No, you can't do this on LPTIM, CNT is read only and there appears to be no mechanism to modify it except that it clears when it matches ARR.

While CMP and ARR can be changed on the fly, I'm not sure what's the consequence of setting either of them *at*, or even *below* current CNT.

JW

mckenney
Associate
March 4, 2020

I haven't used LPTIM, but observed behavior with TIMx (L0/L4 series) was that setting CCR==CNT triggered an immediate compare event (interrupt). I remember since that wasn't what I wanted it to do. I never did find chapter-and-verse for that behavior.

waclawek.jan
Super User
March 4, 2020

Thanks for sharing this detail, @mckenney​ .

The LPTIM in the very details appears to be quite different from TIM, though.

JW