cancel
Showing results for 
Search instead for 
Did you mean: 

change LPTIM_CNT on TIM4

Wleon.1
Associate II

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 ?

3 REPLIES 3

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
Senior

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.

Thanks for sharing this detail, @mckenney​ .

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

JW