Testato / SoftwareWire

Creates a software I2C/TWI bus on every pins
GNU General Public License v3.0
148 stars 33 forks source link

Sending data without a STOP condition behavior. #35

Open Koepel opened 2 years ago

Koepel commented 2 years ago

This is not an issue, this is just informative. There is a difference between the Arduino Wire library (for the Arduino Uno) and the SoftwareWire library when writing data to a Target that does not acknowledge to its I2C address (because it is busy with other things).

The difference came up because of this topic on the Arduino forum: https://forum.arduino.cc/t/wire-library-repeated-start/952211/

Simplified code:

Wire.beginTransmission(0x08);
Wire.write( 0xAA);
Wire.endTransmission( false);  // parameter "false" for no STOP

When the Target does not exist or does not acknowledge to its I2C address, then the Arduino Wire library ignores the parameter and sends a STOP. The SoftwareWire library checks the parameter and does not send a STOP.

The idea is that the Controller can claim the I2C bus until the Target is ready. On the Arduino forum, the question was if the Controller could not send a STOP condition when the Target is not ready, but send a STOP after the data was successful delivered to the Target. That is not possible with either library.

I don't know who is correct. Changing the behavior could violate the I2C standard.