AnsweredAssumed Answered

I2C drivers and MMA8451 on FRDMK64 (SDK1.3)

Question asked by Catosh on Oct 31, 2017
Latest reply on Nov 23, 2017 by Catosh

I would like to use the MMA8451 with the K64 and kinetis sdk 1_3 on Atollic True Studio. 
For this, I am using the I2C_DRV_MasterSendDataBlocking and I2C_DRV_MasterReceiveDataBlocking drivers provided by NXP.
Probing with the oscilloscope looks like the write and read commands are senti correctly, but I have the wrong reply from the read data. 
Code provided fro reading a single register: 

 

i2c_status_t MMA8451_ReadReg(uint8_t slave_register, uint8_t *data, short dataSize) {
i2c_status_t res;
uint8_t cmd = slave_register;
res = I2C_DRV_MasterSendDataBlocking(I2C0_IDX,&accel_bus_device,0,0,&cmd,1,5);
res = I2C_DRV_MasterReceiveDataBlocking(I2C0_IDX,&accel_bus_device,0,0,data, 1,5);
return res;
}

 

Maybe I should take care of the autoincrement? Or the ack and nack and repeated start have to be managed in a different way?
B.R.

L

Outcomes