3 crc bytes, 4 spi commands, 1 control commands – Rainbow Electronics AT42QT1110-AZ User Manual

Page 11

Advertising
background image

11

9570H–AT42–02/10

AT42QT1110-MZ/AT42QT1110-AZ

4.1.3

CRC Bytes

If enabled, a CRC checking procedure is implemented on all communications between the SPI
master and the QT1110. In this case, each command or report request sent by the master must
have a byte appended containing the CRC checksum of the data sent. The QT1110 will not
respond to commands until the CRC byte has been received and verified.

Sample C code showing the algorithm for calculating the CRC of the data can be found in

Appendix A

.

When the QT1110 is expecting a CRC byte, it returns (on MISO) the calculated CRC byte which
it expects to receive. This is sent simultaneously with the QT1110 receiving the CRC byte from
the master (that is, during the same byte exchange). This allows both devices to confirm that the
data was sent correctly.

All data returned by the QT1110 is also be followed by a CRC byte, allowing the master to
confirm the integrity of the data transmission.

4.1.4

SPI Commands

There are three types of communication between the SPI master and the QT1110:

• Control commands (see

Section 5 on page 22

)

– To send control instructions to the QT1110

• Report requests (see

Section 6 on page 24

)

– To reading status information from the QT1110

• Setup commands (see

Section 7 on page 28

)

– To set configuration options (“Set” instructions)

– To read configuration options (“Get” instructions)

Additionally the “Null” command (0x00) is transmitted by the host device as it is receiving data
from the QT1110.

4.1.4.1

Control Commands

A control command is an instruction sent to the QT1110 that controls operations of the device,
and for which no response is required. Examples of control commands are: “Reset”, “Calibrate”,
“Send Setups”.

With the exception of “Send Setups”, control commands normally require a single byte
exchange, unless CRC checking is enabled, in which case a second byte must be transmitted
by the host with the calculated CRC of the command byte.

Figure 4-1.

Sleep Command – CRC Disabled

Host (Sends on MOSI)

Device (Responds on MISO)

Simultaneous

Transmission

Command: 0x05

Response: 0x55 ( Idle”

Fresh Command)

Advertising