Hello,
Working with a TE Connectivity ms4515do pressure sensor via I2C, I want to send a fairly common message. (The message is detailed on page 4 in the Interfacing to Digital Pressure Modules document, called READ_MR.) In brief, the "ms4515do READ_MR message" is the standard I2C header of a "request for N" bytes from the sensor, achieved in Arduino (I think) by Wire.requestFrom(addr, N)
.
Since I don't actually want any bytes returned from the device, I used Wire.requestFrom(addr, 0)
.
This led to a very odd (and hard-to-find) bug in my application: While the I2C worked fine, during my writing to an SD card, using the SD/File libraries, the file on the SD card was continually being corrupted!
As a work-around, I now request 1 byte: Wire.requestFrom(addr, 1);
and then read-and-trash all the data: while (Wire.available()) Wire.read();
I'm not sure if this is a bug (and deserves a bug-report) or if requesting 0 bytes is intentionally unsupported. If it's intentionally unsupported, a warning or error message would have saved me lots of debugging time.
I love Arduinos, thank you all for your amazing work and support!