Additional Information for PIC32 CVD and CTMU Demos

33
Additional Information for PIC CVD and CTMU Demos PIC CVD and CTMU Demos 14 November 2011 Michael W. Mann HPMD 32-Bit Application Engineer

Transcript of Additional Information for PIC32 CVD and CTMU Demos

Page 1: Additional Information for PIC32 CVD and CTMU Demos

Additional Information forPIC CVD and CTMU DemosAdditional Information for

PIC CVD and CTMU Demos

14 November 2011

Michael W. MannHPMD 32-Bit Application Engineer

Page 2: Additional Information for PIC32 CVD and CTMU Demos

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

Page 3: Additional Information for PIC32 CVD and CTMU Demos

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

Page 4: Additional Information for PIC32 CVD and CTMU Demos

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

Page 5: Additional Information for PIC32 CVD and CTMU Demos

Finding the .EXE GUI File

GUI .EXE

Standalone Project

51/20/2012Additional Information

GUI ProfiLab®Project

Microchip Application Library Project Directory

Page 6: Additional Information for PIC32 CVD and CTMU Demos

Setting Up GUI Com Parms

Click here to launchConfiguration Window

Click to Select COM Port

61/20/2012 6Additional Information

Page 7: Additional Information for PIC32 CVD and CTMU Demos

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

Page 8: Additional Information for PIC32 CVD and CTMU Demos

mTouch GUI Screen 2/3

Normalized Voltages for Buttons 5-8

81/20/2012Additional Information

For Matrix Keys Channels 5-8 are Rows1-4

Page 9: Additional Information for PIC32 CVD and CTMU Demos

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

Page 10: Additional Information for PIC32 CVD and CTMU Demos

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

Page 11: Additional Information for PIC32 CVD and CTMU Demos

Configuring Voltage Plots

IncreasingChannel 1 Line Width

Right mouse click in plot

window

111/20/20121/20/2012

Line Width

Page 12: Additional Information for PIC32 CVD and CTMU Demos

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

Page 13: Additional Information for PIC32 CVD and CTMU Demos

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

Page 14: Additional Information for PIC32 CVD and CTMU Demos

Parsing Comma Delimited Data

Voltage Holds

Block decodes comma delimited UART string into status and voltages

Voltages

141/20/2012Additional Information

Holdsfor Plots

Voltages

Page 15: Additional Information for PIC32 CVD and CTMU Demos

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

Page 16: Additional Information for PIC32 CVD and CTMU Demos

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

Page 17: Additional Information for PIC32 CVD and CTMU Demos

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

Page 18: Additional Information for PIC32 CVD and CTMU Demos

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

Page 19: Additional Information for PIC32 CVD and CTMU Demos

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--

Page 20: Additional Information for PIC32 CVD and CTMU Demos

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

Page 21: Additional Information for PIC32 CVD and CTMU Demos

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

Page 22: Additional Information for PIC32 CVD and CTMU Demos

Differential w/o Pull-Ups Timings

0.58

use

cs

1.00

use

cs Interrupts Masked

V+ V--

221/20/2012Additional Information

Page 23: Additional Information for PIC32 CVD and CTMU Demos

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

Page 24: Additional Information for PIC32 CVD and CTMU Demos

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

Page 25: Additional Information for PIC32 CVD and CTMU Demos

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]

Page 26: Additional Information for PIC32 CVD and CTMU Demos

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

Page 27: Additional Information for PIC32 CVD and CTMU Demos

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

Page 28: Additional Information for PIC32 CVD and CTMU Demos

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

Page 29: Additional Information for PIC32 CVD and CTMU Demos

PIC32MX2xx Starter Kit Display

Button Prompts

Button State: Asserted

291/20/2012Additional Information

Switch Prompts

Slider Display

Music Timing

Page 30: Additional Information for PIC32 CVD and CTMU Demos

Selecting Music 1/2

301/20/2012Additional Information

Button State: Pressed

Page 31: Additional Information for PIC32 CVD and CTMU Demos

Selecting Music 2/2

Press Switch 3to Execute Selection

Press Switch 3to Execute Selection

311/20/2012Additional Information

Button State: Asserted

Page 32: Additional Information for PIC32 CVD and CTMU Demos

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 ){

Page 33: Additional Information for PIC32 CVD and CTMU Demos

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