beautypg.com

C register read – PNI RM3100 Evaluation Board User Manual

Page 16

background image

PNI Sensor Corporation

Doc 1017252 r02

RM3100 Evaluation Board User Manual

Page 15 of 33

All communication is on the SDA line. The transaction is initiated by the host, or master,

sending the Start condition followed by the RM3100 Evaluation Board’s slave address,

and then the RW bit is set to ‘0’, indicating a Write operation. The slave address is

acknowledged by the module by setting SDA to LOW. This is followed by the desired 7-

bit register address and then the register data. The register value automatically

increments after every received data byte. The transaction is terminated by the host

sending the Stop condition.

The RM3100 Evaluation Board will always acknowledge the start of an I

2

C Write

transaction by sending a ‘0’ (i.e. the ACK signal). But if the Write command cannot be
executed for some reason the module will send a ‘1’ instead (i.e. the NACK signal). The

reasons a NACK signal might be sent are established by the HSHAKE register, and

include writing to an undefined register or writing to the POLL register while CMM is in

progress, or vice versa. See Section 5.6.2 for more information.

4.5.2 I

2

C Register Read

To perform a Read transaction, it is first necessary for the master to Write the desired

register address, and then to Read the register data. A generic transaction is given below.

START

RM3100 Eval Board

ADDRESS

RW ACK

REGISTER ADDRESS (N)

ACK STOP

S

A6 A5 A4 A3 A2 A1 A0 0

0

A7 A6 A5 A4 A3 A2 A1 A0

0

P

From Host to RM3100 E.B.

From RM3100 E.B. to Host

START

RM3100 Eval Board

ADDRESS

RW ACK

DATA FROM REG. (N)

ACK

DATA FROM REG. (N+1)

NACK STOP

S

A6 A5 A4 A3 A2 A1 A0 1

0 A7 A6 A5 A4 A3 A2 A1 A0 0 A7 A6 A5 A4 A3 A2 A1 A0

1

P

-------------- Data Transferred (n bytes + acknowledge) --------------

The Write sequence is described in the prior section, except for this case there is no data

to send. For the Read sequence the host again sends the RM3100 Evaluation Board’s
slave address, but this time sets the RW bit is set to ‘1’. The module acknowledges that it
is has been addressed and then sends data from the register address that was previously

sent. The host acknowledges receipt of the data, and then the module increments the

register address and sends data from this register. This continues until the host sends the

NACK command followed by the Stop command, which terminates the transaction.