Microchip PIC32CK1025SG01100 Handleiding

Microchip Niet gecategoriseerd PIC32CK1025SG01100

Lees hieronder de 📖 handleiding in het Nederlandse voor Microchip PIC32CK1025SG01100 (42 pagina's) in de categorie Niet gecategoriseerd. Deze handleiding was nuttig voor 11 personen en werd door 2 gebruikers gemiddeld met 4.5 sterren beoordeeld

Pagina 1/42
User's Guide
QTouch® Modular Library Peripheral Touch Controller
User's Guide
Description
The Microchip QTouch® Peripheral Touch Controller (PTC) offers built-in hardware for capacitive touch measurement
on sensors that function as buttons, sliders, and wheels. The PTC supports both mutual and self-capacitance
measurements without the need for any external component. It offers superb sensitivity and noise tolerance, as well
as self-calibration, and minimizes the sensitivity tuning effort by the user. It also extends the support for capacitive
touch surface and gesture functionality.
The PTC is intended for autonomously performing capacitive touch sensor measurements. The external capacitive
touch sensor is typically formed on a PCB, and the sensor electrodes are connected to the analog charge integrator
of the PTC using the device I/O pins. The PTC supports mutual capacitance sensors organized as capacitive touch
matrices in different X-Y configurations, including Indium Tin Oxide (ITO) sensor grids. In Mutual Capacitance mode,
the PTC requires one pin per X-line (driveline) and one pin per Y-line (sense line). In Self-Capacitance mode, the
PTC requires only one pin with a Y-line driver for each self-capacitance sensor.
Features
Implements Low-Power, High-Sensitivity, Environmentally Robust Capacitive Touch Buttons
Supports Mutual Capacitance and Self-Capacitance Sensing
Up to 46 Buttons in Self-Capacitance mode
Up to 529 Buttons in Mutual Capacitance mode
Supports Lumped Mode Configuration
One Pin Per Electrode
Load Compensating Charge Sensing
Parasitic Capacitance Compensation for Mutual Capacitance mode
Adjustable Gain for Superior Sensitivity
Zero Drift Over the Temperature and VDD Range
No Need for Temperature or VDD Compensation
Hardware Noise Filtering and Noise Signal De-Synchronization for High Conducted Immunity
Atmel Start QTouch Configurator Support – Wizard Guided Touch Project Creation
Product Support
For assistance related to QTouch capacitive touch sensing software libraries and related issues, contact your local
Microchip sales representative or visit https://www.microchip.com/support/.
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 1
Table of Contents
Description..................................................................................................................................................... 1
Features......................................................................................................................................................... 1
Product Support............................................................................................................................................. 1
1. Introduction............................................................................................................................................. 5
2. Capacitive Touch Measurement..............................................................................................................6
2.1. Self-Capacitance..........................................................................................................................6
2.2. Mutual Capacitance......................................................................................................................7
3. Touch Sensors...................................................................................................................................... 10
3.1. Buttons....................................................................................................................................... 10
3.2. Proximity Sensor........................................................................................................................ 10
3.3. Lumped Sensor..........................................................................................................................10
3.4. Interpolated Sensors.................................................................................................................. 11
3.5. 2D Position Sensors................................................................................................................... 11
3.6. Mix and Match............................................................................................................................ 11
4. PTC....................................................................................................................................................... 12
4.1. Overview.................................................................................................................................... 12
4.2. Self-Capacitance........................................................................................................................12
4.3. Mutual Capacitance....................................................................................................................12
5. QTouch® Modular Library......................................................................................................................14
5.1. Introduction.................................................................................................................................14
5.2. QTouch® Library Modules.......................................................................................................... 14
5.3. Module Naming Conventions..................................................................................................... 14
5.4. QTouch® Library Application Interface....................................................................................... 16
5.5. Application Flow......................................................................................................................... 17
5.6. MISRA Compliance.................................................................................................................... 17
6. Acquisition Module................................................................................................................................ 19
6.1. Overview.................................................................................................................................... 19
6.2. Interface..................................................................................................................................... 19
6.3. Functional Description................................................................................................................19
6.4. Configuration..............................................................................................................................20
7. Boost Mode........................................................................................................................................... 26
7.1. Introduction.................................................................................................................................26
7.2. Configuration..............................................................................................................................26
8. Frequency Hop Module.........................................................................................................................32
8.1. Overview.................................................................................................................................... 32
8.2. Interface..................................................................................................................................... 32
8.3. Functional Description................................................................................................................33
8.4. Configuration..............................................................................................................................33
User's Guide
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 2
9. Frequency Hop Auto-Tune Module....................................................................................................... 36
9.1. Overview.................................................................................................................................... 36
9.2. Interface..................................................................................................................................... 36
9.3. Functional Description................................................................................................................37
9.4. Configuration.............................................................................................................................. 38
10. Touch Key Module.................................................................................................................................40
10.1. Overview.................................................................................................................................... 40
10.2. Interface..................................................................................................................................... 40
10.3. Functional Description................................................................................................................41
10.4. Configuration.............................................................................................................................. 42
11. Scroller Module..................................................................................................................................... 45
11.1. Overview.................................................................................................................................... 45
11.2. Interface..................................................................................................................................... 45
11.3. Functional Description................................................................................................................46
11.4. Configuration.............................................................................................................................. 47
12. 2D Surface (One-Finger Touch) CS Module......................................................................................... 50
12.1. Overview.................................................................................................................................... 50
12.2. Interface..................................................................................................................................... 50
12.3. Functional Description................................................................................................................51
12.4. Operation....................................................................................................................................52
12.5. Configuration.............................................................................................................................. 52
13. 2D Surface (Two-Finger Touch) CS/2T Module.................................................................................... 55
13.1. Overview.................................................................................................................................... 55
13.2. Interface..................................................................................................................................... 56
13.3. Functional Description................................................................................................................57
13.4. Operation....................................................................................................................................58
13.5. Configuration.............................................................................................................................. 58
14. Gestures Module...................................................................................................................................61
14.1. Overview.................................................................................................................................... 61
14.2. Interfaces to Module...................................................................................................................62
14.3. Configuration.............................................................................................................................. 62
15. Binding Layer Module........................................................................................................................... 65
15.1. Overview.................................................................................................................................... 65
15.2. Interface..................................................................................................................................... 65
15.3. Functional Description................................................................................................................66
15.4. Configuration.............................................................................................................................. 68
16. Building Applications Using Atmel START............................................................................................ 70
17. Using Data Visualizer with QTouch® Applications.................................................................................71
17.1. Overview.................................................................................................................................... 71
17.2. Datastreamer Module.................................................................................................................71
17.3. Debugging Using Data Visualizer...............................................................................................72
17.4. Debugging Using 2D Touch Surface Utility................................................................................ 76
User's Guide
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 3
18. Tuning Procedure..................................................................................................................................77
18.1. Tuning for Noise Performance....................................................................................................77
18.2. Tuning the Slider/Wheel Sensor.................................................................................................82
19. Known Issues........................................................................................................................................85
20. Appendix A - Revision History...............................................................................................................86
21. Appendix B - Acquisition Module API Reference.................................................................................. 87
22. Appendix C - Frequency Hop Module API Reference...........................................................................89
23. Appendix D - Frequency Hop Auto-tune Module API Reference.......................................................... 90
24. Appendix E - Touch Key Module API Reference...................................................................................91
25. Appendix F - Scroller Module API Reference....................................................................................... 92
26. Appendix G - 2D Surface (One-Finger Touch) CS Module................................................................... 93
27. Appendix H - 2D Surface (Two-Finger Touch) CS/2T Module.............................................................. 94
28. Appendix I - Gestures Module...............................................................................................................95
29. Appendix J - Binding Layer Module API Reference.............................................................................. 96
30. Appendix K - Device Support................................................................................................................ 97
The Microchip Website.................................................................................................................................98
Product Change Notification Service............................................................................................................98
Customer Support........................................................................................................................................ 98
Microchip Devices Code Protection Feature................................................................................................ 98
Legal Notice................................................................................................................................................. 98
Trademarks.................................................................................................................................................. 99
Quality Management System....................................................................................................................... 99
Worldwide Sales and Service.....................................................................................................................100
User's Guide
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 4
1. Introduction
The QTouch® Modular Library (QTML) provides the touch-sensing functionality of a QTouch Library under a modular
architecture. By dividing the library into functional units, an application developer can include only those modules
which provide functionality relevant to the target application, thereby saving both device memory and processing
time.
User's Guide
Introduction
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 5
2. Capacitive Touch Measurement
The QTouch Modular Library supports PTC measurement of self-capacitance and mutual capacitance touch sensors
on a selection of AVR®, Arm® Cortex-M0+, Arm Cortex-M23, and Arm Cortex-M4 microcontrollers.
In all current capacitive touch measurement methods, one of two basic functional approaches is implemented: Self-
capacitance or mutual capacitance.
2.1 Self-Capacitance
Self-capacitance refers to a capacitive measurement using a single sensor electrode to measure the apparent
capacitance between the electrode and the DC ground of the touch sensor MCU circuit.
At power-on or Reset, a baseline measurement of the capacitance is recorded and assumed to be the ‘Out Of Touch’
capacitance. Reference capacitance is the combination of Cp in parallel to the series pair Cg and Cx.
When a touch contact is applied, the capacitance is increased by the introduction of a parallel path to earth, via the
series combination of Ct and Ch. The increase is compared to the touch threshold, and if exceeded, the sensor is
indicated to be ‘In Touch’.
Note:  Cx, the human body capacitance, varies by person and surroundings and is typically in the order of 100 pF to
200 pF. The touch contact Ct, however, is more consistent and much smaller at typically 1 pF to 5 pF, depending
primarily on the design and construction of the touch sensor and secondly on the size of the finger used to activate
the sensor.
As the dominant component in a pair of series capacitors is the smaller one, in this case, Ct, a well-designed and
tuned sensor shows very consistent sensitivity to touch contact with little dependence on the user.
User's Guide
Capacitive Touch Measurement
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 6
2.2 Mutual Capacitance
Mutual capacitance refers to a capacitive measurement using a pair of sensor electrodes to measure the apparent
capacitance between them. Typically, one electrode acts as the Driver (X), while the other is the receiver (Y). Each
physical location where an X electrode transfers charge to a Y electrode is a sensor node, and this is the location of
touch sensitivity.
User's Guide
Capacitive Touch Measurement
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 7
As with self-capacitance, a baseline measurement of the capacitance is recorded and assumed to be the ‘Out Of
Touch capacitance. Reference capacitance is the apparent capacitance between the X electrode and the Y
electrode. Unlike self-capacitance, the reference capacitance does not depend on an earth return.
Interaction between a mutual capacitance sensor and the human body is more complex. It may be modeled by
considering two separate touch contacts to the X and Y electrodes, where each is capacitively coupled to the body,
resistively connected to each other inside the body and capacitively coupled to earth via the human body
capacitance.
A touch contact has two competing effects:
The introduction of a conductive plate (finger) to both X and Y electrodes increases the capacitance between X
and Y. This occurs if any conductive part is placed over the sensor.
The addition of another capacitance (Ch + Cg) at the XY node provides an alternative path for the energy
emitted by the X electrode, reducing the amount of charge accumulated on the sensor. This effect is manifested
as an apparent reduction in the XY capacitance and occurs only if the body of material connected to the
conductive part has a significant self-capacitance.
When a real touch contact is placed, the second (reducing) effect is much greater than the first (increasing) effect,
and so a touch contact on a mutual capacitance sensor is indicated by an apparent reduction in sensor capacitance.
This apparent change in capacitance (delta) is compared to the configured touch threshold, and if it exceeds the
threshold, then the sensor is deemed to be in detect.
User's Guide
Capacitive Touch Measurement
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 8
User's Guide
Capacitive Touch Measurement
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 9
3. Touch Sensors
Capacitive sensors may be implemented to simply detect contact as a button replacement, or functionally extended
to provide a relative measurement of distance (proximity), 1D position (slider or wheel), 2D position (QTouch
Surface), or 3D position (QTouch Surface with proximity).
In each case, the modular library detects a touch contact by a change in capacitance exceeding a pre-configured
threshold. Once a contact has been confirmed, the various post-processing modules use the calculated touch delta to
interpolate amongst neighboring sensors and calculate the location of the touch position or relative proximity.
3.1 Buttons
The simplest implementation of a capacitive sensor is a button, where the sensor consists of a single node (one
electrode for self-capacitance, one pair of electrodes for mutual capacitance) and is interpreted as a binary state; In
Detect or Out of Detect.
3.2 Proximity Sensor
An extension of the button is a proximity sensor. A single sensor node is monitored for a change in capacitance
exceeding a pre-configured threshold. In the same way as the button, the sensor is considered to be when‘In Detect’
that threshold is exceeded. Once in detect, a relative measurement of the contact distance is made by scaling the
touch delta between two thresholds - the initial threshold and a second threshold.‘Detect’ ‘Full Contact
Note:  As the proximity sensor relies on the capacitive load of a distant object, the ‘apparent distance’ to the contact
will depend on the shape and size of the contact.
I.e., an open hand in proximity at 10 cm will ‘appear’ closer than an extended finger at 10 cm, as it has a larger
influence on capacitance due to a larger surface area at the same distance.
Capacitance (C) is proportional to Area (A) and inversely proportional to distance (d). Also, the grounding has a
significant impact on sensitivity, and so does the range.
 
3.3 Lumped Sensor
A Lumped sensor is implemented as a combination of multiple sense lines (self-capacitance measurement) or
multiple drive and sense lines (mutual capacitance measurement) to act as one single sensor. This provides the
application developer with greater flexibility in the touch sensor implementation.
Improve the touch sensor responsiveness by reducing the number of measurements and therefore, the time
required for initial touch detection
Fast position resolution by binary search
Improved moisture rejection through ‘All but one’ key lumping in a touch button application
Provide wake-on-touch functionality on any key (up to maximum capacitance limits) with significantly lower
power consumption as only one sensor measurement is required for all keys
Dual-purpose sensor electrodes – e.g., individual keys may be lumped together to form a proximity sensor
Touch detection on a lumped sensor is implemented in the same way as a single node touch button. The capacitance
of the lump sensor is equal to or more than the sum of the individual sensors’ capacitance. Lumping too many sensor
may result in saturation. In general, the capacitance of the self-capacitance sensor is higher than the mutual
capacitance sensor. The number of sensor electrodes that can be lumped is relatively less for self-capacitance
designs.
User's Guide
Touch Sensors
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 10
3.4 Interpolated Sensors
An interpolated sensor utilizes the touch delta of two or more adjacent sensor nodes arranged in a row to calculate
the position of a touch contact along that row. The sensor layout is designed and the threshold configured in such a
way that a contact anywhere along the sensor will cause:
1. The node with the strongest touchA touch delta exceeding the threshold on at least one sensor node.
delta is determined to be the center node of the touch contact and identified the approximate location of the
touch contact.
2. The relativeSome touch delta on neighboring nodes, used for position interpolation between nodes.
delta on the nodes to the left and right of the center node are used to adjust the calculated touch position
towards the side with the strongest delta.
An interpolated sensor may be formed into any physical shape, with or without a wrap-around from the last sensor to
the first. A sensor with wrap-around is configured as a , while one without is configured as a . In the‘Wheel’ ‘Slider
case of the wheel, a touch contact centered on the 1
st key uses the last key for interpolation and vice versa while‘left’
the slider option implements a dead band at the ends.
3.5 2D Position Sensors
Where a linear sensor is physically implemented as a line of keys, the same approach may be extended to 2D
position detection through a grid of keys. The keys are designed such that interpolation may be made in either the
vertical or horizontal direction, and two separate touch contacts may be individually resolved in their interpolated
positions.
3.6 Mix and Match
The QTouch Modular Library allows an unprecedented degree of combinations implementing different sensor types
and measurement technology, in many cases utilizing the same sensor electrodes in multiple ways and within the
same firmware application.
For example, a 2D position sensor using mutual capacitance key sensors may be lumped or partially lumped in
Mutual Capacitance mode to provide proximity measurements and the Y lines individually measured in Self-
Capacitance mode to improve moisture immunity.
User's Guide
Touch Sensors
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 11
4. PTC
4.1 Overview
The Microchip QTouch® Peripheral Touch Controller (PTC) offers built-in hardware for capacitive touch measurement
on sensors that function as buttons, sliders, and wheels. The PTC supports both mutual and self-capacitance
measurements without the need for any external components. It offers superb sensitivity and noise tolerance, as well
as self-calibration, and minimizes the sensitivity tuning effort by the user.
The PTC is intended for autonomously performing capacitive touch sensor measurements. The external capacitive
touch sensor is typically formed on a PCB, and the sensor electrodes are connected to the analog charge integrator
of the PTC using the device I/O pins. The PTC supports mutual capacitance sensors organized as capacitive touch
matrices in different X-Y configurations, including Indium Tin Oxide (ITO) sensor grids.
4.2 Self-Capacitance
In Self-Capacitance mode, the PTC requires only one pin with a Y-line driver for each self-capacitance sensor.
Figure 4-1. Self-Capacitance PTC Measurement
4.3 Mutual Capacitance
In Mutual Capacitance mode, the PTC requires one pin per X-line (driveline) and one pin per Y-line (sense line).
User's Guide
PTC
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 12
Figure 4-2. Mutual Capacitance PTC Measurement
User's Guide
PTC
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 13
5. QTouch® Modular Library
5.1 Introduction
The QTouch Modular Library provides the touch-sensing functionality of a QTouch Library under the redesigned
modular architecture. By dividing the library into functional units, it is possible for an application developer to include
only those modules which provide functionality relevant to the target application, thereby saving both device memory
and processing time.
5.2 QTouch® Library Modules
QTouch Library modules can be classified into three types based on the functionality, as shown below.
5.3 Module Naming Conventions
The naming conventions followed on the QTouch Library modules are given below.
qtm _ <module_name_identifier> _ <device_architecture> _ <module_ID> .
<file extension>
qtm / libqtm
An acronym that indicates QTouch module. All QTouch modules begin with qtm_
for easy identification.
For GCC modules, “ ” is prepended to the module name, thus it would belib
“ ”.libqtm
User's Guide
QTouch® Modular Library
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 14
module_name_identifier
acq – acquisition module with auto-tune
acq_runtime acquisition module without auto-tune code
freq_hop – frequency hop module
freq_hop_auto_tune frequency hop with auto-tune module
device_architecture
cm0p – for all Cortex M0+ post processing modules
cm4 – for all Cortex M4F post processing modules
samd1x – SAM D10/D11 acquisition modules only
t81x – all modules of AVR ATtiny817 device families
t161x - all modules of AVR ATtiny1617 device families
t321x - all modules of AVR ATtiny3217 device families
m328pb - all modules of AVR ATmega328PB device
m324pb- all modules of AVR ATmega324PB device
saml21 - SAM L21 acquisition module only
saml22 - SAM L22 acquisition module only
samc21 - SAM C21 acquisition module only
samc20 - SAM C20 acquisition module only
samd21 - SAM D21 acquisition module only
samda1 - SAM DA1 acquisition module only
samha1 - SAM HA1 acquisition module only
samd20 - SAM D20 acquisition module only
saml10 - SAM L10 acquisition module only
saml11 - SAM L11 acquisition module only
cm23 – for all Cortex M23 post processing modules
module_id Unique 16-bit identifier for each module
file_extension .a – GCC modules of AVR® and Arm® devices, IAR modules of Arm devices
.r90 – IAR modules of all AVR modules
User's Guide
QTouch® Modular Library
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 15
See examples below:
Table 5-1. Acquisition Module of AVR® ATmega328PB Device
GCC module libqtm_acq_m328pb_0x0001.a
IAR module qtm_acq_m328pb_0x0001.r90
Touch Keys Processing Module of SAM D2x, SAM DA1, SAM HA1, SAM D1x, SAM L2x, SAM C2x Devices
GCC module libqtm_touch_key_cm0p_0x0002.a
IAR module qtm_touch_key_cm0p_0x0002.a
Touch Keys Processing Module of SAM L1x Devices
GCC module libqtm_touch_key_cm23_0x0002.a
IAR module qtm_touch_key_cm23_0x0002.a
5.4 QTouch® Library Application Interface
In addition to library modules, the various components that are required to build the complete touch application are
given below.
1. Module API files.
2. and files.Touch.c Touch.h
3. .Common_components_api.h
4. .Touch_api_ptc.h
5. Module reburst flag.
6. Binding layer module.
5.4.1 Module API files
The API for each module is defined in its associated header file. Dependencies between modules are minimized and
implemented at the application level. This allows for easy porting of application code from one device to another –
only the hardware-dependent module configurations must be adjusted. The acquisition auto-tune and acquisition
manual tune modules have the same API file. All the other modules have their API file that needs to be linked to the
user application.
5.4.2 and filesTouch.c Touch.h
User options for each module are configured in application code, typically and , and shared withtouch.h touch.c
the library module by pointer reference. Similarly, arrays are created in application code for modules’ run-time data
and provided to the module via a pointer.
Configurations may be modified on-the-fly by application code in between measurement sweeps of the touch
sensors. All run-time data is available to the application code.
5.4.3 Common_components_api.h
The application requires structures and definitions common to all modules. The common definitions, macros, and the
data structures are placed in the file .“ ”qtm_common_components_api.h
5.4.4 Touch_api_ptc.h
This file contains all the module API files included in the content, and thus this single file is sufficient to be included
on the application source files wherever necessary.
User's Guide
QTouch® Modular Library
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 16
5.4.5 Module Reburst Flag
Module configuration and functionality are unique to each module, but any module may require a repeated
measurement of specific sensors. To achieve this, a signal conditioning module may temporarily change the
acquisition configuration, e.g., to disable those sensors not requiring reburst.
This is indicated to the application by the implementation of a common byte at the first location of the signal‘Status’
conditioning group data structure. A in bit 7 indicates that the application should re-start measurement on the1
sensor group without waiting for the measurement cycle time-out.
Figure 5-1. uint8_t qtm_xxx_status
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Re-burst
5.4.6 Binding Layer Module
The binding layer module provides an easy interface of QTouch modules to the user application. The binding layer
binds all the configured modules in the appropriate sequence using minimal API functions. It takes care of the
initialization of modules, synchronizes the calling procedures, and handles the error statuses.
5.5 Application Flow
5.6 MISRA Compliance
QTouch Library modules source code is compliant with the rule set of MISRA 2004, with the following‘Required’
exceptions:
User's Guide
QTouch® Modular Library
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 17
Table 5-2. AVR® MCU Acquisition Modules and Exceptions
Acquisition Modules of ATmega32xPB, ATtiny81x, ATtiny161x, ATtiny321x Devices
MISRA Rule Definition Remarks
1.1
All code shall conform to ISO 9899:1990 Programming
languages – C, amended and corrected by ISO/IEC
9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and
ISO/IEC 9899/COR2:1996
The compiler is configured to allow
extensions
8.5 There shall be no definitions of objects or functions in
a header file Inline functions are used in the header files
17.4 Array indexing shall be the only allowed form of
pointer arithmetic
The pointer of module data structures is
passed as a parameter and individual object
data are fetched by iterating the data
structure as an array index
Table 5-3. AVR® Postprocessing Modules and Exceptions
Touch_key, Binding Layer, Frequency Hop Auto Tune, Frequency Hop, Scroller, 2D Touch Surface and
Gesture
MISRA Rule Definition Remarks
17.4 Array indexing shall be the only allowed
form of pointer arithmetic
The pointer of module data structures is passed as a
parameter and individual object data are fetched by
iterating the data structure as an array index
Table 5-4. Arm® Acquisition Modules and Postprocessing Modules
Modules
MISRA Rule Definition Remarks
1.1
All code shall conform to ISO 9899:1990
Programming languages – C, amended and corrected
by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/
AMD1:1995, and ISO/IEC 9899/COR2:1996
The compiler is configured to allow
extensions
17.4 Array indexing shall be the only allowed form of
pointer arithmetic
The pointer of module data structures is
passed as a parameter and individual object
data are fetched by iterating the data
structure as an array index
User's Guide
QTouch® Modular Library
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 18
6. Acquisition Module
6.1 Overview
The minimum requirement for a touch sensor application is an acquisition module, which implements all hardware-
dependent operations for configuration and measurement of capacitive touch or proximity sensors.
6.2 Interface
The data structure definitions and the API declarations are included in the API file
”. The data structure covers all the configurations and output dataqtm_acq_<device_id>_<module_id>_api.h
variables. This file should be included on the common API ’ file.touch_ptc_api.h
User
Application
Touch.h
Macros and
constants
Qtm_acq_<device_i
d>_<Module_id>_a
pi.h
Touch_api_ptc
.h
Acquisition
Module
common_
components_api.h
Touch.c
Global variables declaration
and initialization, Helper API
functions
6.3 Functional Description
Acquisition modules are target specific, each having a hardware configuration structure depending on the touch
sensing technology and method applied.
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 19
Features Implemented in this Acquisition Module
Hardware Calibration for Sensor Nodes
Calibration of Prescaler/Resistor/Charge share delay to compensate for a time constant of sensor
electrodes
Calibration of internal compensation circuit to match sensor load
Self-Capacitance and Mutual Capacitance Sensor Touch Measurement with Normal Sequencing
Low-Power Mode of Automated Scanning Using Event System (Currently not Supported on Atmel Start
Configurator)
6.4 Configuration
6.4.1 Data Structures
The acquisition module implements all functionality required for making relative measurements of sensor
capacitance. This is the only module uniquely built for an individual device, as it must access and control the pins
used for touch sensor implementation.
As devices have different hardware features available, different configuration options are available on each device.
For the most efficient use of system resources – ROM and RAM – different sensor configuration structures are
required.
However, where the same variable name is used within the structure, the functionality controlled by that variable is
identical. Any dependent function should utilize a reference to the variable, and NOT rely on a reference to the
structure and pointer arithmetic.
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 20
Acquisition Group Configuration
A reference by a pointer to ’ will always point to the correct&ptc_qtlib_acq_gen1.freq_option_select
memory location, regardless of the device. However, any implementation based on pointer arithmetic will require re-
factoring if code is to be re-used from one device for another.
Parameter Size Range/Options Usage
num_sensor_nodes 16-bit 0 to 65535 The number of sensor nodes configured in the group
acq_sensor_type 8-bit
NODE_SELFCAP
NODE_MUTUAL
Defines the measurement method applied to this group of
nodes
calib_option_select 1 byte
Bits 3:0
Calibration type:
CAL_AUTO_TUNE_NONE
CAL_AUTO_TUNE_RSEL
CAL_AUTO_TUNE_PRSC
CAL_AUTO_TUNE_CSD*
The calibration type selects which parameter should be
automatically tuned for optimal charge transfer
Bits 7:4
Calibration target:
CAL_CHRG_2TAU
CAL_CHRG_3TAU
CAL_CHRG_4TAU
CAL_CHRG_5TAU
The calibration target applies a limit to the charge transfer
loss allowed, where a higher setting of a target ensures a
greater proportion of full charge is transferred
freq_option_select 1 byte FREQ_SEL_0 FREQ_SEL_15 to
Or FREQ_SEL_SPREAD
FREQ_SEL_0 FREQ_SEL_15 to inserts a delay cycle
between measurements during oversampling, where 0 is
the shortest delay, 15 the longest.
FREQ_SEL_SPREAD varies this delay from 0 to 15 in a
sawtooth manner during the oversampling set.
PTC_interrupt_priority** 1 byte 1 to 3 Interrupt priority level for the PTC
Note:  * - Not available on all devices.
** - Applicable for Arm® Cortex devices only.
Node Configuration
Similarly, node configuration structures vary depending on which device is used.
Number of X lines
Number of Y lines
Feature availability
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 21
Parameter Size Range/Options Usage
node_xmask 1/2/4/8 bytes (Bit field)
Set the bit(s) at location(s)
corresponding to X line
number(s).
Example:
X0 only = = 0x010b00000001
X0 and X2 = =0b00000101
0x05
1 byte is used for devices with
up to 8 “X” lines.
2 bytes, 4 bytes, 8 bytes are
used for devices up to 16, 32
and 46* “X” lines, respectively.
Note: 
*Can support up to 64 X lines.
node_ymask 1/2/4/8 bytes (Bit field)
Set the bit(s) at location(s)
corresponding to Y line
number(s).
Example:
Y5 only = = 0x200b00100000
Y1, Y2 and Y7 = 0b10000110
= 0x86
1 byte is used for devices with
up to 8 “Y” lines
2 bytes, 4 bytes, 8 bytes are
used for devices up to 16, 32,
and 46 “Y” lines, respectively.*
Note: 
*Can support up to 64 Y lines.
node_csd*1 byte 0 to 255
The number of delay cycles to
ensure charging of sensor node
capacitances.
(Applicable for AVR® ATtiny,
ATmega, Arm® SAM E54,
SAMCx, SAM L22 family only.)
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 22
...........continued
Parameter Size Range/Options Usage
node_rsel_prsc 1 byte
Bits 7:4 = RSEL
RSEL_VAL_0
RSEL_VAL_3*
RSEL_VAL_6*
RSEL_VAL_20
RSEL_VAL_50
RSEL_VAL_70*
RSEL_VAL_75*
RSEL_VAL_80*
RSEL_VAL_100
RSEL_VAL_120*
RSEL_VAL_200*
Internal Y line series resistor
selection.
* May not be available for all
devices.
SAM E5x, SAM D5x: 3 kΩ, 6
kΩ, 75 kΩ, 200 kΩ
SAM L22: 75 kΩ, 200 kΩ
AVR-DA: 70 kΩ, 80 kΩ, 120 kΩ,
200
Bits 3:0 = PRSC
PRSC_DIV_SEL_1
PRSC_DIV_SEL_2
PRSC_DIV_SEL_4
PRSC_DIV_SEL_6*
PRSC_DIV_SEL_8
PRSC_DIV_SEL_12*
PRSC_DIV_SEL_14*
PRSC_DIV_SEL_16*
PRSC_DIV_SEL_32*
PRSC_DIV_SEL_64 *
PRSC_DIV_SEL_128*
Clock Prescaler
The acquisition clock is derived
and scaled from CPU clock for
AVR® devices.
*May not be available for all
devices.
SAM E5x, SAM D5x, ATtiny: 16
kΩ, 32 kΩ, 64 kΩ, 128 kΩ
AVR-DA: 6, 12, 14 **
**The numbers correspond to
the prescaler value.
node_gain 1 byte
Bits 7:4 = Analog Gain
GAIN_1
GAIN_2
GAIN_4
GAIN_8
GAIN_16
Analog Gain Setting
Integration capacitor adjusted
to control integrator gain.
Bits 3:0 = Digital Gain
GAIN_1
GAIN_2
GAIN_4
GAIN_8
GAIN_16
Digital Gain Setting
The accumulated sum is scaled
to digital gain.
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 23
Table 6-1. node_acq_status
Bit 7 6 5 4 3 2 1 0
Node
Calibration
Error
Rise time
calibration
complete
- Node State Calibrate
request Enabled
NODE_MEASURE 0
NODE_CC_CAL 1
NODE_PRSC_CAL 2
NODE_RSEL_CAL 3
NODE_CSD_CAL* 4
Note:  * - CSD calibration is not available on SAM D10/D11, SAM D2x, SAM L21 devices.
Acquisition Library State
Table 6-2. touch_lib_state_t
TOUCH_STATE_NULL 0
TOUCH_STATE_INIT 1
TOUCH_STATE_READY 2
TOUCH_STATE_CALIBRATE 3
TOUCH_STATE_BUSY 4
Return Parameter
Table 6-3.  Common Return Type, Used by All QTML Modulestouch_ret_t
TOUCH_SUCCESS 0
TOUCH_ACQ_INCOMPLETE 1
TOUCH_INVALID_INPUT_PARAM 2
TOUCH_INVALID_LIB_STATE 3
TOUCH_INVALID_POINTER 11
TOUCH_LIB_NODE_CAL_ERROR 14
Note:  Other values are reserved for future use.
User's Guide
Acquisition Module
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 25
7. Boost Mode
7.1 Introduction
The PTC, on selected devices, includes a feature to acquire four channels simultaneously in Mutual Capacitance
mode. To resolve each channel’s node measurement, a minimum of four simultaneous measurements are required.
This has the effect of combining both analog and digital oversampling with the net effect of an overall improvement in
SNR or a reduction in response time.
Figure 7-1. Parallel X Drive
PTC
X Drive
ADC
C0C1C2C3
X0
X1
X2
X3
Y
By using Boost mode, one of the following benefits can be achieved:
Since a given node is measured four times, SNR improves by two times (square root of oversample times). In a
noisy system, SNR is improved by two times without compromising on response time.
The response time can be reduced to one quarter by reducing the analog oversamples to 1/4th to retain the
same SNR. Example: By enabling the Boost mode, the filter level can be reduced from 32 to 8 without
compromising on SNR.
Supported devices:
SAM L1x
• ATtiny81x
• ATtiny161x
• ATtiny321x
• AVR-DA
7.2 Configuration
Sensor nodes are arranged for Boost mode in groups of 4X 1Y, depending on the application requirements. This
module supports only mutual capacitance 4P measurements.
User's Guide
Boost Mode
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 26
7.2.1 Sensor Node Group
qtm_acquisition_control_t
A top-level container for an acquisition group
Contains pointers to group and node memory containing configurations and run-time data
Structure Contents
qtm_acquisition_control_t qtm_acq_node_group_config_t
(*qtm_acq_node_group_config);
qtm_acq_4p_saml10_config_t
(*qtm_acq_node_config);
qtm_acq_node_data_t (*qtm_acq_node_data);
qtm_acq_node_group_config_t
Common parameters, applied to all sensor nodes in the group
Parameter Size Range/Options Usage
num_sensor_nodes 16-bit 4 to 65532 The total number of sensor nodes
configured in the group, for example,
a number of 4P sets X4.
acq_sensor_type 8-bit NODE_MUTUAL_4P Parallel sets of 4 mutual capacitance
sensor nodes. Each set contains 4x
PTC X masks and 1x PTC Y masks
for the measurement of XY
capacitance.
calib_option_select 1 byte Bits 3:0 Calibration type Selects which parameter is auto-
tuned for charge transfer.
CAL_AUTO_TUNE_NONE No auto-tune for charge transfer
CAL_AUTO_TUNE_RSEL Series resistor tuned to the largest
value that allows full charge transfer
CAL_AUTO_TUNE_PRSC Prescaler tuned to the lowest
(fastest) value that allows full charge
transfer
CAL_AUTO_TUNE_CSD Charge share delay tuned to the
lowest value that allows full charge
transfer
Bits 7:4 Calibration target Target charge time for sensor
capacitance.
CAL_CHRG_2TAU Sensor charged for 2 x Time
constant
CAL_CHRG_3TAU Sensor charged for 3 x Time
constant
CAL_CHRG_4TAU Sensor charged for 4 x Time
constant
CAL_CHRG_5TAU Sensor charged for 5 x Time
constant
User's Guide
Boost Mode
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 27
...........continued
Parameter Size Range/Options Usage
freq_option_select 1 byte FREQ_SEL_0
to
FREQ_SEL_15
FREQ_SEL_0 FREQ_SEL_15 to
inserts a delay cycle between
measurements during oversampling,
where 0 is the shortest delay, 15 the
longest
FREQ_SEL_SPREAD FREQ_SEL_SPREAD varies this delay
from 0 to 15 in a sawtooth manner
during the oversampling set
ptc_interrupt_priority 1 byte 1 to 3 Arm® NVIC Interrupt priority
qtm_acq_saml10_node_config_t
Note:  This data structure is the specific configuration for SAM L10 PTC hardware.
Parameter Size Range/Options Usage
node_xmask[4] 4x4 bytes
(16 bytes)
4x8*
bytes (32
bytes)
*AVR-DA
Array/bit field Select X pin masks for
NODE_MUTUAL_4P.
Set the bit(s) at location(s)
corresponding to X line number(s).
For example:
X0 only = = X00b00000001 0x01
and X2 = = 0b00000101 0x05
node_ymask 4 bytes
8* bytes
*AVR-DA
(bit field) Select Y pin mask.
Set the bit(s) at location(s)
corresponding to Y line number(s).
For example:
Y5 only = = 0b00100000 0x20
Y1, Y2 and Y7 = = 0b10000110 0x86
node_csd 1 byte For SAM L1x:
0 to 255
For ATtiny81x,161x,
321x:
0 to 31
The number of delay cycles to ensure
the charging of the sensor node
capacitances
Note:  If auto-tune is enabled, this
value is used for initial compensation
capacitor calibration. Ensure it allows
sufficient time to charge the sensor.
User's Guide
Boost Mode
© 2020 Microchip Technology Inc. User Guide DS40001986E-page 28


Product specificaties

Merk: Microchip
Categorie: Niet gecategoriseerd
Model: PIC32CK1025SG01100

Heb je hulp nodig?

Als je hulp nodig hebt met Microchip PIC32CK1025SG01100 stel dan hieronder een vraag en andere gebruikers zullen je antwoorden




Handleiding Niet gecategoriseerd Microchip

Handleiding Niet gecategoriseerd

Nieuwste handleidingen voor Niet gecategoriseerd