AT Commands Reference Guide
80529ST10815A Rev.2– 2017-09-14
ReproductionforbiddenwithoutTelitCommunicationsS.p.A.writtenauthorization‐AllRightsReserved page143of233
#I2CWR – Write to I2C
To complete the operation send Ctrl-Z char (0x1A hex); to exit without writing the
message send ESC char (0x1B hex).
Data shall be written in Hexadecimal Form.
If data are successfully sent, then the response is OK.
If data sending fails for some reason, an error code is reported.
Example if CheckAck is set and no Ack signal was received on the I2C bus.
Note: At the end of the execution GPIO will be restored to the original setting ( check
AT#GPIO Command )
Device address, register address where to read from\ write to, and date bytes have to
be written in hexadecimal form without 0x.
AT#I2CWR=?
Test command returns the range of each parameter.
Example
AT#I2CWR=2,3,30,10,14
> 00112233445566778899AABBCCDD<ctrl-z>
OK
Set GPIO2 as SDA, GPIO3 as SCL;
Device I2C address is 0x30;
0x10 is the address of the first register where to write I2C data;
14 data bytes will be written since register 0x10.
Read to I2C - #I2CRD
#I2CRD – Read to I2C
AT#I2CRD=
<sdaPin>,
<sclPin>,
<deviceId>,
<registerId>,
<len>
This command is used to Send Data to an I2C peripheral connected to module
GPIOs
<sdaPin >: GPIO number for SDA . Valid range is “any input/output pin” (see Test
Command.)
<sclPin>: GPIO number to be used for SCL. Valid range is “any output pin” (see
Command Test).
<deviceId>: address of the I2C device, with the LSB, used for read\write
command. It doesn’t matter if the LSB is set to 0 or to 1. 10 bit addressing
supported.
Value has to be written in hexadecimal form (without 0x before).
<registerId>: Register to read data from, range 0..255.
Value has to be written in hexadecimal form (without 0x before).
<len>: number of data to receive. Valid range is 1-254.
Data Read from I2C will be dumped in Hex: