28.3.16.1 Capacitive Sense
Figure 28.15 Capacitive Sense Setup on page 947
illustrates how the EFR32 can be configured to monitor four capacitive buttons.
ACMP0_CH0
ACMP0_CH1
ACMP0_CH2
ACMP0_CH3
Figure 28.15. Capacitive Sense Setup
The following steps show how to configure LESENSE to scan through the four buttons 100 times per second, issuing an interrupt if one
of them is pressed.
1. Assuming LFACLK
LESENSE
is 32 kHz, set PCPRESC to 3 and PCTOP to 39 in CTRL. This will set the LESENSE scan frequency to
100 Hz.
2. Enable channels 0 through 3 in CHEN and set IDLECONF for these channels to DISABLED. In capacitive sense mode, the GPIO
should always be disabled (i.e., analog input).
3. Configure the ACMP to operate in CAPSENSE mode (refer to the ACMP chapter for more details).
4. Configure the following bit fields in CHx_CONF, for channels 0 through 3:
a. Set EXTIME to 0. No excitation is needed in this mode.
b. Set SAMPLE to ACMPCOUNT and COMP to LESS. This makes LESENSE interpret a sensor as active if the frequency on a
channel drops below the threshold (i.e., the button is pressed).
c. Set SAMPLEDLY to an appropriate value - each sensor will be measured for SAMPLEDLY/F
LFACLK_LESENSE
seconds. MEAS-
UREDLY should be set to 0
5. Set CTRTHRESHOLD to an appropriate value. An interrupt will be issued if the counter value for a sensor is below this threshold
after the measurement phase.
6. Enable interrupts on channels 0 through 3.
7. Start scan sequence by writing a 1 to START in CMD.
In a capacitive sense application, it might be required to calibrate the threshold values on a periodic basis, for example to compensate
for humidity and other physical variations. LESENSE is able to store up to 16 counter values from a configurable number of channels,
making it possible to collect sample data while in EM2. When calibration is to be performed, the CPU only has to be woken up for a
short period of time as the data to be processed already lies in the result registers. To enable storing of the count value for a channel,
set STRSAMPLE in the CHx_INTERACT register.
Reference Manual
LESENSE - Low Energy Sensor Interface
silabs.com
| Building a more connected world.
Rev. 1.1 | 947