Description
I unsuccessfully tried to use the Wire library on an MSP430FR5969 launchpad using the eUSCI_B0 module to communicate to a MPR121 touch controller (eUSCI_B0 in I2C mode uses pins 14 and 15 on launchpad (ports 1.7, 1.6))
So I connected the logic analyzer an could observe, that when calling
Wire.beginTransmission(slaveaddr);
Wire.write(MPR121_CONFIG1);
Wire.endTransmission(false); // repeated start
Wire.requestFrom(slaveaddr, 1, true);
the expected data is transferred but no stop condition is set by requestFrom
and the master continues to clock the bus.
I could fix this issue by adding a few lines to msp430-lg-core/libraries/Wire/utility/twi.c,
the diff
is:
592,596d591
< if ((sendStop) && (length > 0)) {
< UCBzCTLW1 |= UCASTP_2; // do generate Stop after last Byte to send
< } else {
< UCBzCTLW1 &= ~UCASTP_2; // do not generate Stop
< }
As I'm not an expert with the eUSCI module and I2C, i'm not sure whether this is an appropriate patch.
Interestingly no reference to the sendStop
argument at all appears in the twi_readFrom
function (besides the call to the SW I2C implementation).