RM0005 Reference manual
QST standard communication protocol
Introduction
This manual provides details on the three possible communication interfaces which are offered by QST devices:
Inter-Integrated Circuit (I2C) Serial Peripheral Interface (SPI) Input/Output lines (I/O)
In addition, it describes the QST Standard Communication Protocol used to communicate between a QST (Slave) device and its Master device. This protocol ensures correct data transmission between both devices. It is built around a specific command set to offer more flexibility and system configurability.
November 2007
Rev 2
1/39
www.st.com
Contents
RM0005
Contents
1 2 QST device architecture overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 I/O interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 2.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Optional signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3
SPI interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 3.2 3.3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Packet encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Optional signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3.1 3.3.2 SPI_SS signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 SPI_IRQ signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4
I2C interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.1 4.2 4.3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Packet encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Optional signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3.1 I2C_IRQ signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5
Protocol description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1 5.2 5.3 5.4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Command packet format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Response packet format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Specific Command and Response fields . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.4.1 5.4.2 5.4.3 8-bit checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Parity bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6
Command description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.1 Command summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.1.1 6.1.2 Shor t Command set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Extended Command set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2
Shor t Command set description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2/39
RM0005 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.2.9 6.2.10 6.2.11 6.2.12
Contents GET_PROTOCOL_VERSION command . . . . . . . . . . . . . . . . . . . . . . . . 13 GET_DEVICE_INFO command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 SET_MAX_ON_DURATION command . . . . . . . . . . . . . . . . . . . . . . . . . 15 SET_LOW_POWER_MODE command . . . . . . . . . . . . . . . . . . . . . . . . . 15 SET_KEY_ACTIVATION command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 CALIBRATE_KEY command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 SET_GPIO_MODE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 GET_KEY_STATE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 GET_KEY_ERROR command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 GET_GPIO_STATE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 GET_DEBUG_INFO command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 RESET_DEVICE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.3
Extended Command set description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 SET_KEY_GROUP command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 SET_SCKEY_PARAMETERS command . . . . . . . . . . . . . . . . . . . . . . . 28 SET_MCKEY_PARAMETERS command . . . . . . . . . . . . . . . . . . . . . . . 29 SET_DETECT_INTEGRATORS command . . . . . . . . . . . . . . . . . . . . . . 31 SET_DRIFT_COMPENSATION command . . . . . . . . . . . . . . . . . . . . . . 32 SET_GPIO_STATE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 SET_PWM_MODE command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Appendix A Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3/39
QST device architecture overview
RM0005
1
QST device architecture overview
The Table 1 provides an overview of a QST (Slave) device:
Capacitive Sensing Engine: this handles the management of the keys. Command Interpreter: it interprets the commands received from the Master device. It posts the corresponding requests to the Capacitive Sensing Engine and transmits the responses to the Master device through the dedicated interface. I/O Interface: it simply manages specific I/Os in output mode to report the state of the different keys. SPI Interface: it implements a basic protocol to format the Serial Peripheral Interface (SPI) bus communication in QST command format. I2C Interface: it implements a basic protocol to format the Inter-Integrated Circuit (I2C) bus communication in QST command format. QST block diagram
QST (Slave) Device Capacitive Sensing Engine
Figure 1.
Command Interpreter
I/O Interface
SPI Interface
I2C Interface
SPI_MISO
SPI_MOSI
IO_SYNC
SPI_SCK
I2C_SDA
I2C_SCL
SPI_IRQ
I2C_IRQ
SPI_SS
Unidirectional multi-line communication
Master Device
Ai12566a
4/39
RM0005
I/O interface
2
2.1
I/O interface
Overview
The I/O interface is the most basic interface offered by a QST device. As a result, no command mechanism is allowed. The QST device reports the system state via dedicated outputs (KOUTx). Depending on the device, several possible formats are available: Direct I/O or Encoded I/O (binary-coded for example). An optional extra line (IO_SYNC) from the Master device to the QST (Slave) device may be added. This line acts as a synchronization signal forcing the QST (Slave) device to acquire sensing channels.
2.2
Optional signal
The IO_SYNC line allows a basic communication signal to synchronize the acquisition of the sensing channels with the Master device. The Master device must generate a pulse at logical level 0 for more than 2 s and less than 4 s. The falling edge of the IO_SYNC signal results in Slave acquisition.
5/39
SPI interface
RM0005
3
3.1
SPI interface
Overview
The SPI interface is bidirectional and supports the complete command set described in Section 6: Command description. This interface consists of the following hardware signals:
SPI_SCK: clock used to synchronize data. SPI_MISO: data transfer line from QST (Slave) device to Master device. SPI_MOSI: data transfer line from Master device to QST (Slave) device. SPI_SS: Slave Select line (optional). It can be tied low to permanently select the QST device on the SPI bus. SPI_IRQ: bidirectional interrupt line (optional). This is an open drain output with a weak pull-up.
The SPI interface supports a clock frequency up to 100 kHz. This frequency is called 'Low Speed'. Phase and Polarity signals are respectively CPHA = 1 and CPOL = 1.
3.2
Packet encapsulation
As described in Section 5: Protocol description, the Master initiates communications at any time which are completed by the QST (Slave) device. During Idle state, SPI_SCK is low and data lines are high. As soon as SPI_SCK toggles, the Master sends Command packet bytes. After transmission of the complete Command packet, the SPI_MOSI continues to remain high continuously and the SPI_SCK can continue to clock the system or not. When the Master wants to receive the Response packet, it must generate the SPI_SCK. Within 16 bytes after receiving a Command packet, the QST (Slave) device must return a valid Response packet. While waiting to send the Response packet, the QST device continuously returns a dummy response (data bytes containing 0xFF) to the Master. If the Master receives 16 or more dummy response bytes, it should consider the QST (Slave) device as defective.
3.3
3.3.1
Optional signals
SPI_SS signal
When available on the QST (Slave) device, the Slave Select (SPI_SS) signal must be enabled (tied low) before any communication and must be kept low during the entire transaction process: from the beginning of the Command packet to the end of the Response packet.
6/39
RM0005
SPI interface
3.3.2
SPI_IRQ signal
This is a bidirectional signal with two different significations:
From the Master device to the QST (Slave) device: this is the SYNC signal. It synchronizes the acquisition of the sensing channels with the Master device From QST (Slave) device to the Master device: this is the IRQ signal. It informs the Master that a change has occurred in the QST (Slave) device state.
In Idle mode, the line is a logical level 1.
Master signal considerations
The Master device must generate a pulse at logical level 0 for more than 2 s and less than 4 s. Before and after this pulse generation, the Master must verify that the line is in Idle state. If it is not the case, it must wait for the Idle state to generate a valid SYNC signal. During the Idle state, the Master device monitors the line for an IRQ signal from QST (Slave) device. The falling edge of the SYNC signal results in Slave acquisition.
Slave signal considerations
The QST (Slave) device must generate a pulse at logical level 0 for more than 10 s and less than 15 s. It does not need to verify the line state before or after the pulse. During the Idle state, the QST (Slave) device monitors the line for the SYNC signal from the Master device. The falling edge or the signal level verification before or after the SYNC signal must be used to detect an IRQ signal.
7/39
I2C interface
RM0005
4
4.1
I2C interface
Overview
The Inter-Integrated Circuit (I2C) interface is bidirectional and supports the complete command set described in Section 6: Command description. This interface consists of the following hardware signals:
I2C_SCL: I2C clock to synchronize data (from Master to Slave). I2C_SDA: bidirectional data transfer line. I2C_IRQ: bidirectional interrupt line (optional). This is an open drain output with a weak pull-up. 100 kHz: 'Low Speed' frequency (Default setting, must always be supported.) 400 kHz: 'High Speed' frequency
The I2C interface supports up two different I2C clock frequencies:
4.2
Packet encapsulation
As described in Section 5: Protocol description, the Master initiates communications at any time which are completed by the QST (Slave) device. During Idle state, I2C_SCL and I2C_SDA are high in compliance with standard I2C communications. As a consequence, each byte is transmitted in 9 clock cycles (8 bits + acknowledge). In case of a Non-Acknowledge signal on the bus, the complete transaction is discarded (Command and Response). As a consequence, a stop bit is generated by the Master and the system returns to the Idle state. The command is then ignored. The Master device can initiate a new communication. The I2C Address is generated on the I2C bus as an extra byte (7-bit address) at the beginning of a Command and a Response packet. After the complete Command packet has been sent, the I2C_SCL can continue to clock the system or not. When the Master wants to receive the Response packet, it must activate the I2C_SCL. Waiting for the Response packet, the Master receives from the Slave a dummy response (data bytes containing 0xFF). The Slave must send a valid Response packet within 16 bytes after the end of the Command packet. If the Master receives 16 or more dummy response bytes, it must consider the Slave as defective.
4.3
4.3.1
Optional signals
I2C_IRQ signal
This is the same signal as SPI_IRQ (see Section 3.3.2: SPI_IRQ signal).
8/39
RM0005
Protocol description
5
5.1
Protocol description
Introduction
To ensure correct data transmission between Master and Slave devices, a standard communication protocol has been defined. This protocol formats the content of Master and Slave packets. The Master device initiates all communications by sending a Command packet. The Slave answers with a Response packet containing an ACK token if the data is ready or a STALL token if the command generates an error. After a reset of the QST (Slave) device, all commands are stalled except GET_DEVICE_INFO.
5.2
Command packet format
Two types of Master Command packets are supported:
Shor t Command packet used to send a basic and fast command to the QST (Slave) device with an optional short argument. Extended Command packet used to send complex commands to the QST (Slave) device with longer arguments.
The QST device identifies a short Command when Bit 7 of Command Byte 0 is set to `1'. This usually means a 1-byte command (no argument). In this case, the Argument bit is set to `0' and both the argument and the checksum fields are not sent (Table 1). Table 1.
Byte No. 0
Short Command packet format without argument
Bit 7 1 Bit 6 Bit 5 Bit 4 Command ID Bit 3 Bit 2 Bit 1 Argument bit = 0 Bit 0 Parity bit
If the Argument bit is set to `1', the short Command packet contains 3 bytes which includes an argument and a checksum fields (Table 2). Table 2.
Byte No. 0 1 2
Short Command packet format with argument
Bit 7 1 Bit 6 Bit 5 Bit 4 Command ID Command argument 8-bit checksum Bit 3 Bit 2 Bit 1 Argument bit = 1 Bit 0 Parity bit
9/39
Protocol description
RM0005
The QST device identifies an extended Command when Bit 7 of Command Byte 0 is set to `0'. The minimum length of this Command is 4 bytes. Argument and checksum fields are mandatory (Table 3). Table 3.
Byte No. 0 1 2 Length +2
Extended Command packet format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Command ID Length of `Command arguments' field Command arguments 8-bit checksum Bit 2 Bit 1 Bit 0
5.3
Response packet format
The QST device (Slave) replies to a Command packet with a Response packet. The Response packet begins with either:
ACK token (Bit 7 of Byte 0 is set to `0') if the data are ready to be sent. STALL token (Bit 7 of Byte 0 is set to `1') if the command generates an error.
The ACK token length depends on the command. Its minimum length is 1 byte (Table 4). The STALL token consists of one byte which includes an error code (Table 6). Table 4.
Byte No. 0
ACK short response packet format
Bit 7 ACK token = 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1
0 0 00b
Or : Table 5.
Byte No. 0 1
ACK extended response packet format
Bit 7 ACK token =0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit
Length of `Response data' field Response data
Length +1
8-bit checksum
Or : Table 6.
Byte No. 0
STALL response packet format
Bit 7 STALL token = 1 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit
Error Code
10/39
RM0005
Protocol description
5.4
5.4.1
Specific Command and Response fields
8-bit checksum
The 8-bit checksum used in Command and Response packets is the 8 least significant bits of the addition of all the packet bytes (except the checksum itself).
5.4.2
Parity bit
The parity bit embedded in the first byte of the packet causes the number of bits set to `1' in this byte to be odd. Example: 0x83 (STALL token = `1', error code 0x01, Parity bit set to `1').
5.4.3
Error code
This is the code associated with the STALL token. Table 7 lists the legal values and significations for this field. All other values must be interpreted as an unknown error. Table 7. Error codes associated with STALL token
Signification COMMAND_NOT_SUPPORTED PARAMETER_NOT_SUPPORTED PARITY_ERROR CHECKSUM_ERROR INITIALIZATION_PROCESS v1.0 x x x x x Error Code (6 bits) 0x01 0x02 0x10 0x11 0x30 STALL packet value (8 bits) 0x83 0x85 0xA1 0xA3 0xE0
11/39
Command description
RM0005
6
6.1
Command description
Command summary
These command sets are supported when using both I2C and SPI communication interfaces. In I/O mode, the QST device is automatically configured and the settings cannot be dynamically changed.
6.1.1
Short Command set
Table 8. Short Command set
Command GET_PROTOCOL_VERSION GET_DEVICE_INFO SET_MAX_ON_DURATION SET_LOW_POWER_MODE SET_KEY_ACTIVATION CALIBRATE_KEY SET_GPIO_MODE GET_KEY_STATE GET_KEY_ERROR GET_GPIO_STATE GET_DEBUG_INFO RESET_DEVICE
1. M: Mandatory and O: Optional
v1.0 (1) O M O O O M O O M M O O O O
Command ID (5 bits) 0x00 0x01 0x02 0x04 0x05 0x06 0x06 0x07 0x10 0x11 0x11 0x12 0x1D 0x1F
Argument bit 0 0 1 1 1 0 1 1 0 0 1 0 0 1 0
Command byte 0x80 0x85 0x8A 0x92 0x97 0x98 0x9B 0x9E 0xC1 0xC4 0xC7 0xC8 0xF4 0xF7 0xFD
6.1.2
Extended Command set
Table 9. Extended Command set
Command SET_KEY_GROUP SET_SCKEY_PARAMETERS SET_MCKEY_PARAMETERS SET_DETECT_INTEGRATORS SET_DRIFT_COMPENSATION SET_GPIO_STATE SET_PWM_MODE
1. M: Mandatory and O: Optional
v1.0 (1) O O O O O O O
Command ID (7 bits) 0x00 0x01 0x02 0x03 0x04 0x08 0x09
12/39
RM0005
Command description
6.2
6.2.1
Short Command set description
GET_PROTOCOL_VERSION command
Command role
This is a Short Command without an argument. This command returns the QST standard communication protocol version supported by the QST (Slave) device.
Master to Slave request
Table 10.
Byte No. 0
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 0 0 0b Bit 3 Bit 2 Bit 1 0 Bit 0 0
Slave to Master ACK response
In case of success, the Slave returns the packet described in Table 11. Table 11.
Byte No. 0 1 2 3 4
Slave to Master ACK response format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1
000011b Main version of protocol Sub version of protocol Serial bus speed 8-bit checksum
Protocol version Main and Sub version of the QST communication protocol implemented in the current device. These numbers are BCD-coded. Serial bus speed Defines the maximum speed frequency supported by the QST device: 0x00: 100 kHz 'Low Speed' frequency (Default setting, always supported.) 0x01: 400 kHz 'Full Speed'
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parity error
13/39
Command description
RM0005
6.2.2
GET_DEVICE_INFO command
Command role
This is a Short Command without an argument. This command returns the QST (Slave) device information: version, number of SCkey and MCkey, etc.
Master to Slave request
Table 12.
Byte No. 0
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 00001b Bit 3 Bit 2 Bit 1 0 Bit 0 1
Slave to Master ACK response
In case of success, the Slave returns the packet described in Table 13. The Slave must report at least the 4 first data bytes (minimum packet size is 6 bytes). Table 13.
Byte No. 0 1 2 3 4 5
Slave to Master ACK response format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit
Length = N Device main version Device sub-version Number of single-channel keys Number of multi-channel keys String info for system recognition (optional)
N+1
8-bit checksum
Device version Main and sub- version of the current device. These numbers are BCD-coded. Number of Single- or Multi-channel keys The number of single-channel or multi-channel (slider/wheel) keys, in hexadecimal format.
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parity error
14/39
RM0005
Command description
6.2.3
SET_MAX_ON_DURATION command
Command role
This is a Short Command with argument. This command defines the Max On-Duration parameter. This is the maximum duration in seconds a key can be considered Active. This setting is applied to all keys.
Master to Slave request
Table 14.
Byte No. 0 1 2
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 00010b MaxOnDuration 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 0
MaxOnDuration The MaxOnDuration value must be between 1 to 255 seconds, in hexadecimal format. If 0x00, it is considered as infinite.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.4
SET_LOW_POWER_MODE command
Command role
This is a Short Command with argument. This command defines the low power mode of the QST (Slave) device.
Master to Slave request
Table 15.
Byte No. 0 1 2
Master to Slave request format
Bit 7 1 Device Free Run Frequency in Detect Bit 6 Bit 5 Bit 4 00100b Sleep Duration Factor 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 0
15/39
Command description Device Frequency Defines the QST device operating frequency.
RM0005
0: Device is running at reduced frequency (default setting). 1: Device is running at maximum frequency (refer to QST device datasheet for further information). Free Run in Detect Defines how the QST device will act when a low power mode is enabled and if a touch is detected. 0: Low power mode is suspended when detection is on-going. 1: Low power mode is authorized. Sleep Duration Factor This value is between 1 and 62, in hexadecimal format. The sleep mode duration is equal to `Sleep Duration Factor' x 20 milliseconds. 0x00: Low power mode is disabled. 0x3F: Sleep is entered immediately with an infinite duration (deep sleep). The QST device is woken up at the next communication from the Master device. Please refer to QST device datasheet for further information.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.5
SET_KEY_ACTIVATION command
Command role
This is a Short Command with argument. This command enables a specific key or all keys.
Master to Slave request
Table 16.
Byte No. 0 1 2
Master to Slave request format
Bit 7 1 Enable Bit 6 Bit 5 Bit 4 00101b Key Identifier 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 1
16/39
RM0005 Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 Enable Enables selected key(s). 0: Key(s) disabled 1: Key(s) enabled 0 0 011: Key 3 ... 1111111: Key 127
Command description
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.6
CALIBRATE_KEY command
Command role
This is a Short Command with or without an argument. This command launches the calibration process for all keys or a specific key.
Master to Slave request
Table 17.
Byte No. 0
Master to Slave request format without argument
Bit 7 1 Bit 6 Bit 5 Bit 4 00110b Bit 3 Bit 2 Bit 1 0 Bit 0 0
Or: Table 18.
Byte No. 0 1 2
Master to Slave request format with argument
Bit 7 1 Reserved (0) Bit 6 Bit 5 Bit 4 00110b Key Identifier 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 1
17/39
Command description Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 0 0 011: Key 3 ... 1111111: Key 127
RM0005
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.7
SET_GPIO_MODE command
Command role
This is a Short Command with an argument. This command configures the general-purpose inputs/outputs.
Master to Slave request
Table 19.
Byte No. 0 1 2
Master to Slave request format
Bit 7 1 Control Direction Config 8-bit checksum Bit 6 Bit 5 Bit 4 00111b GPIO Identifier Bit 3 Bit 2 Bit 1 1 Bit 0 0
GPIO Identifier Unique identifier for a GPIO. 0 0 0: All GPIOs 00001: GPIO 1 00010: GPIO 2 Control, Direction and Config These bits define the output mode of the selected GPIO(s) as shown in Table 20. 00011: GPIO 3 ... 11111: GPIO 31
18/39
RM0005 Table 20. GPIO output mode selection
Command description
Configuration Output mode description Control 0 1 1 1 1 Direction x 0 0 1 1 Config x 0 1 0 1 Automatic mode, GPIO configuration is defined by the QST device (refer to QST device datasheet) Controlled mode, Input floating Controlled mode, Input interrupt with pull-up Controlled mode, Output Open drain Controlled mode, Output Push-Pull
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.8
GET_KEY_STATE command
Command role
This is a Short Command without an argument. This command returns the state of the complete system.
Master to Slave request
Table 21.
Byte No. 0
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 10000b Bit 3 Bit 2 Bit 1 0 Bit 0 1
Slave to Master ACK response
In case of success, the Slave returns the packet described in Table 22. The structure of this packet depends on the number of single- and multi-channel keys implemented in the QST device. The description of the single-channel keys comes first and then the multi-channel keys. All multi-channel keys are described in 2 steps: first the state and then the absolute position.
19/39
Command description Table 22.
Byte No. 0 1 2
RM0005 Slave to Master response format
Bit 7 0 SCK 8 state SCK 16 state SCK 7 state SCK 15 state SCK6 state SCK 14 state Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit SCK 3 state SCK 11 state SCK 2 state SCK 10 state SCK 1 state SCK 9 state
Length = N SCK 5 state SCK 13 state SCK 4 state SCK 12 state
X X+1 X+2
0
0
0
MCK3 state
MCK 2 state
MCK 1 state
SCK 18 state
SCK 17 state
Multi-channel key 1 position Multi-channel key 2 position
N N+1
Reser ved
Key error code 8-bit checksum
SCKx or MCKx state The state of the selected single- or multi-channel key. Note that the total number of single- or multi-channel keys can be obtained using the GET_DEVICE_INFO command. 0: Key is "untouched" 1: Key is "touched" Multi-channel key x position This is an 8-bit value representing the position of the slider/wheel (multi-channel key). Possible values are 0 to 255, in hexadecimal format, depending on the selected resolution. For more information, see Section 6.3.3: SET_MCKEY_PARAMETERS command on page 29. Key error code Key error code describes the errors in the system on all keys. It is a cumulative description. Bit 0: Calibration in progress Bit 1: Maximum count reached Bit 2: Minimum count not reached Bits 3 to 6: Reserved (0)
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parity error
20/39
RM0005
Command description
6.2.9
GET_KEY_ERROR command
Command role
This is a Short Command with or without an argument. This command returns the error state of the complete system or the error state of a specific key.
Master to Slave request
Table 23.
Byte No. 0
Master to Slave request format without argument
Bit 7 1 Bit 6 Bit 5 Bit 4 10001b Bit 3 Bit 2 Bit 1 0 Bit 0 0
Or: Table 24.
Byte No. 0 1 2
Master to Slave request format with argument
Bit 7 1 Reser ved (0) Bit 6 Bit 5 Bit 4 10001b Key Identifier 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 1
Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 0 0 011: Key 3 ... 1111111: Key 127
Slave to Master ACK response
In case of success, the Slave returns the packet described in Table 25 for a command without an argument or in Table 26 for a command with an argument (specific key status request). The structure of the first packet depends on the number of single- and multichannel keys implemented in the QST device. The description of the single-channel key states and errors comes first and then the multichannel key states and errors. Table 25.
Byte No. 0 1 2
Slave to Master response format
Bit 7 0 SCKey 1 State SCKey 2 State Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit
Length = N SCKey 1 Error code SCKey 2 Error code
21/39
Command description Table 25.
Byte No. x
RM0005 Slave to Master response format (continued)
Bit 7 MCKey 1 State Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
MCKey 1 Error code
N+1
8-bit checksum
Or: Table 26.
Byte No. 0 1 2
Slave to Master response format
Bit 7 0 yCKey x State Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0
0 0 01b yCKey x Error code 8-bit checksum
SCKey x or MCKey x State State of the selected key. 0: Key is inactive. 1: Key is active. SCKey x or MCKey x Error code Key error code describes the errors of the selected key. Bit 0: Calibration in progress Bit 1: Maximum count reached Bit 2: Minimum count not reached Bits 3 to 6: Reserved (0)
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.10
GET_GPIO_STATE command
Command role
This is a Short Command without an argument. This command returns the state of the general-purpose inputs/outputs.
22/39
RM0005
Command description
Master to Slave request
Table 27.
Byte No. 0
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 10010b Bit 3 Bit 2 Bit 1 0 Bit 0 0
Slave to Master ACK response
In case of success, the Slave returns the packet described in Table 28. The structure of this packet depends on the number of general-purpose inputs/outputs implemented in the QST device. As a consequence, rows 2 to 4 are optional. Table 28.
Byte No. 0 1 2 3 4 5
Slave to Master response format
Bit 7 0 GPIO 8 state GPIO 16 state GPIO 24 state GPIO 32 state GPIO 7 state GPIO 15 state GPIO 23 state GPIO 31 state GPIO 6 state GPIO 14 state GPIO 22 state GPIO 30 state GPIO 5 state GPIO 13 state GPIO 21 state GPIO 29 state Bit 6 Bit 5 Bit 4 N GPIO 4 state GPIO 12 state GPIO 20 state GPIO 28 state GPIO 3 state GPIO 11 state GPIO 19 state GPIO 27 state GPIO 2 state GPIO 10 state GPIO 18 state GPIO 26 state Bit 3 Bit 2 Bit 1 Bit 0 Parity bit GPIO 1 state GPIO 9 state GPIO 17 state GPIO 25 state
8-bit checksum
GPIO x Returns the GPIO x state. 0: GPIO state `0' 1: GPIO state `1'
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parity error
6.2.11
GET_DEBUG_INFO command
Command role
This is a Short Command with or without an argument. This command returns the debug information for all keys or a specific key. This information can be used to analyze the QST capacitive sensing engine.
23/39
Command description
RM0005
Master to Slave request
Table 29.
Byte No. 0
Master to Slave request format without argument
Bit 7 1 Bit 6 Bit 5 Bit 4 11101b Bit 3 Bit 2 Bit 1 0 Bit 0 0
Or: Table 30.
Byte No. 0 1 2
Master to Slave request format with argument
Bit 7 1 Reser ved (0) Bit 6 Bit 5 Bit 4 11101b Key Identifier 8-bit checksum Bit 3 Bit 2 Bit 1 1 Bit 0 1
Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 0 0 011: Key 3 ... 1111111: Key 127
Slave to Master ACK response
Note: If the debug information is larger than the maximum packet size, the information is truncated to this maximum size. For further information, please refer to QST device datasheet. For a single-channel key, in case of success, the Slave returns the packet described in Table 31. Table 31.
Byte No. 0 1 2 3 4 5 6
Slave to Master response format for single-channel key
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 1
Length = 000101b SCkey x debug state SCKey x Reference MSB SCKey x Reference LSB SCKey x Burst Count MSB SCKey x Burst Count LSB 8-bit checksum
Or: For a multi-channel key, in case of success, the Slave returns the packet described in Table 32.
24/39
RM0005 Table 32.
Byte No. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Command description Slave to Master response format for Multi-channel key
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0
Length = 001110b MCKey x debug state MCKey x 8-bit resolution position MCKey x Reference A MSB MCKey x Reference A LSB MCKey x Burst Count A MSB MCKey x Burst Count A LSB MCKey x Reference B MSB MCKey x Reference B LSB MCKey x Burst Count B MSB MCKey x Burst Count B LSB MCKey x Reference C MSB MCKey x Reference C LSB MCKey x Burst Count C MSB MCKey x Burst Count C LSB 8-bit checksum
Or: If no argument command is used or if the argument is 0x00, the Slave returns a packet containing the individual information beginning with single-channel keys and finishing with multi-channel keys (seeTable 33). The structure of this packet depends on the number of single- and multi-channel keys implemented in the QST (Slave) device. If the numbers of keys is too high, the report is shortened depending on the QST device. Table 33.
Byte No. 0 1 2 3 4 5 6 7 8
Slave to Master response format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Parity bit
Length = N SCkey 1 debug state SCKey 1 Reference MSB SCKey 1 Reference LSB SCKey 1 Burst Count MSB SCKey 1 Burst Count LSB SCkey 2 debug state SCKey 2 Reference MSB SCKey 2 Reference LSB
M
MCKey 1 debug state
25/39
Command description Table 33.
Byte No. M+1 M+2 M+3 M+4 M+5 M+6 M+7 M+8 M+9 M + 10 M + 11 M + 12 M + 13
RM0005 Slave to Master response format (continued)
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
MCKey 1 8-bit resolution position MCKey 1 Reference A MSB MCKey 1 Reference A LSB MCKey 1 Burst Count A MSB MCKey 1 Burst Count A LSB MCKey 1 Reference B MSB MCKey 1 Reference B LSB MCKey 1 Burst Count B MSB MCKey 1 Burst Count B LSB MCKey 1 Reference C MSB MCKey 1 Reference C LSB MCKey 1 Burst Count C MSB MCKey 1 Burst Count C LSB
N+1
8-bit checksum
SCKey x or MCKey x debug state Provides the state of the capacitive sensing engine for the selected single- or multichannel key. For more information, refer to the QST device datasheet. SCKey x or MCKey x Reference This is a 16-bit value for the reference value of the selected key after calibration (3 different values for the 3 electrodes in the wheel/slider structure). SCKey x or MCKey x Burst Count (BC) This is a 16-bit value for the most recent Burst Count executed (3 different values for the 3 electrodes in the wheel/slider structure).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.2.12
RESET_DEVICE command
Command role
This is a Short Command without an argument. This command resets the QST (Slave) device after the response has been sent.
26/39
RM0005
Command description
Master to Slave request
Table 34.
Byte No. 0
Master to Slave request format
Bit 7 1 Bit 6 Bit 5 Bit 4 11111b Bit 3 Bit 2 Bit 1 0 Bit 0 1
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4). The reset is generated after the response packet has been sent.
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parity error
6.3
6.3.1
Extended Command set description
SET_KEY_GROUP command
Command role
This command defines the AKS strategy on the system. It defines for each key the Group ID to which this key is assigned and also how the Group will behave.
Master to Slave request
The structure of this packet depends on the number of single- and multi-channel keys implemented in the QST device. The description of the single-channel keys comes first and then the multi-channel keys. Table 35.
Byte No. 0 1 2 3 4
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x00 Length = N G8 Mode G7 Mode G6 Mode G5 Mode G4 Mode G3 Mode G2 Mode G1 Mode G8 for SCK1 G8 for SCK 2 G7 for SCK 1 G7 for SCK 2 G6 for SCK 1 G6 for SCK 2 G5 for SCK 1 G5 for SCK 2 G4 for SCK 1 G4 for SCK 2 G3 for SCK 1 G3 for SCK 2 G2 for SCK 1 G2 for SCK 2 G1 for SCK 1 G1 for SCK 2 Bit 2 Bit 1 Bit 0
M
G8 for MCK1
G7 for MCK1
G6 for MCK1
G5 for MCK1
G4 for MCK1
G3 for MCK1
G2 for MCK1
G1 for MCK1
N+2
8-bit checksum
27/39
Command description Gx Mode Defines the group x AKS operating mode. 0: Locking AKS. 1: Unlocking AKS. Gx for SCKy or MCKy Assigns the selected single-channel key to the selected group.
RM0005
0: No Group is selected and the current Key does not follow AKS. 1: Single- or multi-channel key (SCKy or MCKy) is part of Group Gx. In this case, the key detection is mutually exclusive with other keys of Group Gx.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
6.3.2
SET_SCKEY_PARAMETERS command
Command role
This command defines the threshold and hysteresis values used for single-channel key activation detection. The new setting is valid either for a specific key or for all keys.
Master to Slave request
Table 36.
Byte No. 0 1 2 3 4 5 6 Relative Values
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x01 Length = 0x04 Key Identifier Detection Threshold End of Detection Threshold Positive Recalibration Threshold 8-bit checksum Bit 2 Bit 1 Bit 0
Key Identifier Unique identifier for a single-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 0 0 011: Key 3 ... 1111111: Key 127
28/39
RM0005 Relative Values Defines how the argument values are expressed.
Command description
0: Argument values are expressed in absolute number. 1: Argument values are expressed in percentage of the Key's Reference Parameter = (0,1 x `Reference' x `Argument value')%. Detection Threshold The Detection Threshold is the difference between the `Reference' and `Burst Count' values used to declare detection. This value is signed and must be between 1 and 128. End of Detection Threshold The End of Detection Threshold is the difference between the `Reference' and `Burst Count' values used to declare the end of the detection condition. This value is signed and must be between 1 and 128. Positive Recalibration Threshold The Positive Recalibration Threshold is the difference between the `Reference' and `Burst Count' values used to declare an error needing a recalibration. This value is signed and must be between 1 and 128.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
6.3.3
SET_MCKEY_PARAMETERS command
Command role
This command defines the threshold, hysteresis and resolution values used for MultiChannel Key activation detection. The new setting is valid either for a specific key or for all keys.
Master to Slave request
Table 37.
Byte No. 0 1 2 3 Relative Values
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x02 Length = 0x07 Key Identifier Detection Threshold Bit 2 Bit 1 Bit 0
29/39
Command description Table 37.
Byte No. 4 5 6 7 8 9
RM0005 Master to Slave request format
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
End of Detection Threshold Positive Recalibration Threshold Resolution Direction Change Integrator Direction Change Threshold 8-bit checksum
Key Identifier Unique identifier for a multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 Relative Values Defines how the argument values are expressed. 0: Argument values are expressed in absolute number. 1: Argument values are expressed in percentage of the Key's Reference Parameter = (0,1 x `Reference' x `Argument value')%. Detection Threshold The Detection Threshold is the difference between the `Reference' and `Burst Count' values used to declare detection. This value is signed and must be between 1 and 128. End of Detection Threshold The End of Detection Threshold is the difference between the `Reference' and `Burst Count' values used to declare the end of the detection condition. This value is signed and must be between 1 and 128. Positive Recalibration Threshold The Positive Recalibration Threshold is the difference between the `Reference' and `Burst Count' values used to declare an error needing a recalibration. This value is signed and must be between 1 and 128. Resolution The Resolution is the number of bits used to encode the absolute position value (slider/wheel) returned for a multi-channel key. This value must be between 1 to 16, in hexadecimal format. Direction Change Integrator The Direction Change Integrator is the number of acquisitions needed to validate a change in the direction of the variation of the MCKey position. This value must be between 0 and 255. Direction Change Threshold The Direction Change Threshold is the minimum number of steps of the MCKey position to accept a change in the direction of the variation of this MCKey position. This value must be between 0 and 255. 0 0 011: Key 3 ... 1111111: Key 127
30/39
RM0005
Command description
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
6.3.4
SET_DETECT_INTEGRATORS command
Command role
This command defines the Detection Integrator, End of Detection Integrator and Positive Recalibration Integrator parameters. The new setting is valid either for all keys or a specific key.
Master to Slave request
Table 38.
Byte No. 0 1 2 3 4 5 6 Reser ved (0)
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x03 Length = 0x04 Key Identifier Detection Integrator End of Detection Integrator Positive Recalibration Integrator 8-bit checksum Bit 2 Bit 1 Bit 0
Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 Detection Integrator (DI) The Detection Integrator is the number of acquisitions needed to confirm a detection change in the Key state. This value must be between 1 to 255, in hexadecimal format. End of Detection Integrator (EDI) The End of Detection Integrator is the number of acquisitions needed to confirm a end of detection change in the Key state. This value must be between 1 to 255, in hexadecimal format. 0 0 011: Key 3 ... 1111111: Key 127
31/39
Command description Positive Recalibration Integrator
RM0005
The Positive Recalibration Integrator is the number of acquisitions needed to confirm a calibration of a key. This value must be between 1 to 255, in hexadecimal format.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
6.3.5
SET_DRIFT_COMPENSATION command
Command role
This command defines the Drift Compensation parameters. The new setting is valid either for a specific key or for all keys.
Master to Slave request
Table 39.
Byte No. 0 1 2 3 4 5 6 7 Reserved (0)
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x04 Length = 0x05 Key Identifier Positive Drift Integrator Negative Drift Integrator Common Time Step Factor Differential Time Step Factor 8-bit checksum Bit 2 Bit 1 Bit 0
Key Identifier Unique identifier for a single- or multi-channel key. 0 0 000: All keys 0 0 001: Key 1 0 0 010: Key 2 Positive Drift Integrator This is the number of acquisitions with a count higher than the `Reference' value to consider drifting. This value must be between 1 to 255, in hexadecimal format. 0 0 011: Key 3 ... 1111111: Key 127
32/39
RM0005 Negative Drift Integrator
Command description
This is the number of acquisitions with a count lower than the `Reference' value to consider drifting. This value must be between 1 to 255, in hexadecimal format. Common Time Step Factor Time interval between two Common Drift verifications. This value should be high (fast). Time = `Common Time Step Factor' x 10 milliseconds. This value must be between 0 and 255, in hexadecimal format. If 0x00, the common drift is disabled. Differential Time Step Factor Time interval between two Differential Drift verifications. This value should be low (slow). Time = `Differential Time Step Factor' x 10 milliseconds. This value must be between 0 and 255, in hexadecimal format. If 0x00, the common drift is disabled.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Parity error Checksum error
6.3.6
SET_GPIO_STATE command
Command role
This command sets the GPIO lines in the appropriate state. It only acts on the GPIOs configured in output mode.
Master to Slave request
The structure of this packet depends on the number of general-purpose inputs/outputs implemented in the QST device. As a consequence, rows 3 to 5 are optional. Table 40.
Byte No. 0 1 2 3 4 GPIO 8 state GPIO 16 state GPIO 24 state GPIO 7 state GPIO 15 state GPIO 23 state GPIO 6 state GPIO 14 state GPIO 22 state
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x08 Length = N GPIO 5 state GPIO 4 state GPIO 3 state GPIO 2 state GPIO 1 state GPIO 9 state Bit 2 Bit 1 Bit 0
GPIO 13 GPIO 12 GPIO 11 GPIO 10 state state state state
GPIO 21 GPIO 20 GPIO 19 GPIO 18 GPIO 17 state state state state state
33/39
Command description Table 40.
Byte No. 5 6
RM0005 Master to Slave request format (continued)
Bit 7 GPIO 32 state Bit 6 GPIO 31 state Bit 5 GPIO 30 state Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
GPIO 29 GPIO 28 GPIO 27 GPIO 26 GPIO 25 state state state state state 8-bit checksum
GPIO x Sets the GPIO x output state. 0: GPIO output state `0' 1: GPIO output state `1'
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
6.3.7
SET_PWM_MODE command
Command role
This command configures the PWM output.
Master to Slave request
Table 41.
Byte No. 0 1 2 3 4 5 6 7 Enable Mode Reserved (0)
Master to Slave request format
Bit 7 0 Bit 6 Bit 5 Bit 4 Bit 3 0x09 Length = 0x05 GPIO Identifier Bit 2 Bit 1 Bit 0
PWM Frequency Factor PWM Duty Cycle PWM Duration factor PWM Step for Multi-Channel Key 8-bit checksum
34/39
RM0005 GPIO Identifier Unique identifier for a GPIO. 0 0 0: All GPIOs 00001: GPIO 1 00010: GPIO 2 00011: GPIO 3 ... 11111: GPIO 31
Command description
Enable
Enable the selected GPIO(s) PWM output. 0: GPIO(s) PWM output disabled. 1: GPIO(s) PWM output enabled.
Mode
Defines the PWM output mode of the selected GPIO. 0: Automatic (please refer to QST device datasheet for further information on the automatic mode) 1: Controlled
PWM Frequency Factor
Defines the PWM output frequency. If 0x00, the PWM signal is continuously generated. Other values follow a logarithm law: fPWM = 10(Frequency Factor-1)/64 This calculation gives possible values between 1 Hz to 9.3 kHz. The implementation in the QST device can be limited to certain values.
PWM Duty Cycle
Defines the PWM output duty cycle. This value must be between 0 to 100 and is expressed in percentage.
PWM Duration Factor
In Automatic mode, this is the duration of the PWM output activation before coming back to Idle state. PWM Duration = `Duration Factor' x 10 ms. This value must be between 1 and 255.
PWM Step for Multi-Channel key
In Automatic mode, this is the stepping variation to activate the PWM output for the PWM duration.
Slave to Master ACK response
In case of success, the Slave returns a ACK response packet (Table 4).
Slave to Master STALL response
If an error is detected by the Slave, it returns a STALL response packet (Table 6). The possible error codes are:
Command not supported Parameter not supported Checksum error
35/39
Glossary
RM0005
Appendix A
Glossary
Adjacent Key Suppression (AKS): This is the algorithm used to prevent several keys from being active at the same time. `Burst Count' Level (BC): This is a 16-bit value representing the number of pulses generated during the last acquisition (burst sequence). `Delta' Level: This is a 16-bit value based on the difference between the `Reference' and the `Burst Count' levels. It is used to determine the state of a key by comparing it to some defined thresholds. Detection Threshold: Difference between number of pulses used as reference for a key and the current measurement of number of pulses on this key to confirm key touch detection. Note that this value is negative as the reference is always higher than a measurement during activation. Detection Integrator (DI): It is the number of acquisitions (Burst sequences) needed to confirm key touch detection. Duration Factor: Integer, Number of predetermined period of time during which the corresponding Output is active. End of Detection Integrator (EDI): It represents the number of detection sequences (Burst sequences) needed to confirm that the key has been inactivated (released). End of Detection Threshold: Same as Detection Threshold for inactivation detection. The difference between Detection Threshold and End of Detection Threshold gives an hysteresis ensuring the system stability. Frequency Factor: Integer used to set the PWM frequency. GPIO ID: GPIO Identifier. This is a unique integer from 1 to 32 which identifies a General Purpose Input/Output. Key ID: Key Identifier. This is a unique integer from 1 to 127 which identifies a key. SCKey and MCKey must have different KeyID. Key Group: It defines a group of keys (represented by their KeyID) to which the AKS is applied. Locking AKS: Once one key touch is detected, all other keys are locked in the "untouched" state until the touch is removed (key becomes "untouched"). MaxOnDuration: Maximum amount of time during which a key can be considered Active. After this duration, if a key is still active, it is recalibrated. MCKey: Multi-Channel Key. This is a key which uses several channels. It can be QWheel, QSlide or others. Negative Drift Integrator: It is the number of acquisitions (Burst sequences) needed to confirm that the reference of the key must be decreased. Positive Drift Integrator: It is the number of acquisitions (Burst sequences) needed to confirm that the reference of the key must be increased. Positive Recalibration Integrator: It is the number of acquisitions (Burst sequences) needed to confirm that a new calibration must be launched. Positive Recalibration Threshold: Difference between number of pulses used as reference for a Key and the current measurement of number of pulses on this key to confirm that a
36/39
RM0005
Glossary new calibration must be launched. Note that this value is positive as the reference is always lower than the measurement when recalibration is needed. `Reference' Level: This is a 16-bit value representing the number of pulses generated during the calibration phase. Resolution: This value is relative to MCKeys only. It gives the absolute position of a wheel or slider structure. SCKey: Single-Channel Key. This is a key which uses 1 channel only, typically QTouch or QMatrix. Step for Multi-Channel Key: Difference between previous position and current position of a MCKey needed to activate the PWM signal. Time Step Factor: Integer, Number of predetermined period of time between two consecutive Drift condition verifications. Unlocking AKS: On each acquisition, the signal strengths from each key are compared and this is the one with the highest signal level which is declared as active one.
37/39
Revision history
RM0005
Revision history
Table 42.
Date 26-Sep-2007
Document revision history
Revision 1 Initial release. Updated Length values in Table 31 in Section 6.2.11: GET_DEBUG_INFO command on page 23 and in Table 39 in Section 6.3.5: SET_DRIFT_COMPENSATION command on page 32. Updated SET_DETECT_INTEGRATORS command name. Updated SET_MCKEY_PARAMETERS command parameters. Updated Table 37 in Section 6.3.5: SET_DRIFT_COMPENSATION command on page 32. Changes
19-Nov-2007
2
38/39
RM0005
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST's terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST'S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER'S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
2007 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com
39/39
|