Download Touch… - Renesas e

Document related concepts

Electronic engineering wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Printed electronics wikipedia , lookup

Transcript
ID 434L: Incorporating a Capacitive Touch
Interface into Your Design
Renesas Electronics America Inc.
Jim Page
Senior Applications Engineer
12 & 13 October 2010
Version: 1.1
© 2010 Renesas Electronics America Inc. All rights reserved.
Jim Page
 Senior Applications Engineer
 Developed reference designs with Renesas Capacitive Touch Solution
 Applications Engineering Support for Renesas Capacitive Touch
 Author of Application notes on Renesas Capacitive Touch
 B.S. EET from Western Carolina University
 Go Catamounts!!
 Expert in Serial (I2C, SPI, others) and USB technologies
 Co-patent holder and developer of original Renesas Flash-Over-USB
technology
 Contributor to ‘USB Design by Example, 2nd ed.’ by John Hyde from
Intel Press
 Created platform code key to USB certification requirements and
silicon development
 Key support and development role for several successful projects
being used in-field today
2
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
ASIC, ASSP
& Memory
Advanced and
proven technologies
Solutions
for
Innovation
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
3
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Technology and Solution Portfolio
Microcontrollers
& Microprocessors
#1 Market share
worldwide *
Solutions
for
Innovation
ASIC, ASSP
& Memory
Advanced and
proven technologies
Analog and
Power Devices
#1 Market share
in low-voltage
MOSFET**
* MCU: 31% revenue
basis from Gartner
"Semiconductor
Applications Worldwide
Annual Market Share:
Database" 25
March 2010
** Power MOSFET: 17.1%
on unit basis from
Marketing Eye 2009
(17.1% on unit basis).
4
© 2010 Renesas Electronics America Inc.
All rights reserved.
Microcontroller and Microprocessor Line-up
Superscalar, MMU, Multimedia
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
High Performance CPU, Low Power
High Performance CPU, FPU, DSC
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB, Motor Control, TFT Display
 Legacy Cores
 Next-generation migration to RX
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
5
© 2010 Renesas Electronics America Inc.
All rights reserved.
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration
 Crypto engine, Hardware security
Microcontroller and Microprocessor Line-up
R8C
Superscalar, MMU, Multimedia
 Up to 1200 DMIPS, 45, 65 & 90nm process
 Video and audio processing on Linux
 Server, Industrial & Automotive
Capacitive
High Performance CPU, Low Power
Touch Solution
High Performance CPU, FPU, DSC
 Up to 500 DMIPS, 150 & 90nm process
 600uA/MHz, 1.5 uA standby
 Medical, Automotive & Industrial
 Up to 165 DMIPS, 90nm process
 500uA/MHz, 2.5 uA standby
 Ethernet, CAN, USB, Motor Control, TFT Display
 Legacy Cores
 Next-generation migration to RX
General Purpose
 Up to 10 DMIPS, 130nm process
 350 uA/MHz, 1uA standby
 Capacitive touch
6
© 2010 Renesas Electronics America Inc.
All rights reserved.
Ultra Low Power
Embedded Security
 Up to 25 DMIPS, 150nm process  Up to 25 DMIPS, 180, 90nm process
 190 uA/MHz, 0.3uA standby
 1mA/MHz, 100uA standby
 Application-specific integration
 Crypto engine, Hardware security
Switches…
7
7
© 2010 Renesas Electronics America Inc.
All rights reserved.
Switches…
8
8
© 2010 Renesas Electronics America Inc.
All rights reserved.
Switches…
9
9
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Capacitive Touch Innovation
Renesas provides you a complete hardware, software, and tool
solution for implementing capacitive touch technology into your
embedded designs.
10
10
© 2010 Renesas Electronics America Inc.
All rights reserved.
Course Agenda
 Touch Basics
 Touch Detection
 Creating a ‘Digital Touch’
 Renesas Hardware Overview
 Renesas Touch Solution
 Application View
 Renesas Software
 Available Tools
 Lab Overview
Lab Time!!
 Wrap-up and questions
11
11
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
12
12
© 2010 Renesas Electronics America Inc.
All rights reserved.
Capacitive Touch Detection Methods
Mutual Capacitance *
Power Consumption:
Medium/High
Emissions: Medium/High
Immunity: Medium/High



Self Capacitance *



Power Consumption:
Low
Emissions: Low
Immunity: Medium
* Attributes may vary depending on implementation
13
© 2010 Renesas Electronics America Inc.
All rights reserved.
© 2010 Renesas Electronics America Inc.
13
All rights reserved.
Touch Basics
 Simple Touch System
 Sensor
 Electrode pad
 Connecting traces
 Capacitive Component




14
Earth
Enclosure
PCB + Components
Overlay
14
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
 Make it simple…
 Lump them together
 Create combined ‘cap’
)
15
15
© 2010 Renesas Electronics America Inc.
All rights reserved.
Quick Question…
Q: Based on this self capacitance method, what are some ways
that you would measure the change in capacitance of that
sensor pad to detect a touch?
A: Create a simple RC charge circuit that will charge the
‘system’ to a known voltage and discharge it at accurate
rate.
The change in C will effect the discharge curve in a
measureable fashion.
16
© 2010 Renesas Electronics America Inc.
All rights reserved.
16
Touch Basics
 Simple RC Circuit
Comparison
Capacitor
Charge/Discharge
Resistor
Charge Capacitor
17
17
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
 Add control components
18
18
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
 Charge circuit…
19
19
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
 Charging Completed…
20
20
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Basics
 Discharge Circuit…
21
21
© 2010 Renesas Electronics America Inc.
All rights reserved.
Quick Question…
Q: Now that we’ve created this ‘RC’ charge/discharge circuit,
what happens to the curve when we touch the pad?
A: Touching the sensor pad causes an increase to the lumped
capacitance that is seen by the RC circuit.
This causes the RC waveform to change it’s charge/timing
characteristics in a measurable fashion.
22
© 2010 Renesas Electronics America Inc.
All rights reserved.
22
Touch Basics
 ‘Object’ Introduction
 Adds Capacitance
– Few pF
 Very Small
 mV of difference
23
23
© 2010 Renesas Electronics America Inc.
All rights reserved.
Quick Question…
Q: What might be an easy way to detect a touch measuring the
RC circuit
A: Sampling the voltage to some ‘threshold’ could allow us to
detect touch.
Let’s Check it out!!
24
© 2010 Renesas Electronics America Inc.
All rights reserved.
24
Touch…Analog to Digital
 Sampling
 Create ‘counts’ vs. ‘threshold’
25
25
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch…Analog to Digital
 ‘Counts’ vs. Time
26
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch…Analog to Digital
27
27
© 2010 Renesas Electronics America Inc.
All rights reserved.
The Sensor Control Unit (SCU)
28
28
© 2010 Renesas Electronics America Inc.
All rights reserved.
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?
29
29
© 2010 Renesas Electronics America Inc.
All rights reserved.
Why Develop Hardware? (continued)
 CPU used 100% in software solution
 CPU in R8C/3xT
 Fully stopped
 Or system functions
 Less than 15% CPU usage
CPU Active
(Touch Scanning)
Softwarebased
solution
CPU
CPU
R8C/3xT
Option A
R8C/3xT
Option B
30
CPU Active
(System Functions)
Not Operating
SCU
Scanning + Data Transfer
CPU
System Functions
SCU
Scanning + Data Transfer
CLK
…
© 2010 Renesas Electronics America Inc.
All rights reserved.
CPU Active
(Touch Post
Processing)
Less than
15% of
total CPU time
(20MHz)
SCU (Sensor Control Unit)
 SCU performs:
 Sequencing and timing of
the charge/discharge
 Key scanning
 High-frequency filtering
 Interrupt Generation
 Data Transfers
– DTC or DMA
SCU
 SCU Features
 18 channel sense
capability
 Single, scan, or selective
scan modes
 Additional noise filtering
 S/W or H/W scan kickoff
31
31
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Scan Sequence
SCU Data Transfer to RAM Buffer
SCSTRT
(Start bit)
SCU Operating
SCU Operating
Ch 0 Measure
Ch 1 Measure
Ch 2 Measure
SCU Interrupt
Touch SW Processing
SCU Operating
SCU DTC Ch 2
User Code
running
SCU DTC Ch 1
User Code
running
User Code
running
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
32
32
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Single Channel Operation
 SCU can scan single touch
channels
 Trigger interrupt on complete
start
Measure Ch 2
SCU Interrupt*
33
33
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Scan Operation
 SCU can scan multiple touch
channels
 Scan ascending or descending
order
Ascending
Descending
start
start
Measure Ch 0
Measure Ch 2
Measure Ch 1
Measure Ch 1
Measure Ch 2
Measure Ch 0
SCU Interrupt*
SCU Interrupt*
 SFR values set range of scan
 Trigger interrupt on complete
34
34
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Selective Scan Operation
 Selective channel scan capable
 All channels still scanned
start
 Channels selectively enabled
Measure Ch 0
 Trigger interrupt on complete
Measure Ch 1
Measure Ch 2
Measure Ch 3
- These channels are
tested but the analog
SW of these channels is
OFF
- measurement data is still
transferred to RAM but
this data is invalid
Measure Ch 4
SCU Interrupt*
35
35
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Hardware Noise Filtering
 Multiple ‘Pre’-Measurement Points
 SCU Generates each scan
 User selectable in software API
 2 Modes
 1st threshold crossing
 7th consecutive crossing
 Helps with hardware noise rejection
36
36
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Hardware Noise Filtering
 Multiple Measurement Types
 Random sample point(s)
 Software Selectable
 16 sequential points
 Moves ‘Count’ sample point
within window
 Helps with noise rejection
37
37
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Hardware Noise Filtering
 Multiple Measurement Types
 Majority vote
 Selectable ‘majority’
– 7 types
 Records ‘Count’ after
majority reached
38
38
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Hardware Noise Filtering
 Delay Timing Measurement
 Uses Random Pattern
– ~5nS Variation/sample
 Selectable random pattern
39
39
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Data Storage
 Primary and secondary
count data is transferred by
DTC to RAM Buffer
 Start address of buffer is
set in SCU Destination
Register
 Dedicated RAM
Example
• Scan channel 0-2 in ascending order
• SCU Destination Register = 0C00h
start
Measure Ch 0
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
SCU Interrupt
40
40
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Data Storage (Selective Scan)
 Primary and secondary
count data is transferred by
DTC to RAM Buffer
Example
• Scan channel 0-4 in ascending order
• Skip channel 1 and 3
• SCU Destination Register = 0C00h
start
 Start address of buffer is set
in SCU Destination Register
 Data is transferred even for
disabled channels, higher
level software should ignore
Measure Ch 0
Measure Ch 1
Measure Ch 2
Measure Ch 3
Measure Ch 4
SCU Interrupt*
41
0C00h
0C01h
0C02h
0C03h
0C04h
0C05h
0C06h
0C07h
0C08h
0C09h
0C0Ah
0C0Bh
0C0Ch
0C0Dh
0C0Eh
0C0Fh
0C10h
0C11h
0C12h
0C13h
CH0 dataA
CH0 dataD
CH1 dataA
CH1 dataD
CH2 dataA
CH2 dataD
CH3 dataA
CH3 dataD
CH4 dataA
CH4 dataD
41
© 2010 Renesas Electronics America Inc.
All rights reserved.
SCU Low Power Operation
 Core can be in “Wait” mode
 SCU trigger from Timer for sampling interval
 Power numbers TBD…
 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
42
42
© 2010 Renesas Electronics America Inc.
All rights reserved.
Low-power Example
Example using Timer as Trigger
SCU
SCU not operating
touch
detection
Touch Data
processing
normal process
Power
Consumption
SCU
SCU not operating
Touch Data
processing
Wait mode
Wait mode
touch
detection
Timer
trigger
Enable SCU
(via S/W)
Start trigger
(internal)
SCU DMA transfers touch data to RAM Buffer so
MCU does not wake up until DMA Interrupt occurs
43
43
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Touch Solution
44
44
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Touch Software
Application
Layer
Application Example
 Four Distinct Layers
 Renesas API covers:
 SCU Interface
 Sensor API
Functional
Implementation
Interface Layer
Functional Noise Rejection (Debounce, Wipedown)
Wheel
Decoder
Slider
Decoder
Switch
Function
Matrix
Decode
Auto
Calibration
 Matrix Decode
 Sample code available
 Wheel
Sensor Touch
Decision
(Binary)
Drift
Compensation
Reference and Threshold Firmware
 Slider
 Switch Types
Low Level Filter
Sensor API
Layer
 Auto Calibration
SCU Driver
45
© 2010 Renesas Electronics America Inc.
All rights reserved.
Hardware
Interface Layer
© 2010 Renesas Electronics America Inc.
45
All rights reserved.
Renesas Touch API
 Small
 ~2.2k ROM
 700 Bytes RAM
 Efficient
 < 15% CPU B/W
 Easy to Use
 API doc available
 Only 5 source files
 Source Code Free
46
46
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch API Features
 Integrated Averaging





Reduced supply effects
Environmental issues
Low frequency noise rejection
4x sample rate on low-level SCU data
Continual processing
 Additional Filtering
 FIR (4-tap)
47
47
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch API Features
 Drift Compensation
 Monitors continuously
 Reduces environmental effects
 Suspended if touched
48
48
© 2010 Renesas Electronics America Inc.
All rights reserved.
Workbench Tuning Tool
 Several Tools in One




Parameter Setup
Status Monitoring
Teaching Tool
Circuit Tuning Wizard
 Multiple Connection Methods
 Hew Target Server (HTS)
 Via E8a
 Serial
 No Software Modification needed
 Snoops API touch variables
 No overhead when not
connected
49
49
© 2010 Renesas Electronics America Inc.
All rights reserved.
Workbench Tuning Tool
50
50
© 2010 Renesas Electronics America Inc.
All rights reserved.
Workbench Tuning Tool
51
51
© 2010 Renesas Electronics America Inc.
All rights reserved.
Touch Application Notes
 Application notes




Hardware Design
Power Supplies
Layout
Noise
 Tech Briefs
 Humidity
 Temperature
 Design Guides
 Touch Benchmarks
52
52
© 2010 Renesas Electronics America Inc.
All rights reserved.
Capacitive Touch Lab Hardware

Renesas Demo Kit for R8C/33T






Full featured development platform
Includes E8a debugger
HEW IDE environment and trial
compiler
Touch software source included
Workbench tuning tool included
Processor Key Features:




53
Renesas Demo Kit for R8C/33T
R8C 16-bit CPU core
20 MHz Operation
Touch detector (SCU): 18-input
(shared with I/O ports)
Timers, Serial IO, ADC, others
53
© 2010 Renesas Electronics America Inc.
All rights reserved.
Lab Overview
54
54
© 2010 Renesas Electronics America Inc.
All rights reserved.
Lab Overview
 Takeaways




Overview of the Touch API
Explore a simple touch project
Connect to tuning tools
Experiment with touch settings
 Additional benefits
 HEW environment
 development tools
 debugger system
55
55
© 2010 Renesas Electronics America Inc.
All rights reserved.
Start the Lab
 Keep your dice turned to the section
of the lab you are on. (Instructions
are provided in the lab handout)
 Please refer to the Lab Handout and let’s get started!
56
© 2010 Renesas Electronics America Inc.
All rights reserved.
© 2010 Renesas Electronics America Inc.
56
All rights reserved.
Questions?
57
57
© 2010 Renesas Electronics America Inc.
All rights reserved.
Lab Questions
Question
• If Sensor_SetSCU_Scan(0x0000F) is enabled, what channels
are active when the a scan is kicked off?
Answer: Channels 0-3 are the only channels active.
Question
• If Nref is 398, Cthr is 52, and Ncount, when touched dips to
347, has a touch event occurred?
Answer: No, Ncount would need to dip below 346 for a touch to
be registered
Question
• What is the size of the variable used to return the binary
touch data to the calling function?
Answer: 32-bit variable
Question
• What is the connection method to Workbench using the E8a?
Answer: HEW Target Server
58
58
© 2010 Renesas Electronics America Inc.
All rights reserved.
Thank You!
59
© 2010 Renesas Electronics America Inc.
All rights reserved.
Renesas Electronics America Inc.