I have a simple sketch - very similar to ones featured on this forum - to read and display data from an MS5611 baro sensor. It works fine on an 3v3 8MHz Arduino ProMini but produces corrupt data when run on a Feather M0. I am using Arduino IDE 1.6.5 with the latest Arduino and Adafruit SAMD Board extensions, everything looks good hardware wise (all 3v3) and on the I2C lines but the data is wrong.
Anyone have this sensor working on a Feather and can offer me working software?
I cannot use higher than IDE 1.6.5 otherwise I get a number of errors about missing files (thios seems to be an issue that with the Adafruit SAMD board).
I have run an I2C scanner and it correctly detects the sensors connected. The senors seem to be correctly accessed and data read from them. The problem is the data is incorrect and in some cases varying when it is being read from an internal PROM.
Peter
ps I have an I2C sniffer on its way in the hope of seeing exactly what is not the I2C bus.
Everything works, but the data is incorrect because data from the internal PROM is not always the same ? That is weird.
Do you check the I2C for errors ? Check the error returned by Wire.endTransmission() and the number of bytes that are received with Wire.requestFrom(), but also Wire.available() can be used. Show us the sketch, and show how you have added those checks please.
I was using a sketch from this thread Pressure Sensors MS5611 MS5803 - Sensors - Arduino Forum which has formed the basis for others to use as well. Unfortunately in the initial(address) routine there is an error and the number of bytes requested in Wire.requestFrom(address, (uint8_t) 6); should be 2 not 6.
I have not worked out why this does not matter with 8bits processors but does matter with 32bit processors, but it now works on the Feather M0
That code is not okay.
The Wire.beginTransmission() and Wire.endTransmission() should only be used for writing data, they should not be used with Wire.requestFrom(). A delay() after Wire.requestFrom() has no use.