Atmel QTouch AT08774: SAM D20 PTC with I2C Slave APPLICATION NOTE Introduction ® This application note explains the firmware solution implemented on Atmel ® ® ATSAMD20J18 device using ARM Cortex -M0+ processor. The firmware solution demonstrates SAM D20 PTC self and mutual-capacitance sensor measurements and transmit/receive touch data using I2C slave. This implementation is useful in applications where the Host MCU need to control various touch setup parameters over I2C. For instance, applications that target low power consumption can adjust clock prescaler and scan interval. Applications that target best noise performance can adjust noise counter options dynamically. The firmware solution is implemented using two SAM D20 Xplained Pro boards, one acting as User board and the other for QDebug which streams ® touch data to QTouch Analyzer. The demonstration program is implemented in C and supports GCC Compiler used by Atmel Studio 7. Features • • • • • • • Host MCU based touch parameter control I2C in slave mode Hardware Touch Acquisition using PTC Demonstration Program Uses I2C driver in ASF QTouch Composer generated touch project Utilizes SAM D20 Xplained Pro Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 Table of Contents Introduction......................................................................................................................1 Features.......................................................................................................................... 1 1. Abbreviations and Definitions.................................................................................... 4 2. Overview....................................................................................................................5 3. Hardware and Functional...........................................................................................6 3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. Hardware Requisites.................................................................................................................... 6 Circuit Configuration.....................................................................................................................6 Test Setup.....................................................................................................................................7 Startup/Calibration Times............................................................................................................. 8 Calibration.................................................................................................................................... 8 Sleep............................................................................................................................................ 8 Touch Data Debug........................................................................................................................8 4. I2C Operation.......................................................................................................... 10 4.1. 4.2. I2C-Compatible Address............................................................................................................ 10 CHANGE Pin..............................................................................................................................10 5. Firmware.................................................................................................................. 11 5.1. 5.2. 5.3. 5.4. 5.5. 5.6. Application Flow..........................................................................................................................11 Creating Self/Mutual Combined Project......................................................................................11 Adding ASF Component (SERCOM I2C - Slave Mode Driver).................................................. 15 Configure and Process I2C........................................................................................................ 16 Files............................................................................................................................................17 Functions....................................................................................................................................18 6. Communication Protocol..........................................................................................21 6.1. 6.2. 6.3. 6.4. 6.5. 6.6. Introduction.................................................................................................................................21 Address 0: Chip ID..................................................................................................................... 24 Address 1: Major/Minor Code Version........................................................................................24 Address 2: SelfCap Sensor Status.............................................................................................24 Address 3: MutualCap Sensor Status........................................................................................ 24 Address 4: Rotor/Slider Position.................................................................................................24 6.7. 6.8. 6.9. 6.10. 6.11. 6.12. 6.13. 6.14. 6.15. 6.16. Address 6: Calibrate...................................................................................................................25 Address 7: Reset........................................................................................................................25 Address 8: Scan Interval............................................................................................................ 25 Address 10-11, 52-55: GAIN...................................................................................................... 25 Address 12, 64: Frequency Mode.............................................................................................. 26 Address 13-14, 65-68: PTC Prescaler........................................................................................26 Address 15-16, 69-72: Series Resistor...................................................................................... 27 Address 17-18, 73-76: PTC Prescaler – CC Cal........................................................................27 Address 16, 60: Series Resistor – CC Cal................................................................................. 27 Address 21-23, 81-83: Frequency Hops.................................................................................... 27 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 2 6.17. Address 24-25, 84-87: Filter Level............................................................................................. 28 6.18. 6.19. 6.20. 6.21. 6.22. 6.23. 6.24. 6.25. 6.26. 6.27. 6.28. 6.29. 6.30. 6.31. 6.32. 6.33. 6.34. 6.35. 6.36. 6.37. 6.38. 6.39. 6.40. 6.41. 6.42. 6.43. 6.44. 6.45. Address 26-27, 88-91: Auto OS................................................................................................. 28 Address 28, 92: Auto Tune.........................................................................................................29 Address 29-30, 93: AKS.............................................................................................................29 Address 31-32, 94: Detect Threshold.........................................................................................30 Address 33-34, 95: Detect Hysteresis........................................................................................30 Address 35-36, 96: Position Resolution..................................................................................... 30 Address 97: Position Hysteresis.................................................................................................31 Address 37, 99: Detect Integration.............................................................................................31 Address 38, 100: Away From Touch Drift (Positive Drift)........................................................... 32 Address 39, 101: Towards Touch Drift (Negative Drift).............................................................. 32 Address 40, 102: Max On Duration............................................................................................ 33 Address 41, 103: Drift Hold Time............................................................................................... 33 Address 42, 104: Away from Touch Recalibration Delay............................................................33 Address 43, 105: Calibration Burst Count - Seq1...................................................................... 34 Address 44, 106: Calibration Burst Count - Seq2...................................................................... 34 Address 45, 107: Recalibration Threshold................................................................................. 34 Address 46-47,108-109: Sensor Post-processing Mode............................................................35 Address 48-49, 110-111: Auto OS Signal Stability Limit.............................................................35 Address 50-51,112-113: Frequency Auto Tune Stability Limit....................................................35 Address 52,114: Frequency Auto Tune In Counter.................................................................... 36 Address 54-55,116-117: Noise Measurement Signal Stability Limit .......................................... 36 Address 56,118: Noise Measurement Noise Limit......................................................................36 Address 57,119: Noise Measurement Sensor Lockout Setting.................................................. 37 Address 58,120: Noise Measurement Lockout Count Down......................................................37 Address 122 – 125: SelfCap Signal........................................................................................... 37 Address 126 – 129: SelfCap Reference.....................................................................................38 Address 130-137: MutualCap Signal..........................................................................................38 Address 138-145: MutualCap Reference................................................................................... 38 7. References.............................................................................................................. 40 8. Revision History.......................................................................................................41 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 3 1. Abbreviations and Definitions • • • • • • • • • • • • • • • • • • • • Acquisition cycle: A single capacitive measurement process ASF: Atmel Software Framework Calibration: Multiple touch measurements carried out continuously to set Reference Delta: Difference between Reference and Signal (Reference – Signal) Detect Threshold: Determines delta required for a valid touch DGI: Data Gateway Interface EDBG: Embedded Debugger Drift: AdjustingReference level to track changes in signal level due to environmental changes I2C: Inter-Integrated Circuit Max on Duration: Duration for which sensor stays detected PTC: Peripheral Touch Controller Reference: Long term average measurement on a channel Recalibration Threshold: It is the level above which automatic recalibration occurs Scan Interval: Duration in which touch measurement is performed SCL: Serial Clock Line SDA: Serial Data Line SERCOM: Serial Communication Module Signal: Raw measurement for capacitance change on a channel X Line: The Sense Line connected to the X Electrode in Mutual capacitance method Y Line: The Sense Line connected to the Y Electrode used in Self-capacitance method Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 4 2. Overview The SAM D20 series device is a 32-bit ARM Cortex-M0+ based microcontroller, which supports hardware touch acquisition using PTC peripheral. PTC supports capacitive touch sensing on both self and mutual capacitance sensors, without any external components (Series resistors might be required to handle extreme noise scenarios). Refer PTC User guide for detailed information on PTC and QTouch Library. The firmware solution demonstrated in this application note uses two self-capacitance button sensors and one mutual capacitance slider sensor. This solution can be easily scaled to support various sensor configuration with appropriate modifications in firmware. The device series provides up to six SERCOMs that can be configured to operate as an I2C, SPI, and USART interface. The firmware solution configures SERCOM4 (PA12, PA13) of ATSAMD20J18 device as I2C communication interface in slave mode. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 5 3. 3.1. Hardware and Functional Hardware Requisites The following table lists the hardware required to build the test setup for analyzing this firmware solution. Table 3-1. Hardware Requisites 3.2. Hardware Quantity SAM D20 Xplained Pro board 2 QT1 QTouch Self-capacitance sensor board 1 QT1 QTouch Mutual capacitance sensor board 1 STK600 1 STK600 – ATMEGA2560 board 1 Circuit Configuration The following table shows connections used in this firmware solution. Table 3-2. Sensor Pin Configuration used in SAM D20 User Board SAM D20 Xplained Pro (User Board) QT1 Xplained Pro Sensor Board PA02 (Y0) Self-capacitance Button_0 (Y_8) PA03 (Y1) Self-capacitance Button_1 (Y_7) PA10 (X2) Mutual capacitance Slider Channel_0 (X_1) PA11 (X3) Mutual capacitance Slider Channel_1 (X_2) PA20 (X8) Mutual capacitance Slider Channel_2 (X_3) PA21 (X9) Mutual capacitance Slider Channel_3 (X_4) PB06 (Y12) Mutual capacitance Slider (Y_S) Note: The sense line (X / Y) numbers specified in table preceeding table under SAM D20 Xplained Pro board are as based on the information in the SAM D20 Datasheet. The X / Y numbers specified under QT1 sensor board are generic (as marked in QT1 sensor boards). Table 3-3. Connection between SAM D20 User Board and AVR3009 Host Microcontroller SAM D20 Xplained Pro (User Board) AVR3009 Host (ATmega2560) PA12 (SDA) PD1 PA13 (SCL) PD0 PA27 (CHANGE pin) PD2 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 6 Table 3-4. Connection between SAM D20 User Board and SAM D20 Xplained Pro for QDebug SAM D20 Xplained Pro (User Board) SAM D20 Xplained Pro (QDebug) PA17 (SS) - Connect to GND - PA18 (MOSI) PB22 PA16 (MISO) PB16 PA19 (SCK) PB23 GND GND Figure 3-1. Circuit Configuration The firmware solution provided is applicable for ATSAMD20J18 device operating as I2C Slave. Firmware validation uses the demonstration code provided with the application note “AVR3009: Driving QTouch Device with IIC Interface” with the required modifications. An external pull-up resistor of 10kΩ is required on CHANGE line and 4.7kΩ is required on SCL and SDA lines. Using external pull-up resistor of 10kΩ on RESET line is optional, as the device features an internal pull-up resistor on this pin. 3.3. Test Setup Table 3-2 Sensor Pin Configuration used in SAM D20 User Board represents the actual test setup used for the firmware validation. This setup uses one SAM D20 Xplained Pro board, which acts as user board and the same board is used for QDebug. This Xplained Pro board is directly connected to QT1 Mutual capacitance sensor board (slider sensor) and hooked wires for connecting to QT1 Self-capacitance sensor board (button sensor). To demonstrate the firmware solution, the interconnection between Master and Slave uses wires as shown in the following image:. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 7 Figure 3-2. Test Setup 3.4. Startup/Calibration Times The device requires an initialization time of approximately 300ms. This includes calibration time of around 200ms. Any subsequent recalibration will also take approximately 200ms. The CHANGE line is asserted at startup, after initialization. 3.5. Calibration The calibration does not occur periodically. Keys are calibrated when one of the following conditions occur: • • • • Power up Sensor signal value is greater than the Positive Recalibration Threshold – Default = 50% of Detect Threshold At the end of Max on Duration (if enabled) – Default = Disabled Host MCU issues a Calibrate Command If any sensor was in detect state before recalibration, it will go out of detect after recalibration. This will change the Status Bytes and trigger the CHANGE line to go low. 3.6. Sleep The default scan interval of the device is set as 20ms. In the firmware solution touch measurement is performed on the configured sensors. To reduce power consumption, CPU sleeps during touch acquisition as well as for the remaining period of scan interval. 3.7. Touch Data Debug The SAM D20 Xplained Pro contains Embedded Debugger (EDBG) that features an Atmel Data Gateway Interface (DGI) using SPI and I2C. The DGI can be used to transmit a variety of data from the Xplained Pro kit to the host PC. This arrangement can be used to send QDebug data from a user board to PC running QTouch Analyzer for touch sensor data analysis and tuning. The example project generated using QTouch composer transfers QDebug data over SPI. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 8 To stream QDebug data from the user board (SAM D20 Xplained Pro) using another SAM D20 Xplained Pro board, refer Table 3-4 Connection between SAM D20 User Board and SAM D20 Xplained Pro for QDebug for connection details and refer to procedure provided in PTC User Guide. The same user board SAM D20 Xplained Pro board can also be used to stream QDebug data for testing the firmware solution provided. Required SPI debug line connections to EDBG is hard wired in SAM D20 Xplained Pro board. So, using the corresponding debug related pin definitions in touch.h file as shown in the following table is sufficient to enable QDebug in the same Xplained Pro board. Table 3-5. Using the Same SAM D20 (User Board) Xplained Pro for QDebug SAM D20 Xplained Pro (User Board) Pin Function PB22 MOSI PB16 MISO PB23 SCK PB31 SS Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 9 4. I2C Operation The firmware solution use SERCOM I2C interface to communicate with Master MCU. This Atmel Twowire Serial Interface is compatible with Philips I2C Bus/Protocol. Refer to ATSAMD20J18 device datasheet for details of operation. 4.1. I2C-Compatible Address The I2C address for the slave ATSAMD20J18 device is set as 0x12. 4.2. CHANGE Pin The CHANGE pin is an active low open drain output that can be used to alert the host about any change in any of the sensor status, thus reducing the need for wasteful I2C communications. CHANGE pin goes low when there is change in status bytes of any sensor or slider position values (Memory map address 2 to 4, detailed in Table 6-1 Memory Map). When the master performs a read from all the status bytes, CHANGE pin becomes high. Poll rate: The host can make use of CHANGE pin output to initiate a communication; this will guarantee the optimal polling rate. If the host cannot make use of CHANGE pin, the poll rate should be no faster than once per acquisition cycle. The default scan interval is 20ms. A faster scan interval will not provide new information and will slow down the chip operation. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 10 5. Firmware 5.1. Application Flow 5.2. Creating Self/Mutual Combined Project The following procedure explains creating a combined project for both self and mutual capacitance sensors. 5.2.1. Create Self-capacitance Project Use QTouch Composer – Project builder wizard and create self-capacitance project for two button sensors as per configuration in the following table, with QDebug enabled. This project name is referred as “selfcap” in the following sections. Table 5-1. Self-capacitance Sensor Pin Configuration used in SAM D20 User Board Parameter Sense pin Button0 Y0 (PA02) Gain Detect threshold Filter level Auto oversampling Auto tuning Series resistor Frequency mode 1 8 Disable PRSC 100K None 30 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 11 Table 5-2. Debug Pin Configuration used in SAM D20 User Board Parameter ATSAMD20J18 port pin SPI_BB_SS PA17 SPI_BB_SCK PA19 SPI_BB_MOSI PA18 SPI_BB_MISO PA16 Y lines used in this project are custom configuration, based on available unused pins in the SAM D20 Xplained Pro board. Note that the Y lines are not the same as used in standard ASF example project “SAM D20 Xplained Pro and QT1 Xplained Pro Self-capacitance example application”. 5.2.2. Create Mutual capacitance Project Use QTouch Composer Project builder wizard and create mutual capacitance project for one slider sensor as per configuration in the following table, with QDebug disabled. This project name is referred as “mutualcap” in the following sections. Table 5-3. Mutual Capacitance Sensor Pin Configuration used in SAM D20 User Board Parameter X Line Y Line 5.2.3. Gain Detect Filter Auto Auto Series Frequency threshold level oversampling tuning resistor mode Slider Channel0 X2 Y12 1 (PA10) (PB06) Slider Channel1 X3 Y12 1 (PA11) (PB06) Slider Channel2 X8 Y12 1 (PA20) (PB06) Slider Channel3 X9 Y12 1 (PA21) (PB06) 30 8 Disable PRSC 100K None Create Combined (Self + Mutual capacitance) Project The self-capacitance project created is set as base application project and the mutual capacitance project created is used as reference. Append the required contents from mutual capacitance to self-capacitance project, for enabling touch measurement on both self and mutual capacitance sensors. The following procedure details the steps to include required contents. Use the demonstration project available for reference. 1. Copy all the macros (excluding DEF_TOUCH_PTC_ISR_LVL) from the touch.h file in the mutualcap project and paste in the touch.h file from the selfcap project. 2. Compare both touch.c files, copy the required contents from the mutual capacitance project and perform the following changes in the selfcap base project. 2.1. Declare the data block array for the mutual capacitance method, after the self-capacitance data array declaration. /** * Mutual Cap Data block provided as input to Touch library. */static uint8_t mutlcap_data_blk[PRIV_MUTLCAP_DATA_BLK_SIZE]; Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 12 2.2. Declare mutual capacitance sensors pin information, along with the self-capacitance sensor details. /** * Mutual Cap Sensor Pins Info. */ uint16_t mutlcap_xy_nodes[DEF_MUTLCAP_NUM_CHANNELS * 2] = {DEF_MUTLCAP_NODES}; filter_level_t mutlcap_filter_level_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_FILTER_LEVEL_PER_NODE}; uint8_t mutlcap_auto_os_per_node[DEF_MUTLCAP_NUM_CHANNELS]= {DEF_MUTLCAP_AUTO_OS_PER_NODE}; gain_t mutlcap_gain_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_GAIN_PER_NODE}; rsel_val_t mutlcap_resistor_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_SENSE_RESISTOR_PER_NODE }; prsc_div_sel_t mutlcap_prsc_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_CLK_PRESCALE_PER_NODE }; prsc_div_sel_t mutlcap_boot_prsc_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_CC_CAL_CLK_PRESCALE_PER_NODE}; rsel_val_t mutlcap_boot_resistor_per_node[DEF_MUTLCAP_NUM_CHANNELS] = {DEF_MUTLCAP_CC_CAL_SENSE_RESISTOR_PER_NODE}; freq_hop_sel_t mutlcap_freq_hops[3u] = {DEF_MUTLCAP_HOP_FREQS}; 2.3. 2.4. Define Configuration structure for mutual capacitance after self-capacitance structure. Update the touch_config structure with the address of mutual capacitance configuration parameter, as shown in following code snippet. touch_config_t touch_config = { &mutlcap_config, &selfcap_config, /* Pointer to Self Cap configuration structure.*/ DEF_TOUCH_PTC_ISR_LVL, /* PTC interrupt level. */ }; 2.5. Define the measure complete callback prototype, after self cap measure complete callback routine. void touch_mutlcap_measure_complete_callback( void ); 2.6. 3. Similar to measure complete callback function for self-capacitance, define the mutual capacitance measure complete call back function in the end of touch.c file. To invoke the mutual capacitance measurement related APIs as follows. Use the mutual capacitance project touch.c file as reference. 3.1. Invoke touch_mutlcap_sensors_init API after invoking touch_selfcap_sensors_init. touch_ret = touch_mutlcap_sensors_init(&touch_config); if (touch_ret != TOUCH_SUCCESS) { touch_app_err_handler(TOUCH_INIT_CONFIG_ERR, touch_ret); } 3.2. Similarly invoke touch_mutlcap_sensors_calibrate after invoking touch_selfcap_sensors_calibrate. touch_ret = touch_mutlcap_sensors_calibrate(DEF_MUTL_AUTO_TUNE_VALUE); if (touch_ret != TOUCH_SUCCESS) { touch_app_err_handler(TOUCH_INIT_CALIB_ERR, touch_ret); } return (touch_ret); 3.3. Next, configure the mutual capacitance sensors in the touch_sensors_config routine definition. Append the mutual capacitance sensor configuration next to the self-capacitance sensors. touch_ret_t touch_sensors_config(void) { touch_ret_t touch_ret = TOUCH_SUCCESS; sensor_id_t sensor_id; touch_ret = touch_selfcap_sensor_config(SENSOR_TYPE_KEY, Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 13 CHANNEL_0,CHANNEL_0, NO_AKS_GROUP, 15u, HYST_25,RES_8_BIT, &sensor_id); if (touch_ret != TOUCH_SUCCESS) { touch_app_err_handler(TOUCH_SENSOR_CONFIG_ERR, touch_ret); } touch_ret = touch_selfcap_sensor_config(SENSOR_TYPE_KEY, CHANNEL_1,CHANNEL_1, NO_AKS_GROUP, 15u, HYST_25,RES_8_BIT, &sensor_id); if (touch_ret != TOUCH_SUCCESS) { touch_app_err_handler(TOUCH_SENSOR_CONFIG_ERR, touch_ret); } touch_ret = touch_mutlcap_sensor_config(SENSOR_TYPE_SLIDER, CHANNEL_0,CHANNEL_3, NO_AKS_GROUP, 10u, HYST_25,RES_8_BIT, 0u, &sensor_id); if (touch_ret != TOUCH_SUCCESS) { touch_app_err_handler(TOUCH_SENSOR_CONFIG_ERR, touch_ret); } } 3.4. return (touch_ret); Finally, invoke the mutual capacitance sensor measure routine next to the self-capacitance sensor measure routine. The touch acquisition process is sequential in case of SAM D20 PTC. So, before invoking the mutual capacitance sensor acquisition, the application needs to ensure that the acquisition is complete on the self-capacitance sensors and vice-versa. The following code snippet shows the conditional implementation required for invoking touch acquisition. touch_ret_t touch_sensors_measure(void) { touch_ret_t touch_ret = TOUCH_SUCCESS; if (!(p_selfcap_measure_data->acq_status & TOUCH_CC_CALIB_ERROR)) { 1u) if (touch_time.time_to_measure_touch == 1u) { if(start_check == 1 || p_mutlcap_measure_data->measurement_done_touch == { touch_ret = touch_selfcap_sensors_measure( touch_time.current_time_ms, NORMAL_ACQ_MODE, touch_selfcap_measure_complete_callback); if ((touch_ret != TOUCH_ACQ_INCOMPLETE) && (touch_ret == TOUCH_SUCCESS)) { p_mutlcap_measure_data->measurement_done_touch = 0u; start_check = 0; } else if ((touch_ret != TOUCH_SUCCESS) && (touch_ret != TOUCH_ACQ_INCOMPLETE)) { touch_app_err_handler(TOUCH_MEASURE_INCOMPLETE, touch_ret); /* Reaching this point can be due to * 1. The api has retured an error due to a invalid * input parameter. * 2. The api has been called during a invalid Touch * Library state. */ } } } if(p_selfcap_measure_data->measurement_done_touch == 1u) { touch_ret = touch_mutlcap_sensors_measure( touch_time.current_time_ms, NORMAL_ACQ_MODE, touch_mutlcap_measure_complete_callback); if ((touch_ret != TOUCH_ACQ_INCOMPLETE) && (touch_ret == TOUCH_SUCCESS)) { p_selfcap_measure_data->measurement_done_touch = 0u; touch_time.time_to_measure_touch = 0u; } else if ((touch_ret != TOUCH_SUCCESS) && (touch_ret != TOUCH_ACQ_INCOMPLETE)) { Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 14 touch_app_err_handler(TOUCH_MEASURE_INCOMPLETE, touch_ret); /* Reaching this point can be due to * 1. The api has retured an error due to a invalid * input parameter. * 2. The api has been called during a invalid Touch * Library state. */ } } } else { /* To find which sensor failed in the calibration, check p_xxxxcap_measure_data->p_sensors[<sensor>].state == SENSOR_CALIBRATION_ERROR */ touch_app_err_handler(TOUCH_MEASURE_CC_CAL_FAILED, touch_ret); } } return (touch_ret); Note: In the above code, the start_check variable is used to invoke touch acquisition at power up. This should be initialized to "1" in touch.c file (uint8_t start_check = 1u;). Build and Test:The project creation, which can perform measurement on both self and mutual capacitance sensors is complete. Build the project at this stage and ensure there are no errors / warnings. Then download it into the ATSAMD20J18 device in SAM D20 Xplained Pro user board. QDebug:The combined project has QDebug enabled for self-capacitance sensors. So, the performance of self-capacitance sensors can be analyzed using QTouch Analyzer. To enable QDebug for the mutual capacitance sensor, enable the required macro definition in the touch.h file as follows. //#define DEF_TOUCH_QDEBUG_ENABLE_SELFCAP #define DEF_TOUCH_QDEBUG_ENABLE_MUTLCAP #define DEF_TOUCH_QDEBUG_ENABLE 1u Build and load the project again. Now, mutual capacitance slider performance can be analyzed in QTouch Analyzer. Note: The QTouch Analyzer can only provide either self or mutual capacitance sensor data, simultaneously. 5.3. Adding ASF Component (SERCOM I2C - Slave Mode Driver) Next step is to add SERCOM I2C – Slave Mode Callback driver from ASF, into the combined project created. To open the ASF wizard in the project, click on ASF -> ASF Wizard. Then search and select SERCOM I2C – Slave Mode I2C driver (Callback) under the Available Modules. Click on the Add button as shown in the following figure. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 15 Figure 5-1. Selecting SERCOM I2C Slave Driver from ASF The SERCOM I2C driver is available under the Selected Modules list. Click on the Apply button to include the selected I2C diver module into the combined project. Save the changes and perform a test build using the project. Figure 5-2. Adding SERCOM I2C Slave Driver into the Project 5.4. Configure and Process I2C In the user project (combined project created) which includes required I2C drivers from ASF, I2C should be configured in slave mode and the necessary callbacks should be defined. The I2C driver added from ASF does not handle internal memory addressing. So the application code needs to process the read and write commands appropriately. In the user project, include the source and header files available in the apps_src folder in the demonstration project. Among the included source files, i2c_process.c file takes care of configuring the I2C in slave mode and define I2C callbacks for read request, write request, read complete, write complete operations. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 16 As well, this file handles internal memory addressing to comply with master requests. This internal addressing implementation requires number of bytes written by master to the slave device. So, in the i2c_slave_interrupt.c file in the interrupt handler _i2c_slave_interrupt_handler definition, a variable for number of bytes written is incremented whenever request is received for write, as shown in following code snippet. /* Continue buffer write/read */ } else if (module->buffer_length > 0 && module->buffer_remaining > 0) { /* Call function based on transfer direction */ if (module->transfer_direction == I2C_TRANSFER_WRITE) { _i2c_slave_read(module); num_bytes_written++; } else { _i2c_slave_write(module); The variable “num_bytes_written” should be declared as extern in the i2c_slave_interrupt.c file. extern uint8_t num_bytes_written; Based on the number of bytes written, the slave decides whether it is a master write instruction or read instruction. Case 1: If the number of bytes written is one, then slave determines this as a read request from master. The data byte received is considered as address to be read and the slave points to that address for read operation. Case 2: If the number of bytes written is more than one, then slave determines this as a write request from master. Slave writes the received data bytes into a data buffer. Process received data: During write operation, data bytes written are stored in a data buffer. This data must be processed appropriately, where the first byte in buffer represents the address to be written into and the following bytes are the data bytes to be written. These data bytes written updates / configures the touch setup parameters, discussed in following sections. The i2c_process.c file also handles processing of the received data bytes and updating the memory map. To complete configuring and data processing, replace the main.c file available in demonstration project in the user project. This completes the demonstration project creation by the user. Build the project and test it using any I2C Master MCU. 5.5. Files The folder structure of the firmware solution is as follows: Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 17 Figure 5-3. Folder Structure The following table provides a brief description of additional files used in this firmware solution. Table 5-4. File Description File name Description configuration.h Configuration for Change pin is provided here. 5.6. memorymap.h Defines memory map structure which contains touch setup parameters as objects. memorymap.c Provides a default value to the touch setup parameters in memory map. i2c_process.h It consist of function prototypes and macro definitions used in i2c_process.c i2c_process.c It configures I2C and processes data bytes received. Functions A brief description of functions used in the additional files included in the firmware solution are provided in the following table. Table 5-5. Functions Function Description void memorymap_defaults(void) Provides default values to touch setup parameters in memory map. Input None Output None Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 18 Function Description void i2c_read_request_callback(struct i2c_slave_module *const module) This function points the read location to the appropriate memory map location requested by master. void i2c_write_request_callback(struct i2c_slave_module *const module) void i2c_read_complete_callback(struct i2c_slave_module *const module) void i2c_write_complete_callback(struct i2c_slave_module *const module) void configure_i2c_slave(void) Input *const – pointer to the I2C slave module structure. Output None This function points the write location to the write buffer. Input *const – pointer to the I2C slave module structure. Output None Updates the change pin status when the status bytes is read by master. Input *const – pointer to the I2C slave module structure. Output None Checks the number of bytes written and takes necessary action for read/ write request. Input *const – pointer to the I2C slave module structure. Output None Configures SERCOM4 I2C in Slave mode. Input None Output None Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 19 Function Description void configure_i2c_slave_callbacks(void) Register and enable I2C Slave callback routines. void update_sensor_data(void) void update_setup_config(void) void update_memory_map(void) Input None Output None Updates touch sensor data measured in the memory map structure and updates change pin status based on sensor state. Input type - type code for the object details requested Output None Updates touch setup parameters based on data written by master. Input None Output None Updates the memory map with data written by master. Input None Output None Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 20 6. Communication Protocol 6.1. Introduction The device is address mapped. All communications consist of write and read access to the locations in an 8-bit address map. The memory map structure that contains the touch status / setup parameters used in firmware solution are provided in the following table. The touch setup parameters can be modified as required for the user application. Table 6-1. Memory Map Address Use Access 0 Chip ID Read 1 Major/Minor Code Version Read 2 SelfCap Sensor Status Read 3 MutualCap Sensor Status Read 4 Rotor/Slider Position Read 5 Reserved_1 Read 6 Calibrate Read/Write 7 Reset Read/Write 8 Scan Interval Read/Write 9 Reserved_2 Read/Write 10 Gain for Button_0 Read/Write 11 Gain for Button_1 Read/Write 12 Frequency_Mode Read/Write 13 PTC Prescaler for Channel_0 Read/Write 14 PTC Prescaler for Channel_1 Read/Write 15 Series Resistor for Channel_0 Read/Write 16 Series Resistor for Channel_1 Read/Write 17 PTC Prescaler - CC Cal for Channel_0 Read/Write 18 PTC Prescaler - CC Cal for Channel_1 Read/Write 19 Series Resistor - CC Cal for Channel_0 Read/Write 20 Series Resistor - CC Cal for Channel_1 Read/Write 21 – 23 Frequency Hops Read/Write 24 Filter Level for Channel_0 Read/Write Self-capacitance Setup Block Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 21 Address Use Access 25 Filter Level for Channel_1 26 Auto OS for Channel_0 27 Auto OS for Channel_1 28 Auto Tune Read/Write 29 – 30 AKS (Key 0 – 1) Read/Write 31 – 32 Detect Threshold (Button 0 – 1) Read/Write 33 – 34 Detect Hysteresis (Button 0 – 1) Read/Write 35 – 36 Position Resolution (Button 0 – 1) Read/Write 37 Detect Integration Read/Write 38 Away From Touch Drift Read/Write 39 Towards Touch Drift Read/Write 40 Max On Duration Read/Write 41 Drift Hold Time Read/Write 42 Away from touch Recalibration Delay Read/Write 43 Calibration burst count - Seq1 Read/Write 44 Calibration burst count – Seq2 Read/Write 45 Recalibration Threshold Read/Write 46 – 47 Sensor post-processing mode Read/Write 48 – 49 Auto OS signal stability limit 50 – 51 Frequency auto tune stability limit Read/Write 52 Frequency auto tune In counter Read/Write 53 Reserved_3 Read/Write 54 – 55 Noise measurement signal stability limit Read/Write 56 Noise measurement noise limit Read/Write 57 Noise measurement sensor lockout setting Read/Write 58 Noise measurement lockout count down Read/Write 59 Reserved_4 Read/Write 60 Gain for Slider Channel_0 Read/Write 61 Gain for Slider Channel_1 Read/Write 62 Gain for Slider Channel_2 Read/Write 63 Gain for Slider Channel_3 Read/Write 64 Frequency_Mode Read/Write Read/Write Mutual capacitance Setup Block Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 22 Address Use Access 65 – 68 PTC Prescaler (Channel_0 to Channel_3) Read/Write 69 – 72 Series Resistor (Channel_0 to Channel_3) Read/Write 73 – 76 PTC Prescaler - CC Cal (Channel_0 to Channel_3) 77 – 80 Series Resistor - CC Cal (Channel_0 to Channel_3) Read/Write 81 – 83 Frequency Hops Read/Write 84 – 87 Filter Level (Channel_0 to Channel_3) Read/Write 88 – 91 Auto OS (Channel_0 to Channel_3) Read/Write 92 Auto Tune Read/Write 93 Slider AKS Read/Write 94 Slider Detect Threshold Read/Write 95 Slider Detect Hysteresis Read/Write 96 Slider Position Resolution Read/Write 97 Slider Position Hysteresis Read/Write 98 Reserved_5 Read/Write 99 Detect Integration Read/Write 100 Away From Touch Drift Read/Write 101 Towards Touch Drift Read/Write 102 Max On Duration Read/Write 103 Drift Hold Time Read/Write 104 Away from touch Recalibration Delay Read/Write 105 Calibration burst count - Seq1 Read/Write 106 Calibration burst count – Seq2 Read/Write 107 Recalibration Threshold Read/Write 108 – 109 Sensor post-processing mode Read/Write 110 – 111 Auto OS signal stability limit Read/Write 112 – 113 Frequency auto tune stability limit Read/Write 114 Frequency auto tune In counter Read/Write 115 Reserved_6 Read/Write 116 – 117 Noise measurement signal stability limit Read/Write 118 Noise measurement noise limit Read/Write 119 Noise measurement sensor lockout setting Read/Write 120 Noise measurement lockout count down Read/Write 121 Reserved_7 Read Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 23 6.2. Address Use Access 122 – 125 SelfCap Signal Read 126 – 129 SelfCap Reference Read 130 – 137 MutualCap Signal Read 138 – 145 MutualCap Reference Read Address 0: Chip ID Address Bit 7 Bit 6 Bit 5 Bit 4 0 Bit 3 Bit 2 Bit 1 Bit 0 Chip ID This address holds the Chip ID, always reads 0x1A. 6.3. Address 1: Major/Minor Code Version Address Bit 7 1 Bit 6 Bit 5 Bit 4 Major Version Bit 3 Bit 2 Bit 1 Bit 0 Minor Version There is an 8-bit major and minor version of the firmware revision. The top nibble of the firmware version register contains the major version (1.0) and the bottom nibble contains the minor version (1.0). 6.4. Address 2: SelfCap Sensor Status Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 2 0 0 0 0 0 0 Button_1 Button_0 The last two bits indicate touch status of two self-capacitance buttons. It is reported as ‘1’ if button is touched else reports ‘0’ when untouched. A change in this status bits causes CHANGE line to assert low. 6.5. Address 3: MutualCap Sensor Status Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 3 0 0 0 0 0 0 0 Slider_State The last bit indicates touch status of mutual capacitance slider. It is reported as ‘1’ if slider is touched else reports ‘0’ when slider is not in detection. A change in this status bit causes CHANGE line to assert low. 6.6. Address 4: Rotor/Slider Position Address 4 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Slider Position Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 24 This byte reports slider position output. This is valid only when slider is in detect state. A change in this value causes CHANGE line to assert low. 6.7. Address 6: Calibrate Address Bit 7 Bit 6 Bit 5 6 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 CALIBRATE Writing any non-zero value into this address will trigger the device to start a recalibration on all enabled sensors. 6.8. Address 7: Reset Address Bit 7 Bit 6 Bit 5 7 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 RESET Any non-zero value will trigger the device to reset. After reset, the device will revert to default settings provided to touch setup parameters. The host must wait for at least 300ms for the operation to be completed before communications can be re-established. 6.9. Address 8: Scan Interval Address Bit 7 Bit 6 Bit 5 8 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 SCAN INTERVAL This 8-bit value represents the duration (in ms) to invoke touch measurement. Longer the interval yields lower power consumption, as the device sleeps longer after touch measurement, but at the cost of slower response to touch. 6.10. Address 10-11, 52-55: GAIN Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 10 GAIN for SelfCap Button_0 11 GAIN for SelfCap Button_1 52 GAIN for MutualCap Slider Channel _0 53 GAIN for MutualCap Slider Channel _1 54 GAIN for MutualCap Slider Channel _2 55 GAIN for MutualCap Slider Channel _3 Bit 1 Bit 0 Address 10-11 represents gain setting for self-capacitance buttons. Address 52-55 represents gain setting for mutual capacitance slider channels. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 25 Gain setting is applied on a per-channel basis to allow scaling-up of the touch delta upon contact. Gain setting depends on the sensor design and touch panel thickness. Range: GAIN_1 to GAIN_32 Default: GAIN_1 ( Self-capacitance), GAIN_2 (Mutual capacitance) 6.11. Address 12, 64: Frequency Mode Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 12 Frequency Mode for SelfCap 56 Frequency Mode for MutualCap Bit 1 Bit 0 Address 12 represents frequency mode to be used for self-capacitance buttons. Address 56 represents frequency mode to be used for mutual capacitance slider. Frequency mode setting allows users to tune the PTC touch acquisition frequency characteristics to counter environment noise. The different frequency modes available are: • • • • FREQ_MODE_HOP FREQ_MODE_SPREAD FREQ_MODE_SPREAD_MEDIAN FREQ_MODE_NONE Refer to PTC User guide for more details. Default: FREQ_MODE_NONE (For both Self-capacitance and Mutual capacitance). 6.12. Address 13-14, 65-68: PTC Prescaler Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 13 – 16 PTC Prescaler for SelfCap 65 – 68 PTC Prescaler for MutualCap Bit 1 Bit 0 This setting controls the clock pre-scaler to the Generic clock input to PTC. The Generic clock input to PTC should be set to 4MHz. The pre-scaler setting scales down the PTC clock as follows: • PRSC_DIV_SEL_1 sets PTC Clock to 4MHz • PRSC_DIV_SEL_2 sets PTC Clock to 2MHz • PRSC_DIV_SEL_4 sets PTC Clock to 1MHz • PRSC_DIV_SEL_8 sets PTC Clock to 500kHz Range: PRSC_DIV_SEL_1 to PRSC_DIV_SEL_8 Default: PRSC_DIV_SEL_1 (For both Self-capacitance and Mutual capacitance) Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 26 6.13. Address 15-16, 69-72: Series Resistor Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 15 – 16 Series Resistor for SelfCap 77 – 80 Series Resistor for MutualCap Bit 1 Bit 0 Bit 1 Bit 0 This setting controls the value of internal series resistor on the Y line. • RSEL_VAL_0 sets internal series resistor to 0Ω • RSEL_VAL_20 sets internal series resistor to 20kΩ • RSEL_VAL_50 sets internal series resistor to 50kΩ • RSEL_VAL_100 sets internal series resistor to 100kΩ Range: RSEL_VAL_0 to RSEL_VAL_100 Default: RSEL_VAL_100 (For both Self-capacitance and Mutual capacitance) 6.14. Address 17-18, 73-76: PTC Prescaler – CC Cal Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 17 – 18 CC Cal PTC Prescaler for SelfCap 73 – 76 CC Cal PTC Prescaler for MutualCap This setting controls PTC Prescaler to be used during compensation capacitor calibration. 6.15. Address 16, 60: Series Resistor – CC Cal Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 16 CC Cal Series Resistor for SelfCap 60 CC Cal Series Resistor for MutualCap Bit 1 Bit 0 This setting controls Series Resistor to be used during compensation capacitor calibration. 6.16. Address 21-23, 81-83: Frequency Hops Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 21 Frequency Hop_1 for SelfCap 22 Frequency Hop_2 for SelfCap 23 Frequency Hop_3 for SelfCap 81 Frequency Hop_1 for MutualCap 82 Frequency Hop_2 for MutualCap 83 Frequency Hop_3 for MutualCap Bit 1 Bit 0 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 27 This frequency hop delay setting is used when the Frequency mode is set to FREQ_MODE_HOP. A set of three frequency hop delay settings should be specified. This delay setting inserts n PTC clock cycles between consecutive measurements on a given sensor, thereby changing the PTC acquisition frequency. FREQ_HOP_SEL_1 setting inserts 1 PTC clock cycle between consecutive measurements. FREQ_HOP_SEL_15 setting inserts 15 PTC clock cycles. Higher delay setting will increase the total time taken for capacitance measurement on a given sensor as compared to a lower delay setting. A desired setting can be used to avoid noise around the same frequency as the acquisition frequency. Range:FREQ_HOP_SEL_1 to FREQ_HOP_SEL_16 6.17. Address 24-25, 84-87: Filter Level Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 24-25 Filter Level for SelfCap 84 – 87 Filter Level for MutualCap Bit 2 Bit 1 Bit 0 This filter level setting controls the number of samples taken to resolve each acquisition. A higher filter level setting provides improved signal to noise ratio under noisy conditions, while increasing the total time for measurement resulting in increased power consumption and response time. Range: FILTER_LEVEL_1 to FILTER_LEVEL_64 Default: FILTER_LEVEL_8 (For both Self-capacitance and Mutual capacitance) 6.18. Address 26-27, 88-91: Auto OS Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 26 – 27 Auto OS for SelfCap 88 – 91 Auto OS for MutualCap Bit 2 Bit 1 Bit 0 Auto oversample controls the automatic oversampling of sensor channels when unstable signals are detected with the default setting of 'Filter level'. Enabling Auto oversample results in 'Filter level' x 'Auto Oversample' number of samples taken on the corresponding sensor channel when an unstable signal is observed. In a case where 'Filter level' is set to FILTER_LEVEL_4 and 'Auto Oversample' is set to AUTO_OS_4, 4 oversamples are taken with stable signal values and 16 oversamples are taken when unstable signal is detected. Range: AUTO_OS_DISABLE to AUTO_OS_128 Default: AUTO_OS_DISABLE (For both Self-capacitance and Mutual capacitance) Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 28 6.19. Address 28, 92: Auto Tune Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 22 Auto Tune for SelfCap 66 Auto Tune for MutualCap Bit 2 Bit 1 Bit 0 Auto tune parameter setting is passed to the touch_xx_sensors_calibrate API in order to allow users to tune the PTC module for power consumption or noise performance. AUTO_TUNE_PRSC When Auto tuning of pre-scaler is selected the PTC uses the user defined internal series resistor setting (DEF_MUTLCAP_SENSE_RESISTOR) and the pre-scaler is adjusted to slow down the PTC operation to ensure full charge transfer. Auto tuning of pre-scaler with RSEL_VAL_100 as the series resistor results in best noise performance while resulting in increased power consumption and touch response time. AUTO_TUNE_RSEL When Auto tuning of the series resistor is selected the PTC runs at user defined pre-scaler setting speed (DEF_MUTLCAP_CLK_PRESCALE) and the internal series resistor is tuned automatically to the optimum value to allow for full charge transfer. Auto tuning of series resistor with PRSC_DIV_SEL_1 as the PTC pre-scale results in best case power consumption. AUTO_TUNE_NONE When manual tuning option is selected, the user defined values of PTC pre-scaler and series resistor is used for PTC operation as given in DEF_MUTLCAP_CLK_PRESCALE and DEF_MUTLCAP_SENSE_RESISTOR. Default: AUTO_TUNE_PRSC (For both Self-capacitance and Mutual capacitance) 6.20. Address 29-30, 93: AKS Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 29 AKS for SelfCap Button_0 30 AKS for SelfCap Button_1 93 AKS for MutualCap Slider In designs, where the sensors are close together or configured for high sensitivity, multiple sensors might report a detect simultaneously. To allow applications to determine the intended single touch, the touch library provides the user the ability to configure a certain number of sensors in an AKS group. When a group of sensors are in the same AKS group, only the first strongest sensor will report detection. The sensor reporting detection will continue to report detection even if another sensor's delta becomes stronger. The sensor stays in detect until its delta falls below its detection threshold. If any more sensors in the AKS group are still in detect only the strongest will report detection. At a given time point, only one sensor from each AKS group is reported to be in detect. Range: NO_AKS_GROUP to AKS_GROUP_7 Default: NO_AKS_GROUP (For all Self and Mutual capacitance sensors) Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 29 6.21. Address 31-32, 94: Detect Threshold Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 31 Detect Threshold for SelfCap Button_0 32 Detect Threshold for SelfCap Button_1 94 Detect Threshold for MutualCap Slider Bit 1 Bit 0 A sensor’s detect threshold define the quantity the signal must increase above its reference level to qualify as a potential touch detect. However, the final detection confirmation must satisfy the Detect Integrator (DI) limit. Larger threshold values desensitize sensors since the signal must change more (i.e. requires larger touch) to exceed the threshold level. Conversely, lower threshold levels make sensors more sensitive. Threshold setting depends on the amount of signal swing when a sensor is touched. Usually, thicker front panels or smaller electrodes have smaller signal swing on touch, thus require lower threshold levels. Range: 3 to 255 Default: 20 (Self-capacitance), 30 (Mutual capacitance) 6.22. Address 33-34, 95: Detect Hysteresis Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 33 Detect Hysteresis for SelfCap Button_0 34 Detect Hysteresis for SelfCap Button_1 95 Detect Hysteresis for MutualCap Slider Bit 1 Bit 0 This setting is sensor detection hysteresis value. It is expressed as a percentage of the sensor detection threshold setting. When a sensor goes into detect its threshold level is reduced (by the hysteresis value) in order to avoid the sensor dither in and out of detect if the signal level is close to original threshold level. • Setting of 0 = 50% of detect threshold value (HYST_50) • Setting of 1 = 25% of detect threshold value (HYST_25) • Setting of 2 = 12.5% of detect threshold value (HYST_12_5) • Setting of 3 = 6.25% of detect threshold value (HYST_6_25) Range: HYST_6_25 to HYST_50 Default: HYST_25 (For all Self and Mutual capacitance sensors) 6.23. Address 35-36, 96: Position Resolution Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 35 Position Resolution for SelfCap Button_0 36 Position Resolution for SelfCap Button_1 96 Position Resolution for MutualCap Slider Bit 1 Bit 0 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 30 The rotor or slider needs the position resolution (angle resolution in case of rotor and linear resolution in case of slider) to be set. Resolution is the number of bits needed to report the position of rotor or slider. Range: 2 bits to 8 bits Default: 8bits (For all Self and Mutual capacitance sensors) 6.24. Address 97: Position Hysteresis Address Bit 7 Bit 6 97 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Position Hysteresis for MutualCap Slider In case of Mutual Cap, the rotor or slider needs the position hysteresis (angle hysteresis in case of rotor and linear hysteresis in case of slider) to be set. It is the number of positions the user has to move back, before touch position is reported when the direction of scrolling is changed and during the first scrolling after user press. Hysteresis can range from 0 (1 position) to 7 (8 positions). The hysteresis is carried out at 8 bits resolution internally and scaled to desired resolution; therefore at resolutions lower than 8 bits there might be a difference of 1 reported position from the hysteresis setting, depending on where the touch is detected. • Position hysteresis is not used in case of self-capacitance method sensors. Range: 0 to 7 Default: 0 (For Mutual capacitance Slider) 6.25. Address 37, 99: Detect Integration Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 37 Detect Integration for SelfCap 99 Detect Integration for MutualCap Bit 1 Bit 0 The QTouch Library features a detect integration mechanism, which confirm detection in a robust environment. The detect integration (DI) acts as a simple signal filter to suppress false detections caused by spurious events such as electrical noise. A counter is incremented each time the sensor delta has exceeded its threshold and stayed there for a specific number of acquisitions, without going below the threshold levels. When this counter reaches a preset limit (the DI value) the sensor is finally declared to be touched. If on any acquisition the delta exceeds the threshold level, the counter is cleared and the process has to start from the beginning. The DI process is applicable to a 'release' (going out of detect) event as well. For example, if the DI value is 10, the device has to exceed its threshold and stay there for 10 successive acquisitions without going below the threshold level, before the sensor is declared to be touched. Range: 0 to 255 Default: 4 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 31 6.26. Address 38, 100: Away From Touch Drift (Positive Drift) Address 6.27. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 38 Away From Touch Drift for SelfCap 100 Away From Touch Drift for MutualCap Bit 1 Bit 0 Bit 1 Bit 0 Address 39, 101: Towards Touch Drift (Negative Drift) Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 39 Towards Touch Drift for SelfCap 101 Towards Touch Drift for MutualCap Drift in a general sense means adjusting reference level (of a sensor) to allow compensation for temperature (or other factor) effect on physical sensor characteristics. Decreasing reference level for such compensation is called Negative drift and increasing reference level is called Positive drift. Specifically, the drift compensation should be set to compensate faster for increasing signals than for decreasing signals. Signals can drift because of changes in physical sensor characteristics over time and temperature. It is crucial that such drift be compensated for; otherwise false detections and sensitivity shifts can occur. Drift compensation occurs only while there is no detection in effect. Once a finger is sensed, the drift compensation mechanism ceases since the signal is legitimately detecting an object. Drift compensation works only when the signal in question has not crossed the 'Detect threshold' level. The drift compensation mechanism can be asymmetric; it can be made to occur in one direction faster than it does in the other simply by changing the appropriate setup parameters. Signal values of a sensor tend to increase when an object (touch) is approaching it or a characteristic change of sensor over time and temperature. Increasing signals should not be compensated quickly, as an approaching finger could be compensated for partially or entirely before even touching the channel (towards touch drift). However, an object over the channel which does not cause detection, and for which the sensor has already made full allowance (over some period of time), could suddenly be removed leaving the sensor with an artificially suppressed reference level and thus become insensitive to touch. In the latter case, the sensor should compensate for the object's removal by raising the reference level relatively quickly (away from touch drift). Away from Touch Drift Range: 0 to 127 Default: 5 Towards Touch Drift Range: 0 to 127 Default: 20 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 32 6.28. Address 40, 102: Max On Duration Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 40 Max On Duration for SelfCap 102 Max On Duration for MutualCap Bit 1 Bit 0 The Maximum ON duration timer monitors such detections; if detection exceeds the timer's settings, the sensor is automatically recalibrated. After a recalibration has taken place, the affected sensor once again functions normally even if it still in contact with the foreign object. Max on duration can be disabled by setting it to zero (infinite timeout) in which case the channel never recalibrates during a continuous detection (but the host could still command it). Range: 0 to 255 Default: 0 6.29. Address 41, 103: Drift Hold Time Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 41 Drift Hold Time for SelfCap 103 Drift Hold Time for MutualCap Bit 1 Bit 0 Drift Hold Time (DHT) is used to restrict drift on all sensors while one or more sensors are activated. It defines the length of time the drift is halted after a key detection. This feature is useful in cases of high density keypads where touching a key or floating a finger over the keypad would cause untouched keys to drift, and therefore create a sensitivity shift, and ultimately inhibit any touch detection. Range: 1 to 255 Default: 20 6.30. Address 42, 104: Away from Touch Recalibration Delay Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 36 Away from Touch Recalibration Delay for SelfCap 78 Away from Touch Recalibration Delay for MutualCap Bit 0 If any key is found to have a significant negative delta, it is deemed to be an error condition. If this condition persists beyond away from touch recalibration delay period, then an automatic recalibration is carried out. A counter is incremented each time the sensor delta is equal to the away from touch recalibration threshold and stayed there for a specific number of acquisitions. When this counter reaches a preset limit (the PRD value) the sensor is finally recalibrated. If on any acquisition the delta is seen to be greater than the away from touch recalibration threshold level, the counter is cleared and the away from touch drifting is performed. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 33 For example, if the away from touch recalibration delay setting is 10, then the delta has to drop below the recalibration threshold and stay there for 10 acquisitions in succession without going below the threshold level, before the sensor is declared to be recalibrated. Range: 1 to 255 Default: 20 6.31. Address 43, 105: Calibration Burst Count - Seq1 Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 37 Calibration burst count - Seq1 for SelfCap 79 Calibration burst count - Seq1 for MutualCap Bit 1 Bit 0 This setting represents the total number of measurements carried out during sensor calibration. Range: 1 to 255 Default: 8 6.32. Address 44, 106: Calibration Burst Count - Seq2 Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 38 Calibration burst count - Seq2 for SelfCap 80 Calibration burst count - Seq2 for MutualCap Bit 1 Bit 0 This setting represents the total number of measurements that is considered for performing drifting reference value during sensor calibration. This value should be less than the Seq1 count value set, as this is subset of calibration operation. Range: 1 to 255 Default: 4 6.33. Address 45, 107: Recalibration Threshold Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 39 Recalibration Threshold for SelfCap 81 Recalibration Threshold for MutualCap Bit 1 Bit 0 Recalibration threshold is the level beyond which automatic recalibration occurs. Recalibration threshold is expressed as a percentage of the detection threshold setting. This setting is an enumerated value and its settings are as follows: • Setting of 0 = 100% of detect threshold (RECAL_100) • Setting of 1 = 50% of detect threshold (RECAL_50) • Setting of 2 = 25% of detect threshold (RECAL_25) • Setting of 3 = 12.5% of detect threshold (RECAL_12_5) Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 34 • Setting of 4 = 6.25% of detect threshold (RECAL_6_25) However, an absolute value of 4 is the hard limit for this setting. For example, if the detection threshold is 40 and the Recalibration threshold value is set to 4. Although this implies an absolute value of 2 (40 * 6.25% = 2.5), it is hard limited to 4. Range: RECAL_6_25 to RECAL_100 Default: RECAL_50 6.34. Address 46-47,108-109: Sensor Post-processing Mode Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 40-41 Sensor post-processing mode for SelfCap 82-83 Sensor post-processing mode for MutualCap Bit 1 Bit 0 This setting controls the touch library post-processing mode options. • Setting of 0 = TOUCH_LIBRARY_DRIVEN • Setting of 1 = TOUCH_APPLN_DRIVEN When TOUCH_LIBRARY_DRIVEN mode is selected, the library self-initiates repeated touch measurements to resolve touch press, release and calibration. This mode is suited for best response time. When TOUCH_APPLN_DRIVEN mode is selected, the library does not initiate repeated touch measurement to resolve touch press, release and calibration. This mode suits deterministic PTC interrupt execution time for applications requiring stringent CPU time requirements. Default: 0 6.35. Address 48-49, 110-111: Auto OS Signal Stability Limit Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 48-49 Auto OS signal stability limit for SelfCap 110-111 Auto OS signal stability limit for MutualCap Bit 1 Bit 0 Bit 1 Bit 0 This setting defines the stability limit of the signals for performing over-samples. Range: 1 to 1000 Default: 20 6.36. Address 50-51,112-113: Frequency Auto Tune Stability Limit Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 42-43 Frequency auto tune stability limit for SelfCap 84-85 Frequency auto tune stability limit for MutualCap This setting defines the stability limit of signals for Frequency auto tune calculation. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 35 Range: 1 to 1000 Default: 10 Note: This applies only for FREQ_MODE_HOP 6.37. Address 52,114: Frequency Auto Tune In Counter Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 44 Frequency auto tune in counter for SelfCap 86 Frequency auto tune in counter for MutualCap Bit 1 Bit 0 The DEF_XXXXCAP_FREQ_AUTO_TUNE_IN_CNT parameter is used to trigger the frequency auto tune. If sensor signal change at each frequency exceeds the value specified as DEF_XXXXCAP_ FREQ_AUTO_SIGNAL_STABILITY_LIMIT for DEF_XXXXCAP_FREQ_AUTO_TUNE_IN_CNT, then frequency auto tune will be triggered at this frequency. Range: 1 to 255 Default: 12 Note: The Frequency Auto Tune feature and related parameters are available only in FREQ_MODE_HOP mode. 6.38. Address 54-55,116-117: Noise Measurement Signal Stability Limit Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 46-47 Noise measurement signal stability limit for SelfCap 88-89 Noise measurement signal stability limit for MutualCap Bit 0 This setting defines the stability limit of signals for noise calculation. Range: 1 to1000 Default: 10 6.39. Address 56,118: Noise Measurement Noise Limit This setting uses to set the noise limit cou Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 48 Noise measurement noise limit for SelfCap 90 Noise measurement noise limit for MutualCap Bit 1 Bit 0 nter to trigger sensor lockout functionality. Range: 1 to 255 Default: 12 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 36 6.40. Address 57,119: Noise Measurement Sensor Lockout Setting Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 49 Noise measurement sensor lockout setting for SelfCap 91 Noise measurement sensor lockout setting for MutualCap Bit 0 This setting defines noisy senor lockout setting when the measured noise exceeds the noise limit and does not report a touch. • Setting of 0 = SINGLE_SENSOR_LOCKOUT • Setting of 1 = GLOBAL_SENSOR_LOCKOUT • Setting of 2 = NO_LOCKOUT Default: 0 6.41. Address 58,120: Noise Measurement Lockout Count Down Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 50 Noise measurement lockout count down for SelfCap 92 Noise measurement lockout count down for MutualCap Bit 0 If the sensor signal moves from noisy to a good condition and stays there for a ‘Lockout Countdown’ number of measurements, the sensor is unlocked and sensors are ready for touch detection and drifting is enabled. Note: This parameter is valid only for global lockout. Range: 1 to 255 Default: 10 6.42. Address 122 – 125: SelfCap Signal Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 122 SelfCap Button_0 – Signal LSB 123 SelfCap Button_0 – Signal MSB 124 SelfCap Button_1 – Signal LSB 125 SelfCap Button_1 – Signal MSB Bit 1 Bit 0 Addresses 122 – 125 allow signal data to be read for self-capacitance buttons. There are two bytes of data for each button. The 16-bit signal which is accessed as two 8-bit bytes, stored LSB first. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 37 6.43. Address 126 – 129: SelfCap Reference Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 126 SelfCap Button_0 – Reference LSB 127 SelfCap Button_0 – Reference MSB 128 SelfCap Button_1 – Reference LSB 129 SelfCap Button_1 – Reference MSB Bit 1 Bit 0 Addresses 126 – 129 allow reference data to be read for self-capacitance buttons. There are two bytes of data for each button. The 16-bit reference which is accessed as two 8-bit bytes, stored LSB first. 6.44. Address 130-137: MutualCap Signal Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 130 MutualCap Slider Channel_0 – Signal LSB 131 MutualCap Slider Channel_0 – Signal MSB 132 MutualCap Slider Channel_1 – Signal LSB 133 MutualCap Slider Channel_1 – Signal MSB 134 MutualCap Slider Channel_2 – Signal LSB 135 MutualCap Slider Channel_2 – Signal MSB 136 MutualCap Slider Channel_3 – Signal LSB 137 MutualCap Slider Channel_3 – Signal MSB Bit 1 Bit 0 Addresses 130 – 137 allow signal data to be read for each channel of mutual capacitance slider. There are two bytes of data for each channel. The 16-bit signal which is accessed as two 8-bit bytes, stored LSB first. 6.45. Address 138-145: MutualCap Reference Address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 138 MutualCap Slider Channel_0 – Reference LSB 139 MutualCap Slider Channel_0 – Reference MSB 140 MutualCap Slider Channel_1 – Reference LSB 141 MutualCap Slider Channel_1 – Reference MSB 142 MutualCap Slider Channel_2 – Reference LSB 143 MutualCap Slider Channel_2 – Reference MSB 144 MutualCap Slider Channel_3 – Reference LSB 145 MutualCap Slider Channel_3 – Reference MSB Bit 1 Bit 0 Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 38 Addresses 138– 145 allow reference data to be read for each channel of mutual capacitance slider. There are two bytes of data for each channel. The 16-bit reference which is accessed as two 8-bit bytes, stored LSB first. Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 39 7. References • • • • • • SAM D20 PTC User Guide - http://www.atmel.com/Images/Atmel-42195-Qtouch-Library-PeripheralTouch-Controller_User-Guide.pdf Atmel SAM D20 Xplained Pro User Guide - http://www.atmel.com/images/atmel-42102-samd20xplained-pro_user-guide.pdf Atmel AVR3009: Driving QTouch Device with IIC Interface - http://www.atmel.com/images/ doc42064.pdf Atmel QTouch Library User Guide - http://www.atmel.com/Images/doc8207.pdf ATSAMD20J18 device datasheet - http://www.atmel.com/Images/Atmel-42129-SAMD20_Datasheet.pdf Atmel AT03665: ASF Manual (SAM D20) - http://www.atmel.com/images/atmel-42139-asf-manualsam-d20_application-note_at03665.pdf Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 40 8. Revision History Doc Rev. Date Comments 42325C 04/2016 Revised for QTouch Library 5.8 42325B 01/2015 Revised for QTouch Library 5.4 42325A 06/2014 Initial document release Atmel AT08774: SAM D20 PTC with I2C Slave [APPLICATION NOTE] Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 41 Atmel Corporation © 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 | www.atmel.com 2016 Atmel Corporation. / Rev.: Atmel-42325C-SAM-D20-PTC-with-I2C-Slave_Application Note-04/2016 ® ® ® Atmel , Atmel logo and combinations thereof, Enabling Unlimited Possibilities , QTouch and others are registered trademarks or trademarks of Atmel Corporation in ® ® ® U.S. and other countries. ARM , Cortex , ARM Connected logo, and others are the registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others. DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.