MPR121
Sensors
Freescale Semiconductor, Inc. 19
With above mentioned, one possible example setting is given out below using equation 1~3, with the assumption that setting TL
at 90% of USL, and LSL at 65% of USL would cover most of the application case. It may need further adjustment in some cases
but will be a very good start.
USL = (VDD - 0.7)/VDD x 256 Eqn. 1
TL = USL x 0.9 = (VDD - 0.7)/VDD x 256 x 0.9 Eqn. 2
LSL = USL x 0.65 = (VDD-0.7) / VDD x 256 x 0.65 Eqn. 3
Cin = I x T / V = CDC x CDT / (ADC counts x VDD/1024) Eqn. 4
It may not necessary to set the USL at the level of VDD - 0.7 but it is beneficial to keep the applied constant charge current as
accurate as that specified in the data sheet. This so the capacitance value on the input can be calculated with high accuracy
using ADC conversion Equation 4. Using VDD-0.7 as USL level allows some headroom for applications where the supply varies
over a certain range. For a system where the supply changes over a range, the lowest VDD point is considered for
autoconfiguration so that a relative lower charge field can be used to avoid clipping the electrode data to VDD when it drops.
5.12 Out-Of-Range Status Registers (0x02, 0x03)
Ex_OOR, EPROX_OOR: Out-Of-Range Status bits for the 13 channels. This bit set indicates that a corresponding channel has
failed autoconfiguration and autoreconfiguration for range check. Those bits are cleared when they pass the auto-configuration
and auto-reconfiguration range check. These bits are user read only.
ACFF: Auto-Configuration Fail Flag. When autoconfiguration fails, this bit is set. This bit is user read only.
ARFF: Auto-Reconfiguration Fail Flag. When autoreconfiguration fails, this is bit set. This bit is user read only.
When autoconfiguration and/or autoreconfiguration are enabled, MPR121 checks the electrode data after each auto-
configuration, auto-reconfiguration operation to see if it is still in the range set by USL and LSL. When electrode data goes out of
the range, corresponding Ex_OORx bit becomes “1” to indicate the failed channels. One example of triggering OOR error is
shorting the measurement sensing pad to power rails, or shorting it with other channels.
5.13 Soft Rest Register (0x80)
Write 0x80 with 0x63 asserts soft reset. The soft reset does not effect the I
2
C module, but all others reset the same as POR.
5.14 GPIO Registers (0x73~0x7A)
ELE0~ELE7 OOR Status (0x02)
Bit D7 D6 D5 D4 D3 D2 D1 D0
Read E7_OOR E6_OOR E5_OOR E4_OOR E3_OOR E2_OOR E1_OOR E0_OOR
Write
ELE8~ELEPROX OOR Status (0x03)
Bit D7 D6 D5 D4 D3 D2 D1 D0
Read ACFF ARFF EPROX_OOR E11_OOR E10_OOR E9_OOR E8_OOR
Write
GPIO Registers (0x73~0x7A)
GPIO Registers D7 D6 D5 D4 D3 D2 D1 D0
Control Register 0(0x73) GTL0_E11 GTL0_E10 GTL0_E9 GTL0_E8 GTL0_E7 GTL0_E6 GTL0_E5 GTL0_E4
Control Register 1(0x74) GTL1_E11 GTL1_E10 GTL1_E9 GTL1_E8 GTL1_E7 GTL1_E6 GTL1_E5 GTL1_E4
Data Register(0x75) DAT_E11 DAT_E10 DAT_E9 DAT_E8 DAT_E7 DAT_E6 DAT_E5 DAT_E4
MPR121
Sensors
20 Freescale Semiconductor, Inc.
These registers control GPIO and LED driver functions. D7~D0 bits correspond to GPIO and LED functions on ELE11~ ELE4
inputs respectively. When any of these ports are not used for electrode sensing, it can be used for GPIO or LED driver. The GPIO
control registers can be write at anytime regardless Stop Mode or Run mode. The configuration of the LED driver and GPIO
system is described with more detail in application note AN3894.
Note: The number of touch sensing electrodes, and therefore the number of GPIO ports left available is configured by the ECR
(0x5E) and GPIO Enable Register (0x77). ECR has higher priority and overrides the GPIO enabled in 0x77, that is when a pin is
enabled as GPIO but is also selected as electrode by ECR, the GPIO function is disabled immediately and it becomes an
electrode during Run Mode.
In the Stop Mode just after power-on reset, all electrodes and GPIO ports are in high impedance as all the GPIO ports are default
disabled and the electrodes are not enabled.
EN, DIR, CTL0, CTL1: GPIO enable and configuration bits, the functions are in description table below.
When the EN bit is set, the corresponding GPIO pin is enabled and the GPIO function is configured by CTL0, CTL1 and DIR bits.
When the port is used as an input, it can be configured as a normal logic input with high impedance (CTL0CTL1 = 2b00), input
with internal pull-down (CTL0CTL1 = 2b10) or pullup (CTL0CTL1 = 2b11). Note: the former may result in an unstable logic input
state if opened without fixed logic level input.
The GPIO output configuration can be configured as either push pull (CTL0CTL1 = 2b00) or open drain. When the GPIO is used
for LED drivers, the GPIO is set to high side only open drain (CTL0CTL1 = 2b11), which is can source up to 12 mA current into
the LED.
DAT: GPIO Data Register bits.
When a GPIO is enabled as an output, the GPIO port outputs the corresponding DAT bit level from GPIO Data Register (0x075).
The output level toggle remains on during any electrode charging. The level transition will occur after the ADC conversion takes
place. It is important to note that reading this register returns the content of the GPIO Data Register, (not a level of the port). When
a GPIO is configured as input, reading this register returns the latched input level of the corresponding port (not contents of the
GPIO Data Register). Writing to the DAT changes content of the register, but does not effect the input function.
SET: Writing a “1” to this bit will set the corresponding bit in the Data Register.
CLR: Writing a “1” to this bit will clear the corresponding bit in the Data Register.
TOG: Writing a “1” to this bit will toggle the corresponding bit in the Data Register
Writing “1” into the corresponding bits of GPIO Data Set Register, GPIO Data Clear Register, and GPIO Data Toggle Register will
set/clear/toggle contents of the corresponding DAT bit in Data Register. Writing “0” has no meaning. These registers allow any
individual port(s) to be set, cleared, or toggled individually without effecting other ports. It is important to note that reading these
registers returns the contents of the GPIO Data Register reading.
Direction Register(0x76) DIR_E11 DIR_E10 DIR_E9 DIR_E8 DIR_E7 DIR_E6 DIR_E5 DIR_E4
Enable Register(0x77) EN_E11 EN_E10 EN_E9 EN_E8 EN_E7 EN_E6 EN_E5 EN_E4
Data Set Register(0x78) SET_E11 SET_E10 SET_E9 SET_E8 SET_E7 SET_E6 SET_E5 SET_E4
Data Clear Register(0x79) CLR_E11 CLR_E10 CLR_E9 CLR_E8 CLR_E7 CLR_E6 CLR_E5 CLR_E4
Data Toggle Register(0x7A) TOG_E11 TOG_E10 TOG_E11 TOG_E8 TOG_E7 TOG_E6 TOG_E5 TOG_E4
EN DIR CTL0:CTL1 Function Description
0 X XX GPIO function is disabled. Port is high-z state.
1 0 00 GPIO port becomes input port.
1 0 10 GPIO port becomes input port with internal pulldown.
1 0 11 GPIO port becomes input port with internal pullup.
1 0 01 Not defined yet (as same as CTL = 00).
1 1 00 GPIO port becomes CMOS output port.
1 1 11 GPIO port becomes high side only open drain output port for LED driver.
1 1 10 GPIO port becomes low side only open drain output port.
1 1 01 Not defined yet (as same as CTL = 00).
GPIO Registers (0x73~0x7A)
MPR121
Sensors
Freescale Semiconductor, Inc. 21
6 MPR121 Serial Communication
6.1 I
2
C Serial Communications
The MPR121 uses an I
2
C Serial Interface.The MPR121 operates as a slave that sends and receives data through an I
2
C two-
wire interface. The interface uses a Serial Data Line (SDA) and a Serial Clock Line (SCL) to achieve bidirectional communication
between master(s) and slave(s). A master (typically a microcontroller) initiates all data transfers to and from the MPR121, and it
generates the SCL clock that synchronizes the data transfer.
The MPR121 SDA line operates as both an input and an open-drain output. A pullup resistor, typically 4.7 kΩ, is required on SDA.
The MPR121 SCL line operates only as an input. A pullup resistor, typically 4.7 kΩ, is required on SCL if there are multiple
masters on the two-wire interface, or if the master in a single-master system has an open-drain SCL output.
Each transmission consists of a START condition (Figure 3) sent by a master, followed by the MPR121’s 7-bit slave address plus
R/W
bit, a register address byte, one or more data bytes, and finally a STOP condition.
Figure 3. Two-Wire Serial Interface Timing Details
6.2 Slave Address
The MPR121 has selectable slave addresses listed by different ADDR pin connections. This also makes it possible for multiple
MPR121 devices to be used together for channel expansions in a single system.
6.3 Operation with Multiple Master
When operating with multiple masters, bus confusion between I
2
C masters is sometimes a problem. One way to prevent this is
to avoid using repeated starts to the MPR121. On a I
2
C bus, once a master issues a start/repeated start condition, that master
owns the bus until a stop condition occurs. If a master that does not own the bus attempts to take control of that bus, then
improper addressing may occur. An address may always be rewritten to fix this problem. Follow I
2
C protocol for multiple master
configurations.
Table 10. MPR121 Slave Address
ADDR Pin Connection
I
2
C Address
VSS 0x5A
VDD 0x5B
SDA 0x5C
SCL 0x5D
SCL
SDA
t
LOW
t
HIGH
t
F
t
R
t
HD STA
t
HD DAT
t
HD STA
t
SU DAT
t
SU STA
t
BUF
t
SU STO
ST ART
CONDIT ION
ST O P
CONDIT ION
REPEAT ED ST ART
CONDIT ION
ST ART
CONDIT ION

MPR121QR2

Mfr. #:
Manufacturer:
NXP / Freescale
Description:
Capacitive Touch Sensors Low Voltage Touch Pad
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet