I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S...
Transcript of I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S...
...................................................................................................... 2 ........................................................................................... 3 ............................................................................................. 7 ....................................................................................................12 .....................................................................16 ......................................................................................................19 .......................................................20 ........................................................................................23 ............................................................27
............................................................28 ...........................................................................31 .................................................32
Sensor microprocessor
I2C
SCL
Rint_SCL
SDA
Rint_SDA
DVCC
I2C_SDA
GND
I2C_SCL
I2C_SDA
G+
DVCC
G0
DC/DC converter
G+ DVCC
RP_SCL
RP_SDA
RS_SCL
RS_SDA
I2C_SCL
I2C terminal
I2C_SDA
I2C_SCL
G+
G0
DVCC
I2C terminal
DVCC
G0
G+
I2C_SC
L
I2C
terminal
DVCC
G0
G+
I2C_SCL I2C_SDA
I2C terminal
Start condition
Start condition
Stop condition
─
─
─
─
─
─
─
─
─
─
─
─
1.
2.
Wait time slotSDA
SCL
Request
tRQ
Write I2C
Request
tWAIT
Wait time slot
Response
Read
Response
tRS
tS
tWU
Pulse to Wake
Up Meter
tWUD
Wait to Wake
Up Meter
Wait time slotRequest
tRQ
Write I2C
Request
tWAIT
Wait time slot
Response
Read
Response
tRS
tS
SCL
SDA
tWU
Pulse to Wake
Up Meter
tWUD
Wait to Wake
Up Meter
Wait time slotRequest
tRQ
Write I2C
Request
tWAIT
Wait time slot
Response
Read
Response
tRS
tS
SCL
SDA
Up to 8 clocks while
SDA stays Low
Start
conditi
on
Write RAM/EEPROM
Stop
conditi
on
7 bit address+
direction bit
(write)
Address
1 byte 2 bytes
Data to write
1..16 bytes
Start
conditi
on
Stop
conditi
on
7 bit address+
direction bit
(read)
1 byte
Operation
status
1 byte
Start
conditi
on
Read RAM/EEPROM
Stop
conditi
on
7 bit address+
direction bit
(write)Address
1 byte 2 bytes1 byte
Start
conditi
on
Stop
conditi
on
7 bit address+
direction bit
(read)
1 byte
Read data
1-16 bytes
Operation
status
1 bytes
Master Wait Delay
Master Wait Delay
Disable IRQ Enable IRQ
ProcessI2C on Sesnor
Set operation status to
complete
Disable IRQ Enable IRQ
Command
Byte
1 byte
Checksum
1 byte
Checksum
1 byte
Checksum
1 byte
Checksum
1 byte
Command
Byte
ProcessI2C on Sesnor
Set operation status to
complete
─
─
─
Wake-Up Sensor
(models PO and 4B)
Send Request.
Timeout 120ms (checked by I2C-Master)
START(Call by high-level function)
Delay 1 ms for Sensor
WakeUp from SleepMode
Make pulse 1-0-1 on line SDA
(~300us)
--- OR ---
Send Start Condition, byte
0x00, then Stop Condition
Check ACK
Send I2C Start
Condition
Send 7-bit I2C address
and Direction bit
(0=Write)
ACK
NotACK
Comm. ErrorSend next Byte
All bytes was sent?No
Yes
Send Stop Condition
Comm. Error
Tim
eo
ut
Delay 20 ms for
processing Request
on Sensor
Continue on next page
Example:
Send byte 0xD0 for
default address 0x68 or
byte 0xFE for ”any
sensor” address 0x7F
Receive Response.
Timeout 120ms(Checked by
I2C-Master.)
Check ACK
Send I2C Start
Condition
Send 7-bit I2C address
and Direction bit
(1=Read)
ACK
NotACK
Comm. Error
No
Send Stop Condition
Complete
Incomplete(Response
is not ready)
Check
field “Command”
in Operation
Status
Equal to the field
“Command” in Request
Check
field “Completion”
in Operation
Status
Incorrect
Format Error
Yes
Receive Byte
with ACK
Last byte will
be received?
END(Return data and status ”OK” to high-
level function)
Check Checksum
Correct
Incorrect
Format ErrorComm. Error
Tim
eo
ut
Receive last Byte
without ACK
Continue
Example:
Send byte 0xD1 for
default address 0x68 or
byte 0xFF for ”any
sensor” address 0x7F
Comm. Error
Communication Error – wrong
Slave address, timeout, or
NotACK. I2C-Master should
send Stop Condition after this
error. Master can do several
retries.
Error Handling
Send Stop Condition
Format Error
Error of Request’s format -
wrong checksum or Request
is not processed. Master can
do several retries.
END(Return to high-level with Error)
END(Return to high-level with Error)
This example is not applicable for K33 sensors with memory map 0x5D.
This example is not applicable for K33 sensors with memory map 0x5D.
G0
G+
I2C_SCL I2C_SDA
DVCC
I2C_SDA
I2C_SCL
G+ G0
DVCC
I2C_SDA I2C_SCL G+ G0
I2C_SDA I2C_SCL
G+ G0