Datasheet
Sensors
NXP Semiconductors 17
MMA8452Q
5.10.1 I
2
C operation
The transaction on the bus is started through a start condition (start) signal. Start condition is defined as a high to low transition on
the data line while the SCL line is held high. After start has been transmitted by the master, the bus is considered busy. The next
byte of data transmitted after start contains the slave address in the first seven bits, and the eighth bit tells whether the master is
receiving data from the slave or transmitting data to the slave. When an address is sent, each device in the system compares the
first seven bits after a start condition with its address. If they match, the device considers itself addressed by the master. The 9th
clock pulse, following the slave address byte (and each subsequent byte) is the acknowledge (ACK). The transmitter must
release the SDA line during the ACK period. The receiver must then pull the data line low so that it remains stable low during the
high period of the acknowledge clock period.
A low to high transition on the SDA line while the SCL line is high is defined as a stop condition (stop). A data transfer is always
terminated by a stop. A master may also issue a repeated start during a data transfer. The MMA8452Q expects repeated starts
to be used to randomly read from specific registers.
The MMA8452Q's standard slave address is a choice between the two sequential addresses 0011100 and 0011101. The selection
is made by the high- and low-logic level of the SA0 (pin 7) input respectively. The slave addresses are factory programmed and
alternate addresses are available at customer request. The format is shown in Table 10.
Single-byte read
The MMA8452Q has an internal ADC that can sample, convert and return sensor data on request. The transmission of an
8-bit command begins on the falling edge of SCL. After the eight clock cycles are used to send the command, note that the data
returned is sent with the MSB first once the data is received. Figure 11 shows the timing diagram for the accelerometer 8-bit I
2
C
read operation. The master (or MCU) transmits a start condition (ST) to the MMA8452Q, slave address ($1D), with the R/W bit
set to ‘0’ for a write, and the MMA8452Q sends an acknowledgement. Then the master (or MCU) transmits the address of the
register to read and the MMA8452Q sends an acknowledgement. The master (or MCU) transmits a repeated start condition (SR)
and then addresses the MMA8452Q ($1D) with the R/W bit set to ‘1’ for a read from the previously selected register. The Slave
then acknowledges and transmits the data from the requested register. The master does not acknowledge (NAK) the transmitted
data, but transmits a stop condition to end the data transfer.
Multiple-byte read
When performing a multi-byte read or burst read, the MMA8452Q automatically increments the received register address
commands after a read command is received. Therefore, after following the steps of a single-byte read, multiple bytes of data
can be read from sequential registers after each MMA8452Q acknowledgment (AK) is received until a no acknowledge (NAK)
occurs from the master followed by a stop condition (SP) signaling an end of transmission.
Single-byte write
To start a write command, the master transmits a start condition (ST) to the MMA8452Q, slave address ($1D) with the R/W bit set
to ‘0’ for a write, the MMA8452Q sends an acknowledgement. Then the master (MCU) transmits the address of the register to
write to, and the MMA8452Q sends an acknowledgement. Then the master (or MCU) transmits the 8-bit data to write to the
designated register and the MMA8452Q sends an acknowledgement that it has received the data. Since this transmission is
complete, the master transmits a stop condition (SP) to the data transfer. The data sent to the MMA8452Q is now stored in the
appropriate register.
Multiple-byte write
The MMA8452Q automatically increments the received register address commands after a write command is received.
Therefore, after following the steps of a single-byte write, multiple bytes of data can be written to sequential registers after each
MMA8452Q acknowledgment (ACK) is received.
Table 10. I
2
C device address sequence
Command
[7:2]
Device address
[1]
SA0
[7:1]
Device address
R/W
[7:0]
8-bit final value
Read 001110 0 0x1C 1 0x39
Write 001110 0 0x1C 0 0x38
Read 001110 1 0x1D 1 0x3B
Write 001110 1 0x1D 0 0x3A