MPR121 Serial Communication



Similar documents
USB to SPI Device Driver Installation Instructions

QorIQ espi Controller Register Setting Considerations and Programming Examples

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, ColdFire+, C- Ware, the Energy Efficient Solutions logo, Kinetis,

Safety Lifecycle illustrated with exemplified EPS

Connecting Kinetis MCU with CMOS Sensor Interface through GPIO QQVGA image transfer to Kinetis internal SRAM

Qorivva MPC5643L Dual Processor Mode Mark Ruthenbeck Applications Engineering Microcontroller Solutions Group

FRDM-KL25Z User's Manual Rev. 1.0

Freescale MAC Security Setup

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

Hardware Configurations for the i.mx Family USB Modules

Production Flash Programming Best Practices for Kinetis K- and L-series MCUs

How To Build A Project On An Eclipse Powerbook For Anarc (Powerbook) On An Ipa (Powerpoint) On A Microcontroller (Powerboard) On Microcontrollers (Powerstation) On Your Microcontroller 2 (Powerclock

76-77 GHz RF Transmitter Front-end for W-band Radar Applications

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

Solar Panel 3-Phase Inverter Controlled by the PXS20 Libor Prokop Rožnov pod Radhoštem, Czech Republic

UART Boot Loader Design on the Kinetis E Series

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, ColdFire+, C- Ware, the Energy Efficient Solutions logo, Kinetis,

Xtrinsic MAG3110 Three-Axis, Digital Magnetometer

Building and Debugging a project using Keil MDK-ARM Eclipse plug-in

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

Windows 7: Using USB TAP on a Classic CodeWarrior Installation (MGT V9.2 DSC V8.3)

Local Interconnect Network (LIN) Physical Interface

CodeWarrior Development Studio Floating Licensing Quick Start

CodeWarrior Development Studio for Freescale S12(X) Microcontrollers Quick Start

MED-AFEs Design Reference Manual

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

Programming Audio Applications in the i.mx21 MC9328MX21

RF Power LDMOS Transistors High Ruggedness N--Channel Enhancement--Mode Lateral MOSFETs

7 OUT1 8 OUT2 9 OUT3 10 OUT4 11 OUT5 12 OUT6 13 OUT7 14 OUT8 15 OUT9 16 OUT10 17 OUT11 18 OUT12 19 OUT13 20 OUT14 21 OUT15 22 OUT16 OUT17 23 OUT18

Simple Method of Changing the Frequency Range of a Power Amplifier Circuit

Installation of the MMA955xL CodeWarrior Service Pack Author: Fengyi Li Application Engineer

Wafer Level Chip Scale Package (WLCSP)

How to Run the MQX RTOS on Various RAM Memories for i.mx 6SoloX

Configuring CoreNet Platform Cache (CPC) as SRAM For Use by Linux Applications

TWR-KV31F120M Sample Code Guide for IAR Board configuration, software, and development tools Rev.0

LC898300XA. Functions Automatic adjustment to the individual resonance frequency Automatic brake function Initial drive frequency adjustment function

Flexible Active Shutter Control Interface using the MC1323x

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Initializing the TSEC Controller

IRTC Compensation and 1 Hz Clock Generation

Detecting a CPM Overload on the PowerQUICC II

Developing an Application for the i.mx Devices on the Linux Platform

5.0 A H-Bridge with Load Current Feedback

Tweeting? Please use hashtag #FTF2011. Freescale on Facebook Tag yourself in photos and upload your own!

Understanding LCD Memory and Bus Bandwidth Requirements ColdFire, LCD, and Crossbar Switch

5.0 A Throttle Control H-bridge

Software and Support Activation. Quick Start Guide

Single Phase Two-Channel Interleaved PFC Operating in CrM

etpu Host Interface by:

Freescale, the Freescale logo and CodeWarrior are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Xtrinsic is a trademark of

Adding SDIO Wi-Fi Solution to i.mx Windows CE 5.0/Windows CE 6.0

Designing an Induction Cooker Using the S08PT Family

Atmel MSL3040/41/50/60/80/86/87/88 Programmers Guide

How To Improve Performance On A P4080 Processor

Cyclic Redundant Checker Calculation on Power Architecture Technology and Comparison of Big-Endian Versus Little-Endian

RF Power LDMOS Transistors Enhancement--Mode Lateral MOSFETs

AN111: Using 8-Bit MCUs in 5 Volt Systems

Enhanced Serial Interface Mapping

Genesi Pegasos II Setup

RETRIEVING DATA FROM THE DDC112

Blood Pressure Monitor Using Flexis QE128 Gabriel Sanchez RTAC Americas

AN Level shifting techniques in I 2 C-bus design. Document information

Quick Start Guide. MRB-KW01 Development Platform Radio Utility Application Demo MODULAR REFERENCE BOARD

MCF54418 NAND Flash Controller

DS1307ZN. 64 x 8 Serial Real-Time Clock

EEPROM PROGRAMMING FOR PCIe UARTs

Quick Start Guide. TWR-MECH Mechatronics Board TOWER SYSTEM

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

How To Fit A 2Mm Exposed Pad To A Dfn Package

Quick Start Guide. USB Packet Sniffer/Dongle for Kinetis MKW22D and MKW24D Wireless MCUs USB-KW24D512

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Freescale MQX USB Device User Guide

DS2401 Silicon Serial Number

Field Software Updates Using TPMS LF An example using the Low Frequency radio (LFR) for wireless software updating

UM I 2 C-bus specification and user manual. Document information

How To Control A Motor Control On An Hvac Platform

RF Power LDMOS Transistor High Ruggedness N--Channel Enhancement--Mode Lateral MOSFET

AN2680 Application note

DS1621 Digital Thermometer and Thermostat

Integrated Silicon Pressure Sensor On-Chip Signal Conditioned, Temperature Compensated and Calibrated

2015 Qualcomm Technologies, Inc. All rights reserved.

PQ-MDS-T1 Module. HW Getting Started Guide. Contents. About This Document. Required Reading. Definitions, Acronyms, and Abbreviations

ic-mq EVAL MQ1D EVALUATION BOARD DESCRIPTION

Software Real Time Clock Implementation on MC9S08LG32

Connecting Low-Cost External Electrodes to MED-EKG

Heterojunction Bipolar Transistor Technology (InGaP HBT) Broadband High Linearity Amplifier

Data Movement Between Big-Endian and Little-Endian Devices

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

DDR Validation Tool User Guide

Ref Parameters Symbol Conditions Min Typ Max Units. Standby μa. 3 Range kpa. 4 Resolution 0.15 kpa. 5 Accuracy -20ºC to 85ºC ±1 kpa

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

User Guide. Introduction. HCS12PLLCALUG/D Rev. 0, 12/2002. HCS12 PLL Component Calculator

HANDLING SUSPEND MODE ON A USB MOUSE

Transcription:

Freescale Semiconductor Document Number: AN3895 Application Note Rev. 2, 02/2013 MPR121 Serial Communication INTRODUCTION The MPR121 uses an I 2 C Serial Interface. The I 2 C protocol implementation and the specifics of communicating with the Touch Sensor Controller are detailed in this application note. SERIAL-ADDRESSING 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 () and a Serial Clock Line () 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 clock that synchronizes the data transfer. The MPR121 line operates as both an input and an open-drain output. A pullup resistor, typically 4.7 kω, is required on. The MPR121 line operates only as an input. A pullup resistor, typically 4.7 kω, is required on if there are multiple masters on the two-wire interface, or if the master in a single-master system has an open-drain output. Each transmission consists of a condition (Figure 1) sent by a master, followed by the MPR121 s 7-bit slave address plus bit, a register address byte, one or more data bytes, and finally a STOP condition. t LOW t SU DAT t SU STA t t HD STA t HD DAT SU STO t BUF t HIGH t HD STA t R t F REPEATED STOP Figure 1. Wire Serial Interface Timing Details 2009-2013 Freescale Semiconductor, Inc. All rights reserved.

AND STOP S Both and remain high when the interface is not busy. A master signals the beginning of a transmission with a (S) condition by transitioning from high to low while is high. When the master has finished communicating with the slave, it issues a STOP (P) condition by transitioning from low to high while is high. The bus is then free for another transmission. DATA LINE STABLE DATA VALID CHANGE OF DATA ALLOWED BIT TRANSFER Figure 2. Start and Stop Conditions One data bit is transferred during each clock pulse (Figure 3). The data on must remain stable while is high. S P STOP ACKNOWLEDGE Figure 3. Bit Transfer The acknowledge bit is a clocked 9 th bit (Figure 4) which the recipient uses to handshake receipt of each byte of data. Thus each byte transferred effectively requires nine bits. The master generates the 9 th clock pulse, and the recipient pulls down during the acknowledge clock pulse, such that the line is stable low during the high period of the clock pulse. When the master is transmitting to the MPR121, the MPR121 generates the acknowledge bit, since the MPR121 is the recipient. When the MPR121 is transmitting to the master, the master generates the acknowledge bit, since the master is the recipient. CLOCK PULSE FOR ACKNOWLEDGEMENT 1 2 8 9 BY TRANSMITTER BY RECEIVER S Figure 4. Acknowledge 2 Freescale Semiconductor, Inc.

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. Table 1. MPR121 Slave Address ADDR Pin Connection VSS VDD I 2 C Address 0x5A 0x5B 0x5C 0x5D MESSAGE FORMAT FOR WRITING THE MPR121 A write to the MPR121 comprises the transmission of the MPR121 s keyscan slave address with the bit set to 0, followed by at least one byte of information. The first byte of information is the command byte. The command byte determines which register of the MPR121 is to be written by the next byte, if received. If a STOP condition is detected after the command byte is received, the MPR121 takes no further action (Figure 5) beyond storing the command byte. Any bytes received after the command byte are data bytes. CommandbyteisstoredonreceiptofSTOPcondition D15 D14 D13 D12 D11 D10 D9 D8 S SLAVE ADDRESS 0 A COMMAND BYTE Figure 5. Command Byte Received Any bytes received after the command byte are data bytes. The first data byte goes into the internal register of the MPR121 selected by the command byte (Figure 6). Howcommand byte and data byte map into MPR121's registers Acknowledge from MPR121 Acknowledge from MPR121 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 S SLAVE ADDRESS 0 A COMMAND BYTE A DATA BYTE 1byte Auto-increment memory word address Figure 6. Command and Single Data Byte Received If multiple data bytes are transmitted before a STOP condition is detected, these bytes are generally stored in subsequent MPR121 internal registers because the command byte address generally auto-increments. Freescale Semiconductor, Inc. 3

MESSAGE FORMAT FOR READING THE MPR121 MPR121 is read using MPR121's internally stored register address as address pointer, the same way the stored register address is used as address pointer for a write. The pointer generally auto-increments after each data byte is read using the same rules as for a write. Thus, a read is initiated by first configuring MPR121's register address by performing a write (Figure 5) followed by a repeated start. The master can now read 'n' consecutive bytes from MPR121, with first data byte being read from the register addressed by the initialized register address. CommandbyteisstoredonreceiptofSTOP condition D15 D14 D13 D12 D11 D10 D9 D8 S SLAVE ADDRESS 0 A COMMAND BYTE A Repeated Start S SLAVE ADDRESS 1 A DATABYTE nbytes auto-increment memory word address D7 Acknowledge from master D6 D5 D4 D3 D2 D1 D0 Stop OPERATION WITH MULTIPLE MASTER Figure 7. Reading MPR121 The application should use repeated starts to address the MPR121 to avoid bus confusion between I 2 C masters.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. 4 Freescale Semiconductor, Inc.

How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale data sheets and/or specifications can and do vary in different applications, and actual performance may vary over time. All operating parameters, including typicals, must be validated for each customer application by customer s technical experts. Freescale does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: freescale.com/salestermsandconditions. Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, Energy Efficient Solutions logo, Kinetis, mobilegt, PowerQUICC, Processor Expert, QorIQ, Qorivva, StarCore, Symphony, and VortiQa are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, MagniV, MXC, Platform in a Package, QorIQ Qonverge, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, Vybrid, and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2013 Freescale Semiconductor, Inc. Document Number: AN3895 Rev. 2 02/2013