Hello, i'm working with the LSM6DS3 accelerometer/gyroscope. I've noticed a peculiar problem, where the I2C_transfer() function always returns false when called the first time. I've attempted to send three of the same transaction (a write to a register on the chip), and the first one always fails. Everything works properly, where I can read and write to the chip, but the first transaction always fails.
Any ideas?
EDIT: After further testing, its occurs on the first Read or Write transaction. The simple work-around is to send a "dummy" transaction, expecting it to fail, and then continue writing / reading registers as needed. I'd still like to know what could possibly cause this.
- One idea I had was that the chip wasn't powered on and "ready" by the time the first transaction is sent, leaving it unable to send an ACK. I tested this by leaving the chip powered on independent of the chip i'm using (CC2640 / SaBLE-x). The results were the same
- Another idea was that other chips on the I2C bus were causing a conflict, so I removed all wires leaving this chip as the only device on the I2C bus. I also removed all other I2C transactions that may occur.
- I attempted to place a delay Task_sleep() before executing this code. Same results.
- I've tried both 100khz and 400khz I2C speeds. Same result. (All tests in blocking mode)
- Using TI-RTOS 2_20_00_06
- I've verified that everything else works as expected after first transaction. IE: I can send three of the same exact read or write transactions, and the first always fails. I've printed to console and tried changing the order. I've attempted reading/writing multiple registers with the same consistent result to see if it was specific to the register.
Datasheet:
