...the world's most energy friendly microcontrollers
2014-07-02 - Tiny Gecko Family - d0034_Rev1.20
334
www.silabs.com
the channel configuration registers, CHx_TIMING, CHx_INTERACT, and CHx_EVAL, throughout this
chapter.
By default, the channel configuration registers are directly mapped to the channel number. Configuring
SCANCONF in CTRL makes it possible to alter this mapping.
Configuring SCANCONF to INVMAP will make channels 0-7 use the channel configuration registers
for channels 8-15, and vice versa. This feature allows an application to quickly and easily switch
configuration set for the channels.
Setting SCANCONF to TOGGLE will make channel x alternate between using CH
X
_CONF and CH
X
+8
_CONF. The configuration used is decided by the state of the corresponding bit in SCANRES. For
instance, if channel 3 is performing a scan and bit 3 in SCANRES is set, CH
11
_CONF will be used.
Channels 8 through 15 will toggle between CH
X
_CONF and CH
X-8
_CONF. This mode provides an easy
way for implementation of hysteresis on channel events as threshold values can be changed depending
on sensor status.
Setting SCANCONF to DECDEF will make the state of the decoder define which scan configuration
to be used. If the decoder state is at index 8 or higher, channel x will use CH
X+8
_CONF, otherwise it
will use CH
X
configuration. Similarly, channels 8 through 15 will use CH
X
configuration when decoder
state index is less than 8 and CH
X-8
_CONF when decoder state index is higher than 7. Allowing
the decoder state to define which configuration to use, enables easy implementation of for instance
hysteresis, as different threshold values can be used for the same channel, depending on the state of
the application. Table 21.1 (p. 334) summarizes how channel configuration is selected for different
setting of SCANCONF.
Table 21.1. LESENSE scan configuration selection
SCANCONF
DIRMAP
INVMAP
TOGGLE
DECDEF
LESENSE
channel x
SCANRES[n] = 0
SCANRES[n] = 1
DECSTATE < 8
DECSTATE >= 8
0 <= x < 8
CH
x
_CONF
CH
x
+8
_CONF
CH
x
_CONF
CH
x+8
_CONF
CH
x
_CONF
CH
x+8
_CONF
8 <= x < 16
CH
x
_CONF
CH
x-8
_CONF CH
x
_CONF
CH
x-8
_CONF
CH
x
_CONF
CH
x-8
_CONF
Channels are enabled in the CHEN register, where bit x enables channel x. During a scan, all enabled
channels are measured, starting with the lowest indexed channel. Figure 21.2 (p. 335) illustrates a
scan sequence with channels 3, 5, and 9 enabled.
21.3.2 Scan sequence
LESENSE runs on LFACLK
LESENSE
, which is a prescaled version of LFACLK. The prescaling factor for
LFACLK
LESENSE
is selected in the CMU, available prescaling factors are:
• DIV1: LFACLK
LESENSE
= LFACLK/1
• DIV2: LFACLK
LESENSE
= LFACLK/2
• DIV4: LFACLK
LESENSE
= LFACLK/4
• DIV8: LFACLK
LESENSE
= LFACLK/8
Note
LFACLK
LESENSE
should not exceed 50kHz.
All enabled channels are scanned each scan period. How a new scan is started is configured in the
SCANMODE bit field in CTRL. If set to PERIODIC, the scan frequency is generated using a counter which
is clocked by LFACLK
LESENSE
. This counter has its own prescaler. This prescaling factor is configured in
PCPRESC in TIMCTRL. A new scan sequence is started each time the counter reaches the top value,
PCTOP. The scan frequency is calculated using Equation 21.1 (p. 335) . If SCANMODE is set to
Summary of Contents for EFM32TG
Page 543: ......