I have probably stupid question regarding i2c implementation in WMC. As I understand WMC always working in "Repeated start" mode (http://www.i2c-bus.org/repeated-start-condition/). So it is never releases the bus and never issuing Stop Condition and never finishes transaction. This fine, but I have questions:
1) Why we setting TWSTO bit here?
Code: Select all
inline void i2c_rep_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN) | (1<<TWSTO); // send REAPEAT START condition
waitTransmissionI2C(); // wait until transmission completed
checkStatusI2C(); // check value of TWI Status Register
TWDR = address; // send device address
TWCR = (1<<TWINT) | (1<<TWEN);
waitTransmissionI2C(); // wail until transmission completed
checkStatusI2C(); // check value of TWI Status Register
}
2) There are some users, who reporting issues with WMP/NK not working in repeated start mode. (The symptomps are: WMC not working, but other examples from inet, or BaronPilot which uses Wire library working fine). Shell we implement 2 modes for i2c protocol and switch them using conditional defines? I mean, optionally issue Stop condition for i2c, it would be slower but will allow users to use existing hardware.
regards,
ziss_dm