Hello,
thank you for your advice. Much appreciated. My I2C is working now and I read the correct value from WHO_AM_I register :smileyhappy:
But I'm facing with another problem now. When I read from axis registers of MMA8451Q module I always get the same value from them.
I do it like that:
//======================================
//================X AXIS================
//======================================
xMSB = I2C_ReadRegister(0x01); //MSB
xLSB = I2C_ReadRegister(0x02); //LSB
xMSB = xMSB<<6;
x = xMSB | xLSB;
//======================================
//================Y AXIS================
//======================================
yMSB = I2C_ReadRegister(0x03); //MSB
yLSB = I2C_ReadRegister(0x04); //LSB
yMSB = yMSB<<6;
y = yMSB | yLSB;
//======================================
//================Z AXIS================
//======================================
zMSB = I2C_ReadRegister(0x05); //MSB
zLSB = I2C_ReadRegister(0x06); //LSB
zMSB = zMSB<<6;
z = zMSB | zLSB;
These registers always return the same values. Should I calibrate or initialise the MMA8451Q module before reading these registers? How to do it?
Regards,
Janusz