Mecha_QMC5883L icon indicating copy to clipboard operation
Mecha_QMC5883L copied to clipboard

I2C stops working at fast reading (100Hz) solved

Open Janzarik opened this issue 3 years ago • 0 comments

With this library I had issues to get a reliable connection to the sensor when I executed MechaQMC5883::read command more than 50 times a second. Even though the Sensor could work up to 200Hz.

When reading the chapter "8.2.4 I2C Read" in the datasheet, i discovered, that for reading the sensor data (x,y,z) there should only be one Stop-Bit sent from the master. I am assuming, that your library instead is sending two Stop-Bits for one data-reading sequence. As far as I understand the Wire.h library, the Wire.endTransmission(); line is sending a Stop-Bit even though it shouldn't.

After I added a false Wire.endTransmission(false); in the read function, I could achieve a reliable 100Hz connection.

Janzarik avatar Jun 16 '22 19:06 Janzarik