I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S...

33
...................................................................................................... 2 ........................................................................................... 3 ............................................................................................. 7 ....................................................................................................12 .....................................................................16 ......................................................................................................19 .......................................................20 ........................................................................................23 ............................................................27 ............................................................28 ...........................................................................31 .................................................32

Transcript of I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S...

Page 1: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

...................................................................................................... 2 ........................................................................................... 3 ............................................................................................. 7 ....................................................................................................12 .....................................................................16 ......................................................................................................19 .......................................................20 ........................................................................................23 ............................................................27

............................................................28 ...........................................................................31 .................................................32

Page 3: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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

Page 4: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

I2C_SDA

I2C_SCL

G+

G0

DVCC

I2C terminal

Page 5: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

DVCC

G0

G+

I2C_SC

L

I2C

terminal

DVCC

G0

G+

I2C_SCL I2C_SDA

I2C terminal

Page 7: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 8: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

Start condition

Page 9: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

Start condition

Stop condition

Page 10: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 11: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

1.

2.

Page 12: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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

Page 13: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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

Page 14: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

Page 15: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

Page 16: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 17: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 18: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 19: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 20: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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

Page 21: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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

Page 22: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

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)

Page 23: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 24: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 25: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 26: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 27: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 28: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 29: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 30: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror
Page 31: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

This example is not applicable for K33 sensors with memory map 0x5D.

This example is not applicable for K33 sensors with memory map 0x5D.

Page 32: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

G0

G+

I2C_SCL I2C_SDA

DVCC

I2C_SDA

I2C_SCL

G+ G0

DVCC

I2C_SDA I2C_SCL G+ G0

Page 33: I2C communication guide - Microsoft · I2C -M aster.) C heck A C K S end I2C S tart C ond ition S end 7-bit I2C ad d ress and Direction bit (1= R ead ) A C K N otA C K C omm. E rror

I2C_SDA I2C_SCL

G+ G0