I'm trying to get an MMA8452 working with a small 8-bit micro (8051 based). I'm bit-banging the I2C interface but the MMA8452 never responds. Looking at the scope, the comms frequency is about 60 kHz which the sensor should support.
Whenver I send the address (0x1D), I never get an ACK. If I ignore this and attempt to get a reading (e.g. from WHO_AM_I register) I always get 0xFF back meaning the device does not respond. I can scope the I2C lines and they look OK.
The procedure I'm using is (complete c file is attached).
// Slave address
// Slave control byte
// Slave address + read
|I2C_WRITE(TARGET | 0x80);|
inData = I2C_READ();
VDD and VDDIO are definitely connected to 3V. Is there anything wrong with this? I really need an answer quickly so please respond as soon as you are able. If there is anything else you need to know, then please ask.
Original Attachment has been moved to: SMBus_Master.c.zip