Sorry for my bad english .
I'm developing a very simple MultiWii compatible board with Invensense 3-axis digital gyroscope ITG3205 and with FreeScale digital 3-axis accelerometer MMA8452Q. Both sensors are connected through I2C lines. The ITG3205 gyroscope works perfect, but data from the MMA8452Q accelerometer seems to be random values. The problem completely disappears when code in i2c_rep_start routine (Sensors.pde) is changed from
Code: Select all
void i2c_rep_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN) | (1<<TWSTO); // send REPEAT START condition
to
Code: Select all
void i2c_rep_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); // send REPEAT START condition
Why TWSTA (START) and TWSTO (STOP) condition bits are set simultaneously in i2c_rep_start routine? I have never seen any tutorial or application note with such a strange START/REP_START configuration.
It seems like a minor bug .