Azoteq IQ Switch - ProxSense Series Design Manual

Multi-channel integrated proximity sensor with micro-processor core
Hide thumbs Also See for IQ Switch - ProxSense Series:

Advertisement

Quick Links

IQS316 Design Guide

®
®
IQ Switch
- ProxSense
Series
Multi-channel Integrated Proximity Sensor with Micro-Processor Core
This design guide provides a description of the communication interface between the master and
the IQS316 controller. The Memory Map of the IQS316 is provided in this document, followed by a
2
description of each register and instruction. The IQS316 communicates in I
C or SPI mode, both
using a Memory Mapped structure. The last section of this document is dedicated to an example
implementation and provides example code.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IQ Switch - ProxSense Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Azoteq IQ Switch - ProxSense Series

  • Page 1: Iqs316 Design Guide

    IQS316 Design Guide ® ® IQ Switch - ProxSense Series Multi-channel Integrated Proximity Sensor with Micro-Processor Core This design guide provides a description of the communication interface between the master and the IQS316 controller. The Memory Map of the IQS316 is provided in this document, followed by a description of each register and instruction.
  • Page 2: Table Of Contents

    Contents IQS316 Design Guide ..............................1 Memory Map ..............................4 General Memory Map Structure ........................4 IQS316 Memory Map ............................5 1.2.1 Device Information ............................5 1.2.2 Device Specific Data ............................6 1.2.3 Proximity Status Bytes ..........................6 1.2.4 Touch Status Bytes ............................6 1.2.5 Halt Bytes ..............................
  • Page 3 3.2.8 IQS316_Write .............................. 44 3.2.9 IQS316_End_Comms_Window ........................45 3.2.10 Comms_Error ............................46 3.2.11 C byte write ............................46 3.2.12 Read with NACK ............................47 3.2.13 Read with ACK ............................47 3.2.14 C START ..............................48 3.2.15 C STOP ..............................48 3.2.16 SPI Receive/Transmit ..........................
  • Page 4: Memory Map

    1 Memory Map 1.1 General Memory Map Structure ® A general I C and SPI Memory Map is defined so that all ProxSense devices can use a standard framework. The general mapping is shown below. IQS316 Memory Mapping Table 1.1 Address Access Size(Bytes)
  • Page 5: Iqs316 Memory Map

    1.2 IQS316 Memory Map 1.2.1 Device Information Address Product Number Access Value 27 (Decimal) Address Version Number Access Value Variable Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 5 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 6: Device Specific Data

    Name If Group = 4 CH19 CH18 CH17 CH16 *Note: This byte is not used for Group 0 (Prox Mode) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 6 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 7: Halt Bytes

    Access Value Variable (HIGH byte) Note CH0 (Group0) / CH4 (Group1) / CH8 (Group2) / CH12 (Group3) / CH16 (Group4) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 7 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 8 Access Value Variable (HIGH byte) Note CH2 (Group0) / CH6 (Group1) / CH10 (Group2) / CH14 (Group3) / CH18 (Group4) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 8 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 9: Long-Term Averages And Thresholds

    Variable (HIGH byte) Access Default Note CH0 (Group0) / CH4 (Group1) / CH8 (Group2) / CH12 (Group3) / CH16 (Group4) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 9 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 10 Variable (HIGH byte) Access Default Note CH2 (Group0) / CH6 (Group1) / CH10 (Group2) / CH14 (Group3) / CH18 (Group4) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 10 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 11: Device Settings

    Address UI Settings 0 (UI_SETTINGS0) Access Name RESEED ATI_MODE PROX TOUCH FORCE FORCE RANGE RANGE PROX TOUCH MODE MODE Default Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 11 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 12 If Group = 2 CH11 CH10 If Group = 3 CH15 CH14 CH13 CH12 If Group = 4 CH19 CH18 CH17 CH16 Default Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 12 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 13 If Group = 0 If Group = 1 If Group = 2 If Group = 3 CH13 If Group = 4 CH17 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 13 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 14 SHLD0 Default * Note this byte will be ignored if SHIELD_EN (PROX_SETTINGS_2<6>) is set (i.e. if automated shield is selected). Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 14 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 15 AC Filter isn‟t sampled at the optimal frequency, and is thus less effective. Address Individual Channel Disable (CHAN_ACTIVE1) Access Name Default Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 15 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 16 CH18 CH17 CH16 Default Address Individual Channel Reseed (CHAN_RESEED0) Access Name Default Address Individual Channel Reseed (CHAN_RESEED1) Access Name Default Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 16 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 17 04H (giving a Target value of = 1024 decimal) Address Auto ATI Target Access Value Variable (LOW Byte) Default 00H (giving a Target value of = 1024 decimal) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 17 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 18: Memory Map Description

    ATI_BUSY: Status of automated ATI routine 0 = Auto ATI is not busy 1 = Auto ATI in progress Bit 1: RESEED_BUSY: Global Channel Reseed Status Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 18 of 54 All Rights Reserved. Revision 0.04...
  • Page 19: Proximity Status Bytes

    Current Samples The Current Samples for the current group can be read in their respective addresses. The HIGH bytes and LOW bytes are found in consecutive addresses. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 19 of 54 All Rights Reserved.
  • Page 20: Long-Term Averages & Touch/Prox Thresholds

    PROX_RANGE = 1 Prox Threshold <1:0> Prox Threshold 8 (default) LTA LOW Byte Bit 7-0: LTA<7:0>: The lower byte of the LTA. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 20 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 21: Device Settings

    0 = Disable noise detection 1 = Enable noise detection Bit 0: Internal: This bit should always keep the value of 0 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 21 of 54 All Rights Reserved. Revision 0.04...
  • Page 22 This input allows the timing of the conversions to be accurately controlled. Possibly the conversions can be sliced between noise events to keep the samples noise free. 0 = No Zero-Cross signal implemented Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 22 of 54 All Rights Reserved.
  • Page 23 Unused Bit 6: SHIELD_EN: Automatic shield implementation. Each group will have a shield setup automatically on the two shield outputs, according to Table 1.6. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 23 of 54 All Rights Reserved.
  • Page 24 LTN_DISABLE: Disable the LTN Filter on Group 0. 0 = LTN Filter is enabled 1 = LTN Filter is disabled (recommended due to device limitation) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 24 of 54 All Rights Reserved.
  • Page 25 SHLD_A and SHLD_B. By default the shields are disabled with SHLD_SETTINGS = 0. Manual configuration is implemented as shown in Table 1.7. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 25 of 54 All Rights Reserved. Revision 0.04...
  • Page 26 CX_GPIO_0: Cx or I/O selection. 0 = CxA5, CxA4, CxB5 and CxB4 are used as sensor lines 1 = GPIO_3, GPIO_2, GPIO_1 and GPIO_0 are implemented as I/O‟s Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 26 of 54 All Rights Reserved.
  • Page 27 It can be seen that if all 4 bits are set, all 16 of the Cx sensor lines are antenna inputs for the Prox Mode. It is recommended that if the design has any sensor buttons close to noise Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 27 of 54 All Rights Reserved.
  • Page 28 I/O Tris register as shown in Table 1.12. If used as Cx‟s, the TRIS must be set as inputs! Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 28 of 54 All Rights Reserved.
  • Page 29: General Implementation Hints

    The following procedures are for setup of specific features of the IQS316 that requires more attention. More features can be setup by setting the appropriate registers as required. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 29 of 54 All Rights Reserved.
  • Page 30: Individual Prox And Touch Thresholds

    After sending initial settings to the IQS316, it is recommended to execute a reseed. If the Auto ATI was done last, it may not be necessary to reseed. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 30 of 54 All Rights Reserved.
  • Page 31: General I C Hints

    IQS316, and then processed. 3.1.1 Communications: For a detailed description of the communication protocol refer to the IQS316 datasheet. SPI: Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 31 of 54 All Rights Reserved. Revision 0.04...
  • Page 32 Master writes FEH to IQS316 (pointer incremented, data stored at 15H returned) Master writes FFH to IQS316. (End read cycle, data stored at 16H returned) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 32 of 54 All Rights Reserved.
  • Page 33: Functions

    IQS316 (this should not occur if power is stable, and the MCLR is not pulled low). It is also confirmed that the SHOW_RESET bit does clear, otherwise another debugging error hook is executed. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 33 of 54 All Rights Reserved.
  • Page 34 // occurred on the IQS316, and we should repeat the setup ui8DataArray[0] = (ACK_RESET | LTN_DISABLE | WDT_DISABLE); IQS316_Write(PROX_SETTINGS_2, ui8DataArray, 1); IQS316_End_Comms_Window(); #ifdef DEBUG_IQS316 IQS316_Read(UI_FLAGS0, ui8DataArray, 1); IQS316_End_Comms_Window(); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 34 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 35 = PROX_THRES_8; // LTA_26_HI ui8DataArray[5] = 0x00; // low byte - irrelevant ui8DataArray[6] = PROX_THRES_8; // LTA_37_HI IQS316_Write(LTA_04_HI, ui8DataArray, 7); break; Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 35 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 36 = 0x00; // low byte - irrelevant ui8DataArray[4] = PROX_THRES_20 | TOUCH_THRES_3_16; // LTA_26_HI ui8DataArray[5] = 0x00; // low byte - irrelevant Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 36 of 54 All Rights Reserved. Revision 0.04...
  • Page 37 IQS316_Write(AUTO_ATI_TARGET_HI, ui8DataArray, 2); IQS316_End_Comms_Window(); // Perform automated ATI routine (to setup ATI Compensation values) ui8DataArray[0] = CXVSS | HALT0 | AUTO_ATI | CXDIV1; Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 37 of 54 All Rights Reserved. Revision 0.04...
  • Page 38: Iqs316_Refresh_Data

    // Make sure an unexpected reset has not occurred if((ui8TempUIFlags0 & SHOW_RESET) != 0) // handle reset here, suggestion is to repeat IQS316 init IQS316_Settings(); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 38 of 54 All Rights Reserved.
  • Page 39: Iqs316_Process_Data

    3.2.3 IQS316_Process_Data A short example function is added here, and converts the key pressed to a binary number which is displayed on 4 I/O pins. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 39 of 54 All Rights Reserved.
  • Page 40: Main Function (I C And Spi)

    Main Function void main(void) init(); while(1) // Get data from latest comms window IQS316_Refresh_Data(); // Process this new data accordingly IQS316_Process_Data(); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 40 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 41: Comms_Init

    The communication window is NOT closed after this read function. Listing 7. IQS316_Read Function (I void Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 41 of 54 All Rights Reserved. Revision 0.04...
  • Page 42 // first. So this should not be called, during debugging use this // function to correct any comms issues. Comms_Error(); // Send specific address to read from (ignore returned data) CommsIQS316_send(ui8Address); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 42 of 54 All Rights Reserved. Revision 0.04...
  • Page 43: Iqs316_Readcurrentaddress

    IQS316_ReadCurrentAddress(uint8_t *ui8Data, uint8_t ui8Length) uint8_t ui8Header, i; // Writing a 0x01 on MOSI requests a READ operation ui8Header = CommsIQS316_send(0x01); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 43 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 44: Iqs316_Write

    = 0 ; i < ui8Length ; i++) CommsIQS316_send(ui8Data[i]); Listing 12. IQS316_Write Function (SPI) void IQS316_Write(uint8_t ui8Address, uint8_t *ui8Data, uint8_t ui8Length) uint8_t ui8Header, i; Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 44 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 45: Iqs316_End_Comms_Window

    Listing 14. IQS316_End_Comms_Window Function (SPI) void IQS316_End_Comms_Window(void) uint8_t ui8Header; // Writing a 0x00 on MOSI requests a WRITE operation ui8Header = CommsIQS316_send(0x00); Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 45 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 46: Comms_Error

    Send a byte and wait for the acknowledge. Listing 16. CommsIQS316_send (I void CommsIQS316_send(uint8_t send_data) SSPBUF = send_data; while (PIR1bits.SSPIF == 0) PIR1bits.SSPIF = 0; //clear flag Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 46 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 47: Read With Nack

    PIR1bits.SSPIF = 0; //clear flag while (SSPSTATbits.BF == 0) temp = SSPBUF; SSPCON2bits.ACKDT = 0; SSPCON2bits.ACKEN = 1; while (PIR1bits.SSPIF == 0) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 47 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 48: I 2 C Start

    This function receives a data byte on the SOMI line, and at the same time transmits a data byte on the MOSI line. Listing 21. CommsIQS316_RxTx (SPI) uint8_t CommsIQS316_RxTx(uint8_t ui8SendData) Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 48 of 54 All Rights Reserved. Revision 0.04...
  • Page 49: Constant Declarations

    #define HALT_STAT 0x39 #define GROUP_NUM 0x3D #define CUR_SAM_04_HI 0x42 #define CUR_SAM_04_LO 0x43 #define CUR_SAM_15_HI 0x44 #define CUR_SAM_15_LO 0x45 #define CUR_SAM_26_HI 0x46 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 49 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 50 #define NOISE 0x01 // TOUCH THRESHOLDS // with touch LOW range selected #define TOUCH_THRES_1_32 0x00 #define TOUCH_THRES_1_16 0x40 #define TOUCH_THRES_2_16 0x80 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 50 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 51 #define ACK_RESET 0x10 #define SKIP_CONV 0x08 #define ACF_DISABLE 0x04 #define LTN_DISABLE 0x02 #define WDT_DISABLE 0x01 // CX_CONFIG #define CX_GPIO_1 0x80 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 51 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 52 #define CX_GPIO_0 0x40 // unused 0x20 // unused 0x10 #define GROUP4 0x08 #define GROUP3 0x04 #define GROUP2 0x02 #define GROUP1 0x01 Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 52 of 54 All Rights Reserved. Revision 0.04 December 2013...
  • Page 53 Added links to make ease document navigation v0.04 Changes  Major changes done to the Example and SPI firmware. All relevant sections updated. Copyright © Azoteq (Pty) Ltd 2013 IQS316 Design Guide Page 53 of 54 All Rights Reserved. Revision 0.04...
  • Page 54 Azoteq makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Azoteq products are not authorized for use as critical components in life support devices or systems. No licenses to patents are granted, implicitly, express or implied, by estoppel or otherwise, under any intellectual property rights.

This manual is also suitable for:

Iqs316

Table of Contents