
RM0453 Rev 2
959/1454
RM0453
Low-power timer (LPTIM)
973
Figure 268. Continuous counting mode when repetition register LPTIM_RCR
different from zero (with PRELOAD = 1)
A repetition counter underflow event is systematically associated with LPTIM preloaded
registers update (refer to section "Register update" for more information).
Repetition counter underflow event is signaled to the software through the Update Event
(UE) flag mapped into the LPTIM_ISR register. When set, the UE flag can trigger an LPTIM
interrupt if its respective Update Event Interrupt Enable (UEIE) control bit, mapped to the
LPTIM_IER register, is set.
The repetition register LPTIM_RCR is located in the APB bus interface clock domain where
the repetition counter itself is located in the LPTIM kernel clock domain. Each time a new
value is written to the LPTIM_RCR register, that new content is propagated from the APB
bus interface clock domain to the LPTIM kernel clock domain so that the new written value
is loaded to the repetition counter immediately after a repetition counter underflow event.
The synchronization delay for the new written content is four APB clock cycles plus three
LPTIM kernel clock cycles and it is signaled by the REPOK flag located in the LPTIM_ISR
register when it is elapsed. When the LPTIM kernel clock cycle is relatively slow, for
instance when the LPTIM kernel is being clocked by the LSI clock source, it can be lengthy
to keep polling on the REPOK flag by software to detect that the synchronization of the
LPTIM_RCR register content is finished. For that reason, the REPOK flag, when set, can
generate an interrupt if its associated REPOKIE control bit in the LPTIM_IER register is set.
Note:
After a write to the LPTIM_RCR register, a new write operation to the same register can only
be performed when the previous write operation is completed. Any successive write before
the REPOK flag is set, leads to unpredictable results.
Caution:
When using repetition counter with PRELOAD = 0, LPTIM_RCR register must be changed
at least five counter cycles before the autoreload match event, otherwise an unpredictable
behavior may occur.
28.4.17 Debug
mode
When the microcontroller enters debug mode (core halted), the LPTIM counter either
continues to work normally or stops, depending on the DBG_LPTIM_STOP configuration bit
in the DBG module.
MSv47415V1
LPTIM_RCR
Repetition counter
LPTIM_ARR
Compare
PWM
1
0
9
9
0
8
7
Repetition counter underflow event
Preloaded registers updated
4