![Gemalto Cinterion ENS22-E At Command Set Download Page 170](http://html.mh-extra.com/html/gemalto/cinterion-ens22-e/cinterion-ens22-e_at-command-set_2206709170.webp)
Cinterion
®
ENS22-E AT Command Set
12.4 AT^SSPI
ENS22-E_ATC_V01.000
19/02/11
Page 170 of 189
tains a Receive or Transmit Request (R/W Request) for the I²C master.
In a Transfer Message (Read or Write), the third element is the 7-bit I²C Slave Address (2 characters) that iden-
tifies each single device connected to the bus. The 8
th
bit of this byte is the LSB that determines the direction of
the message. If the LSB is "0" the master will write information to the selected slave. If the LSB is "1" the master
will read information sent from the slave.
In a Read Transfer Message on the I²C bus, the size of the expected data must be specified explicitly. This is an
element of 4 characters stating the number of bytes to be read. It must be placed after the I²C Slave Address.
12.4.2.2
Structure of Messages on the SPI
Table 12.3:
Structure of Transfer and Response Messages for SPI
The SPI has two serial data lines, MOSI for sending data from the master to the slave, and MISO for receiving
data sent from the slave to the master. Both data lines are controlled by one serial clock line SPI_CLK.
Cinterion
®
ENS22-E acts as master providing the clock. Write and read data are handled in the same
Transfer Messages and Response Messages. In a Transfer Message, the next two elements after the ID are
the Read Offset and the Read Length, both required to enable reading data from the slave. The Read Offset
specifies where to start read-ing, i.e. which byte is the first to start reading from. If the Read Offset is zero
then reading starts from the first byte. The Read Length specifies the number of expected bytes. If the Read
Offset is zero and the Read Length does not equal zero, the master reads the specified number of bytes,
starting from the first byte. If the Read Length is zero, the Read Offset is ignored, meaning that the master will
not read data from the slave. To transmit data from the master to the slave all data can be entered after the
Read Length.
In a Response Message the ID is followed by a special character to indicate the result of reading. If
successful, "+" is given, followed by the read data. If reading fails only "!" is received.
12.4.3
Error Handling on the I²C Bus
Protocol error:
If a protocol error is detected the ASCII value "!" is sent to the AT interface. Also, a Stop Condition is sent to the
I²C device.
A protocol error occurs if
• any data / address characters do not equal 0...9, a...f and A...F
• the length of a read word is smaller or greater than 16 bits
• the number of ASCII data is odd (e.g. "af1" instead of "af01")
• the Read or Write request is greater than 16 Bytes (0x0010).
Acknowledge:
Once a transmission has completed successfully (Write or Read), the special character "+" (ACK) is included in
the Response sent to the AT interface.
During a Write Transfer, the I²C driver acknowledges each transferred byte, but the Response contains only one
Message
Format
Transfer Message
Read data:<
ID ReadOffset ReadLength
>
Write data: <
ID Data
>
Read and write data: <
ID ReadOffset ReadLength Data
>
Read Offset = 8 bits
Read Length = 16 bits
Max. length of data: 128 bytes
Response Message
Write OK
Reading x bytes was OK
Protocol error in x
th
byte
{
ID +
}
{
ID +
Data
}
{
ID !
xxxx
}