Incorporating a Capacitive Touch Interface into Your Design Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved. Renesas Technology & Solution Portfolio 2 © 2012 Renesas Electronics America Inc. All rights reserved. Microcontroller and Microprocessor Line-up 2010 2012 1200 DMIPS, Superscalar 32-bit Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby 1200 DMIPS, Performance Automotive, 40nm 500µA/MHz, 35µA deep standby 500 DMIPS, Low Power Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby 165 DMIPS, FPU, DSC Industrial, 40nm 200µA/MHz, 0.3µA deep standby 165 DMIPS, FPU, DSC Industrial, 90nm 200µA/MHz, 1.6µA deep standby 8/16-bit 25 DMIPS, Low Power Industrial, 90nm 1mA/MHz, 100µA standby Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby 44 DMIPS, True Low Power 10 DMIPS, Capacitive Touch Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby Industrial Automotive, 130nm Wide Format&LCDs 350µA/MHz, 1µA standby 3 Embedded Security, ASSP © 2012 Renesas Electronics America Inc. All rights reserved. ‘Enabling The Smart Society’ Challenge: “Embedded designs are increasingly being incorporated in new, innovated interfaces. How can the engineer keep up with the increased demand for users desires for enhanced user interfaces.” Solution: “Let’s investigate one of those highly desired interfaces, capacitive touch!” 4 © 2012 Renesas Electronics America Inc. All rights reserved. Agenda Touch Basics What is ‘Capacitive Touch’ Detection methods Simple touch sensing – Transforming analog to digital Renesas Touch Solution Hardware implementation Software overview Available Solution Capacitive Touch Lab Q&A 5 © 2012 Renesas Electronics America Inc. All rights reserved. Touch Basics 6 © 2012 Renesas Electronics America Inc. All rights reserved. 6 What is Capacitive Touch? Solution Components Flat, non-conductive surface Capacitive circuitry – Electrode pads – Connecting circuits – Springs or other conductive elements Detection system – Measures change in capacitance Touch Detection Capacitance change = touch? 7 © 2012 Renesas Electronics America Inc. All rights reserved. Touch Sensing Model Based on plate capacitance model C = cap. in farads (F). A = plate area d = distance between plates k = dielectric constant E = permittivity of free space Basic Operation Object detected = 1 plate Electrode = other plate Typically: Bigger object = bigger plate area = bigger cap change Large electrodes = bigger plate area = more sensitive Thicker dielectric = less change in C = less sensitive 8 © 2012 Renesas Electronics America Inc. All rights reserved. Types of Capacitive Touch Detection Methods Mutual Capacitance * Power Consumption: Medium/High Emissions: Medium/High Immunity: Medium/High Renesas Method Self Capacitance * Power Consumption: Low Emissions: Low Immunity: Medium * Attributes may vary depending on implementation 9 © 2012 Renesas Electronics America Inc. All rights reserved. Capacitive Sensing 10 © 2012 Renesas Electronics America Inc. All rights reserved. 10 Simplified Hardware Circuit Major components… Charge Circuit 11 Circuit Control © 2012 Renesas Electronics America Inc. All rights reserved. Capacitance Detection Touch Electrode Circuit Operation Charge circuit… Vct Cr Cx Rc Cc 12 © 2012 Renesas Electronics America Inc. All rights reserved. Circuit Operation Waveform process RC charge formula 13 © 2012 Renesas Electronics America Inc. All rights reserved. Circuit Operation Quick discharge… 14 © 2012 Renesas Electronics America Inc. All rights reserved. Vct Circuit Operation RC discharge formula 15 © 2012 Renesas Electronics America Inc. All rights reserved. Circuit Operation Charge re-distribution… 16 © 2012 Renesas Electronics America Inc. All rights reserved. Vct Circuit Operation Charge re-distribution… Charge re-distribution… Charge re-distribution Vct = Vc * (Cr / Cr + Cx) 17 © 2012 Renesas Electronics America Inc. All rights reserved. Circuit Operation Continue process till Test if Vct below Vref No = Count channel up Yes = Cycle complete Charge re-distribution… 18 © 2012 Renesas Electronics America Inc. All rights reserved. Circuit Operation Repeat discharge and re-distribution Test if Vct below Vref No = Count channel up Yes = Cycle complete 19 © 2012 Renesas Electronics America Inc. All rights reserved. Touch Detection 20 © 2012 Renesas Electronics America Inc. All rights reserved. 20 Effect of Touch Adding ‘object’ adds capacitance 22 © 2012 Renesas Electronics America Inc. All rights reserved. Touch Sampling Quicker re-distribution/discharge 23 © 2012 Renesas Electronics America Inc. All rights reserved. Touch…Analog to Digital Tracking counts vs. time ‘Counts’ Time 24 © 2012 Renesas Electronics America Inc. All rights reserved. Touch…Analog to Digital 25 © 2012 Renesas Electronics America Inc. All rights reserved. 25 Touch-Sensor Control Unit 26 © 2012 Renesas Electronics America Inc. All rights reserved. 26 Why Develop Hardware? How could we control the switches shown in the diagram? Would our timing need to be accurate? How would you measure the discharge curve voltage? 27 © 2012 Renesas Electronics America Inc. All rights reserved. 27 T-SCU (Touch-Sensor Control Unit) T-SCU performs: Sequencing and timing of the charge/discharge Key scanning High-frequency filtering Interrupt Generation Data Transfers T-SCU – DTC or DMA T-SCU Features Up to 36 channel sense capability Single, scan, or selective scan modes S/W or H/W scan kickoff 28 © 2012 Renesas Electronics America Inc. All rights reserved. 28 R8C T-SCU CPU Utilization R8C/3xT SCU performs touch scanning autonomously In software solution, CPU is utilized 100% Softwarebased solution R8C/3xT Option A R8C/3xT Option B 29 CPU Active (Touch Scanning) CPU Active (System Functions) CPU System Functions CPU SCU Scanning + Data Transfer CPU Not Operating SCU Scanning + Data Transfer CLK … © 2012 Renesas Electronics America Inc. All rights reserved. CPU Active (Touch Post Processing) Less than 15% of total CPU time (20MHz) T-SCU Scan Sequence T-SCU Data Transfer to RAM Buffer SCSTRT (Start bit) Ch 0 Measure T-SCU Operating Ch 1 Measure Ch 2 Measure T-SCU Interrupt T-SCU DTC Ch 2 User Code running T-SCU DTC Ch 1 T-SCU Operating Touch SW Processing T-SCU Operating User Code running User Code running T-SCU DTC Ch 0 Complete scan example using Ch 0 to Ch 2 Scan is started by program Note: Time for operations not to scale 30 © 2012 Renesas Electronics America Inc. All rights reserved. 30 T-SCU Data Storage Count data is transferred by DTC to RAM Buffer Start address of buffer is set in T-SCU Destination Register Example • Scan channel 0-2 in ascending order • T-SCU Destination Register = 0C00h start Measure Ch 0 Dedicated RAM Measure Ch 1 Measure Ch 2 0C00h 0C01h 0C02h 0C03h 0C04h 0C05h 0C06h 0C07h 0C08h 0C09h 0C0Ah 0C0Bh CH0 dataA CH0 dataD CH1 dataA CH1 dataD CH2 dataA CH2 dataD T-SCU Interrupt 31 © 2012 Renesas Electronics America Inc. All rights reserved. 31 T-SCU Low Power Operation Core can be in “Wait” mode T-SCU trigger from Timer for sampling interval Once scan is completed DMA (not DTC) transfers data to RAM Utilizes a special SDMA block DMA interrupt “wakes” MCU on transfer complete Touch determination made No touch MCU back to sleep Touch - MCU services button 33 © 2012 Renesas Electronics America Inc. All rights reserved. 33 Low-power Example Example using Timer as Trigger T-SCU T-SCU not operating touch detection Touch Data processing normal process Power Consumption T-SCU T-SCU not operating Touch Data processing Wait mode Wait mode touch detection Timer trigger Enable T-SCU (via S/W) Start trigger (internal) T-SCU DMA transfers touch data to RAM Buffer so MCU does not wake up until DMA Interrupt occurs 34 © 2012 Renesas Electronics America Inc. All rights reserved. 34 Flexible Tuning Capability Dual Comparison Capacitor ● Aids in tuning flexibility ● Selectable via H/W register ● Reconfigurable during operation Long electrodes Choose Cr1 (CHxA1) Rr CHxA0 Cr0 CHxA1 CH Selector Cr1 CHxB Rc CHxC Cc Shorter electrodes Choose Cr0 (CHxA0) 35 © 2012 Renesas Electronics America Inc. All rights reserved. Improving Noise immunity 20MHz Sample Clock Decreased measurement cycle reduces noise influence Larger internal registers Higher count values Touch waveform with noise influence Noise influence Inverter Noise Correct level Measure point @20MHz clock High speed sample clock is effective for reducing noise 36 © 2012 Renesas Electronics America Inc. All rights reserved. Renesas Touch Software 37 © 2012 Renesas Electronics America Inc. All rights reserved. 37 Implementation Overview User Application Three Distinct Layers Application Application Layer Layer Renesas API covers: T-T-SCU Driver Tscu_mode SetTscuMode Slider position Auto Calibration Low-level functions/data can be accessed as well from any level Slider Position Detection Wheel Position Detection 38 © 2012 Renesas Electronics America Inc. All rights reserved. SetTscuDcen Touch position Detection Drift Correction Measurement value output Auto Calibration Reference Value Calculation S/W Noise Filter H/W H/W interface interface Layer Layer H/W Noise Filter Full-source code available Drift On/Off Functional Functional Implementation Implementation interface interface Layer Layer User Application Typical interface thru ‘USER API’ Sensor On/Off GetSliderPosition GetWheelPosition GetTouchOnOff Basic Touch Decision Slider/Wheel Wheel position TSCU Driver Touch API Configuration Touch API Overview Base API and User API – Base API controls TT-SCU measurement and low-level touch decision – User API allows setup and acquisition of touch data from application level Five (5) Source Files Needed touch_control.c touch_user_API.c touch_interrupt.c slider_control.c wheel_control.c 39 © 2012 Renesas Electronics America Inc. All rights reserved. Touch API Functionality Major ‘Base API’ Functions Data movement and TT-SCU interrupt process Low-level touch decision Drift correction Automatic calibration Multi Touch Cancellation New ‘User API’ Functions Wheel position detection Slider position detection Start/Stop of TT-SCU measurement Drift compensation enable/disable 40 © 2012 Renesas Electronics America Inc. All rights reserved. Touch API Features Drift Compensation Monitors continuously Reduces environmental effects Suspended if touched 41 © 2012 Renesas Electronics America Inc. All rights reserved. 41 Integrated Wheel Processing Configurable Wheel Setting Uses updated wheel shapes 4 or 8 channels selectable Positional The range of the position value is from zero to 72 When the value is zero the wheel is not touched API variable returns information 42 © 2012 Renesas Electronics America Inc. All rights reserved. Integrated Slider Processing Configurable Slider 6 channels implementation Configurable Resolution – Currently up to 256 positions Features Reports position on touch User code determines direction API variable returns information for processing 43 © 2012 Renesas Electronics America Inc. All rights reserved. CH0 CH1 CH2 CH3 CH4 CH5 Renesas Touch Solution 44 © 2012 Renesas Electronics America Inc. All rights reserved. 44 R8C/3xT-A Features CPU Core Program Flash up to 128KB 16-bit R8C CPU Core with built-in hardware multiplier Single-cycle memory access SRAM Memory up to 10KB Data Flash up to 4KB Touch T-SCU Up to 36 channels ~8 ms for scanning 36 channels Tuning dependent Memory ROM: up to 128KB SRAM: up to 10KB DTC T-SCU Touch Clock Generation Internal, External DMA POR, LVD System Event Link Controller ADC Power Supply 1.8V to 5.5V Clocks Hi-Speed and Low Speed OCO XCIN and XIN Interrupt Controller Debug Register Protect Safety Clock 10-bit, 20 ch Analog On-Chip Voltage Reference Package 80 pin LQFP (14x14) Low Speed Low Speed Mode Mode Power Management Wait Mode Wait Mode STOP Mode STOP SRAMMode On SRAM On 46 CRC 1 x I 2C 20 channels, 10-bit SPI, UART, I2C (SSU block), LIN Monitoring Single-Wire Analog Communication Program Code Protect © 2012 Renesas Electronics America Inc. All rights reserved. 1 x Timer 8-bit 3Timers x Timer 16-bit WDT 1 x SSU SPI Compatible Communication 3x UART 7, 8-bit 1 x LIN 1ch Renesas Touch Evaluation Kit Renesas Demo Kit for R8C/36T-A Full featured development platform Includes E1debugger HEW IDE environment and trial compiler Touch software source included Workbench tuning tool included 47 © 2012 Renesas Electronics America Inc. All rights reserved. Touch Application Notes Application notes Hardware Design Power Supplies Noise Tech Briefs Humidity Temperature Design Guides Tuning Guidelines Layout Recommendations Spring Usage 48 © 2012 Renesas Electronics America Inc. All rights reserved. 48 Advanced Tuning Tools Intuitive GUI Measurement Parameter Setting Circuit Modeling 49 © 2012 Renesas Electronics America Inc. All rights reserved. Questions? 50 © 2012 Renesas Electronics America Inc. All rights reserved. ‘Enabling The Smart Society’ Challenge: “Embedded designs are increasingly being incorporated in new, innovated interfaces. How can the engineer keep up with the increased demand for users desires for enhanced user interfaces.” Solution: “Let’s investigate one of those highly desired interfaces, capacitive touch!” Do you agree that we accomplished the above statement? 51 © 2012 Renesas Electronics America Inc. All rights reserved. Renesas Electronics America Inc. © 2012 Renesas Electronics America Inc. All rights reserved.