beautypg.com

2 i2c register read, C register read – PNI RM3100 Sensor Suite User Manual

Page 27

background image

PNI Sensor Corporation

Doc 1017252 r03

RM3100 & RM2100 Sensor Suite User Manual

Page 26 of 45

All communication is on the SDA line. The transaction is initiated by the host, or master,
sending the Start condition followed by the MagI2C’s slave address, and then the RW bit
is set to ‘0’, indicating a Write operation. The slave address is acknowledged by the

MagI2C 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 MagI2C 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 MagI2C 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

SLAVE 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 MagI2C

From MagI2C to Host

START

SLAVE 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 MagI2C’s slave address, but this
time sets the RW bit is set to ‘1’. The MagI2C 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 MagI2C 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.