14.3.5 Register Access
The counter-clock domain may be clocked externally. To update the counter-clock domain registers from software in this mode, 2-3
clock pulses on the external clock are needed to synchronize accesses to the externally clocked domain. Clock source switching is
controlled from the registers in the CMU (
10. CMU - Clock Management Unit
When the RSTEN bit in the PCNTn_CTRL register is set, the PCNT clock domain is asynchronously held in reset. The reset is synchro-
nously released two PCNT clock edges after the RSTEN bit in the PCNTn_CTRL register is cleared by software. This asynchronous
reset restores the reset values in PCNTn_TOP, PCNTn_CNT and other control registers in the PCNT clock domain.
CNTRSTEN works in a similar manner as RSTEN, but only resetting the counter, CNT. Note that the counter is also reset by RSTEN.
AUXCNTRSTEN works in a similar manner as RSTEN, but only resetting the auxiliary counter, PCNTn_AUXCNT. Note that the auxili-
ary counter is also reset by RSTEN.
Since this module is a Low Energy Peripheral, and runs off a clock which is asynchronous to the HFCORECLK, special considerations
must be taken when accessing registers. Please refer to
4.3 Access to Low Energy Peripherals (Asynchronous Registers)
for a descrip-
tion on how to perform register accesses to Low Energy Peripherals.
Note:
PCNTn_TOP and PCNTn_CNT are read-only registers. When writing to PCNTn_TOPB, make sure that the counter value,
PCNTn_CNT, can not exceed the value written to PCNTn_TOPB within two clock cycles.
14.3.6 Clock Sources
The pulse counter may be clocked from two possible clock sources: LFACLK or an external clock. The clock selection is configured by
the PCNT0CLKSEL bit in the CMU_PCNTCTRL in the Clock Management Unit (CMU),
10. CMU - Clock Management Unit
. The de-
fault clock source is the LFACLK.
This PCNT module may also use PCNTn_S0IN as an external clock to clock the counter (EXTCLKSINGLE mode) and to sample
PCNTn_S1IN (EXTCLKQUAD mode). Setup, hold and max frequency constraints for PCNTn_S0IN and PCNTn_S1IN for these modes
are specified in the device datasheet.
To use this module, the LE interface clock must be enabled in CMU_HFBUSCLKEN0, in addition to the module clock in
CMU_PCNTCTRL.
Note:
PCNT Clock Domain Reset, RSTEN, should be set when changing clock source for PCNT. If changing to an external clock source, the
clock pin has to be enabled as input prior to de-asserting RSTEN. Changing clock source without asserting RSTEN results in undefined
behaviour.
14.3.7 Input Filter
An optional pulse width filter is available in OVSSINGLE and OVSQUAD modes, when LFACLK is selected as a clock source for the
Pulse Counter in CMU
10. CMU - Clock Management Unit
. The filter is enabled by writing 1 to the FILT bit in the PCNTn_CTRL regis-
ter. When enabled, the high and low periods of PCNTn_S0IN and PCNTn_S1IN must be stable for a programmable number of consec-
utive clock cycles before the edge is passed to the edge detector. The filter length should be programmed in FILTLEN field of the
PCNTn_OVSCFG register.
Figure 14.12 PCNT Input Filter length Equation on page 372
Filter length = (F 5) LFACLK cycles
Figure 14.12. PCNT Input Filter length Equation
The maximum filter length configured is 260 LFACLK cycles.
In EXTCLKSINGLE and EXTCLKQUAD mode, there is no digital pulse width filter available.
EFM32JG1 Reference Manual
PCNT - Pulse Counter
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 372