additional information for pic32 cvd and ctmu demos
TRANSCRIPT
Additional Information forPIC CVD and CTMU DemosAdditional Information for
PIC CVD and CTMU Demos
14 November 2011
Michael W. MannHPMD 32-Bit Application Engineer
Real-Time Debugging
� To assist in debugging button/slider behavior, Microchip has provided Profilab GUI project for use on your PC
� Profilab ™ is like LabView ™, but much cheaperhttp://www.abacom-online.de/uk/html/profilab-expert .html
21/20/2012
� Standalone Windows mTouch GUI.exe allows use of GUI without purchasing Profilab ™
� Profilab ™ projects can be customized to meet your debugging needs� Plot average voltage and button voltage� Model product front panel on a GUI tab
Additional Information
Typical Bench -Top Setup
REAL ICE Debugger
mTouchEvaluationUSB Cable
for board
31/20/2012Additional Information
PICKit Serial Analyzerinterface between PC and UART
Interface Cable
Sensor DaughterCard (8-Key)
RJ-11 to ICSP Adaptor
EvaluationBoardfor board
power
PKSA-EVB J2 Interface Cable
PKSA EVB PlugJumper Settings
Most PIC32 PIC18F
41/20/2012Additional Information
TX
Gnd
Rx
123456
2 14 36 58 710 912 1114 1316 1518 17
Footprint of J2 on EVB
PKSAPlug
EVB Plugto J2
1 x 6 x 0.1”
2 x 9 x 0.1”
2 14 36 58 710 912 1114 1316 1518 17
MostBoards
2 14 36 58 710 912 1114 1316 1518 17
PIC32 CTMU
2 14 36 58 710 912 1114 1316 1518 17
PIC18FCVD
Finding the .EXE GUI File
GUI .EXE
Standalone Project
51/20/2012Additional Information
GUI ProfiLab®Project
Microchip Application Library Project Directory
Setting Up GUI Com Parms
Click here to launchConfiguration Window
Click to Select COM Port
61/20/2012 6Additional Information
mTouch GUI Screen 1/3
Normalized Voltages for Buttons 1-4
71/20/2012Additional Information
For Matrix Keys Channels 1-3 are Columns 1-3
For Matrix Keys Channel 4 Zero’d Out
mTouch GUI Screen 2/3
Normalized Voltages for Buttons 5-8
81/20/2012Additional Information
For Matrix Keys Channels 5-8 are Rows1-4
mTouch GUI Screen 3/3
Prior Button Assert
91/20/2012Additional Information
Current Button Press Equivalent Slider Value
Slider value not available with Matrix Keys
Voltage Plot Screen Controls
Reset Min/Max for all Channels Maximum ADC Count
Save voltageplot datato ASCII file
Save allUART datato ASCII file
Record orStop Recording
Erase fileand startover
Quit data collectionand exit GUI
Delta = Max - Min
101/20/2012Additional Information
Stop Recording over
Configuring Voltage Plots
IncreasingChannel 1 Line Width
Right mouse click in plot
window
111/20/20121/20/2012
Line Width
Plot Controls
Record StopPrintPlot
SavePlot
Copy Plotto Clipboard
Delta Time between samples
Y Zoom +Zoom All
Plot Settings
121/20/20121/20/2012
Y Zoom -
X Zoom +
X Zoom -
Zoom All
Reset Zoom
Scroll Back in Time
Scroll Forward in Time
Profilab ™ = LabView ™ Lite
Parsing comma
delimited UART
text string
Plotting Button Voltages
Virtual Front
131/20/2012Additional Information
SavingButton
Voltagesto Text Files
Min/MaxDisplayedon Button
Voltage Plots
Front Panel on First GUI
TAB
Parsing Comma Delimited Data
Voltage Holds
Block decodes comma delimited UART string into status and voltages
Voltages
141/20/2012Additional Information
Holdsfor Plots
Voltages
Scale and Plot Channels
Virtual Front
PlotScale macro scales ADCcounts into normalized Voltage
151/20/2012Additional Information
Virtual Front Panel on First
GUI TAB
Min/MaxDisplayedon Button
Voltage Plots
Benchtop Setup for Differential with Pull-Ups Demo
161/20/2012Additional Information
Reference Signal on AN4
Channel 1 onButton Signal
100 Kohm Pull-up Resistors
PICKit Serial Analyzerinterface between PC and UART
Close -Up of Differential Setup using Pull-Ups
100 Kohm Pull-up Resistors
Channel 1 on
171/20/2012Additional Information
“Top” side of pull-ups on reference pin (AN4)
Reference Signal on AN4
Channel 1 on Button Signal
Example Differential with Pull-Ups ‘Scope Signals
VPOSITIVE
goes downVNEGATIVE goes up
Unasserted Asserted
Ref. Pin Voltage Button Signal
VNEGATIVEmeasurement
VPOSITIVEmeasurement
External pull-up charges button
181/20/2012Additional Information
goes up measurement
Timing of Diff’l w. Pull-Ups
0.79
use
cs
0.55
use
csInterrupts MaskedInterrupts Masked
Reference Pin Voltage
191/20/2012Additional Information
V+V--
Benchtop Setup for Single -Ended or Differential w/o Pull-Ups Demos
201/20/2012Additional Information
Reference Signal on AN4
Channel 1 on Button Signal
PICKit Serial Analyzerinterface between PC and UART
Example Differential w/o Pull-Ups ‘Scope Signals
VPOSITIVE goes down VNEGATIVE goes up
Unasserted AssertedReference Signal
Button Signal
V
Multiple charge dumps fromADC SAH cap to button cap
211/20/2012Additional Information
VPOSITIVE goes down VNEGATIVE goes up
VNEGATIVEmeasurement
VPOSITIVEmeasurement
Differential w/o Pull-Ups Timings
0.58
use
cs
1.00
use
cs Interrupts Masked
V+ V--
221/20/2012Additional Information
Benchtop Setup for CTMU Measurements
PICKit Serial Analyzer‘Scope probe on Button 8
REAL ICE for debugging
231/20/2012Additional Information
PICKit Serial Analyzerinterface between PC and UART
on Button 8
UART TXpin on J2
Example CTMU Measurements
Reference Signal *
VPOSITIVE
goes down
Unasserted Asserted
241/20/2012Additional Information
* Reference Signal: Interrupt masking, from asm(“di”) to asm(“ei”)
InterruptsMasked
(1.53 usecs)
ADC Capture2.57 usecs
Perf. Metric: Interrupt Masking Duration
� All these examples were taken usingthe Direct Key daughter card, but with different CVD/CTMU Evaluation Boards
� Each application tuned to provide equivalent cap touch performance
251/20/2012
equivalent cap touch performance
Additional Information
Technique Vpos Vneg Vtotal
Diff w/o Pull-Ups 0.58 1 1.58
Diff w Pull-ups 0.55 0.79 1.34
CTMU 1.53 n/a 1.53
Interrupt Masking Durations [usecs]
Interrupt Masking Duration Workarounds
� What if interrupts won’t accommodate these black out periods?� Don’t use asm(“di”) and asm(“ei”) to mask
interrupts, set CapTouchMeas flag instead of asm(“di”), clear flag instead of asm(“ei”)
261/20/2012
asm(“di”), clear flag instead of asm(“ei”)� ISRs set DumpMeasurement flag if ISR executes
when CapTouchMeas is set
� Timer ISR dumps/ignores cap touch measurement when DumpMeasurement is set, then clears the flag
Additional Information
PIC32MX2xx Starter Kit App
� CTMU Cap Touch on 4 -channel slider� Selects music� Selects music volume
� Three switchesI2S I/F to CODEC
271/20/2012
� I2S I/F to CODEC� PMP I/F to 220x172 pixel TFT display� SPI I/F to microSD music card� Playback of 44.1 Ksps .WAV files
Additional Information
PIC32MX2xx Starter Kit Board
MicroSD Memory CardCODEC
HeadphoneJack
Switch Prompts
220x172 TFT Display
PIC32MX220F032D
281/20/2012Additional Information
3 Switches
4 Channel Button/Slider
Slider Display
Button Prompts
PIC32MX2xx Starter Kit Display
Button Prompts
Button State: Asserted
291/20/2012Additional Information
Switch Prompts
Slider Display
Music Timing
Selecting Music 1/2
301/20/2012Additional Information
Button State: Pressed
Selecting Music 2/2
Press Switch 3to Execute Selection
Press Switch 3to Execute Selection
311/20/2012Additional Information
Button State: Asserted
Cap Touch Tricks 1/2� Leave interpretation of button/slider status to the main
application, only it knows context of the measureme nts!while(1){ // Update switches
Switch1St8 = UpdateSwitch( 1, CheckSwitch1(), (char *)0 );Switch2St8 = UpdateSwitch( 2, CheckSwitch2(), (char *)0 );Switch3St8 = UpdateSwitch( 3, CheckSwitch3(), (char *)0 );
// Update buttons/sliderif( ApplicationState != STARTUP &&
mTouchCapStatus_Check( &CurrentButtonStatus, &Curre ntButtonAsserts, &Temp ) ){
321/20/2012Additional Information
{mTouchUpdated = TRUE;
if ( IgnoreSlider != TRUE ){
SliderValue = Temp;UpdateSlider( SliderValue );
}if ( IgnoreButtons != TRUE ){
UpdateButton( 1,(CurrentButtonStatus >> 0)&0x1,(Curr entButtonAsserts >> 0)&0x1,(char *)0);UpdateButton( 2,(CurrentButtonStatus >> 1)&0x1,(Curr entButtonAsserts >> 1)&0x1,(char *)0);UpdateButton( 3,(CurrentButtonStatus >> 2)&0x1,(Curr entButtonAsserts >> 2)&0x1,(char *)0);UpdateButton( 4,(CurrentButtonStatus >> 3)&0x1,(Curr entButtonAsserts >> 3)&0x1,(char *)0);
}}//end if( mTouchCheckStatus...
switch( ApplicationState ){
Cap Touch Tricks 2/2
� Only update screen after completion of button scan to prevent crosstalk between PMP screen pins and butto n inputs
case FILE_PLAYING_SETUP:if ( mTouchUpdated == TRUE ) // Only update display when mTouch{ // has been updated and isn't running.
UpdateSwitch(3,-1, "Pause" );UpdateSwitch(2,-1, "Stop" );UpdateSwitch(1,-1, "GoBack");
331/20/2012Additional Information
IgnoreButtons = TRUE;IgnoreSlider = FALSE;mTouchCapStatus_Reset(128);UpdateSlider(128);ApplicationState = FILE_PLAYING;
}else // mTouch is still running don't do anything{
ApplicationState = FILE_PLAYING_SETUP;}break;
case FILE_PLAYING:PMADDRSET = 1<<10; // Turn on LEDWM8731Codec_MusicOn(TRUE); // Start playing