Nations Technologies Inc.
Tel
:
+86-755-86309900
:
info@nationstech.com
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
300
/
631
The LPTIM APB interface and the LPTIM kernel logic use different clocks, so there is some latency between the
software write through APB bus and the moment when these values are available to the kernel logic. During this
latency period, any additional write into these registers must be avoided.
The update method of LPTIM_ARR and LPTIM_COMP registers is determined by the LPTIM_CFG.RELOAD bit:
LPTIM_CFG.RELOAD bit equals to ‘1’: LPTIM_ARR and LPTIM_COMP registers are updated when
counter overflow, if the LPTIM already started. When counter overflow, latency = 2~3 APB clock period.
LPTIM_CFG.RELOAD bit equals to ‘0’: LPTIM_ARR and LPTIM_COMP registers are updated after any
software write access. Latency = 2~3 APB clock 2~3 LPTIM internal prescaled clock period.
The LPTIM_INTSTS.ARRUPD flag and the LPTIM_INTSTS.CMPUPD flag indicate when the write operation is
completed to respectively the LPTIM_ARR register and the LPTIM_COMP register.
After a write to the LPTIM_ARR register or the LPTIM_COMP register, any successive write before respectively
the LPTIM_INTSTS.ARRUPD flag or the LPTIM_INTSTS.CMPUPD flag be set, will lead to unpredictable results.
So a new write operation to the same register can only be performed when the previous write operation is completed.
Counter mode
The internal counter can count external trigger events from LPTIM Input1 or internal clock cycles. This can be
configured through LPTIM_CFG.CLKSEL and LPTIM_CFG.CNTMEN bits.
If LPTIM is counting external triggers, user can configure LPTIM_CFG.CLKPOL[1:0] bits to select the active edge
from rising edge, falling edge or both edges.
The count modes below can be selected, depending on LPTIM_CFG.CLKSEL and LPTIM_CFG.CNTMEN bits
values:
LPTIM_CFG.CLKSEL = 0: the LPTIM use an internal clock source to clock.
LPTIM_CFG.CNTMEN = 0, The LPTIM is configured to be clocked by an internal clock source and the
LPTIM counter is configured to be updated following each internal clock pulse.
LPTIM_CFG.CNTMEN = 1, The LPTIM external Input1 is sampled with the internal clock provided to
the LPTIM. In order to not miss any event, the frequency of the changes on the external Input1 signal
should never exceed the frequency of the internal clock provided to the LPTIM. Also, the internal clock
provided to the LPTIM must not be pre-scaled (LPTIM_CFG.CLKPRE[2:0] = 000).
LPTIM_CFG.CLKSEL = 1: the LPTIM use an external clock source to clock.
LPTIM_CFG.CNTMEN bit value is don’t care. In this configuration, the LPTIM has no need for an internal
clock source (except if the glitch filters are enabled). The signal injected on the LPTIM external Input1 is
used as system clock for the LPTIM. This configuration is suitable for operation modes where no embedded
oscillator is enabled.
For this configuration, the LPTIM counter can be updated either on rising edges or falling edges of the
input1 clock signal but not on both rising and falling edges.