Environment: CCS 5.2, Linux, target (master) Stellaris Launchpad LM4F120, slave device MPU-9150 breakout board from SparkFun.
I'm having a problem reading MPU9150 (Invensense IMU) via I2C interface. According to the MPU register map I should read 0x48 from reg 0x00, which is its ID. I figured this would be the best way to get familiar with communicating to the MPU using I2C_Stellaris_API (from aBUGSworstnightmare).
Here's the code I'm using, which is similar to another post:
....
I2CSetup(I2C0_MASTER_BASE, true);
unsigned long rtn = I2CRegRead(I2C0_MASTER_BASE, 0x68, 0x00);
UARTprintf("I2C received=0x%02x\n", rtn);
....
I've setup a 40MHz system clock, otherwise the rest of the code is typical.
The output I get is:
"I2C test ->I2C received=0x83", which is not what I'm expecting.
I've connected a Link Instruments' MSO-19, USB scope with I2C mode, to the SDA/SCL but I'm not sure its working. I only seem to capture the pulse stream of 1 out of 4 runs. I can attach a 3.4MB screen shot of an exchange if that will help but I'm not sure how appropriate it would be give image size.
According to the tag from the scope, 0x83 is also a NACK. And, NACK seems to be part of the MPU's normal communication sequence. Here's an excerpt from (MPU-Product Specification document, PS-MPU-9150A-00):
"To read the internal MPU-9150 registers, the master sends a start condition, followed by the I C address and
a write bit, and then the register address that is going to be read. Upon receiving the ACK signal from the
MPU-9150, the master transmits a start signal followed by the slave address and read bit. As a result, the
MPU-9150 sends an ACK signal and the data. The communication ends with a not acknowledge (NACK)
signal and a stop bit from master. The NACK condition is defined such that the SDA line remains high at the
th 9 clock cycle. The following figures show single and two-byte read sequences."
I'm new to using I2C. Are the read/write sequences the same for all I2C slaves? Any idea what I might be doing or assuming wrong here? Would posting the 3.4MB screenshot help?
Update: The MPU-9150 id register's address is 0x75 and not 0x00. I'm not getting the expected value.
Thanks