Skip to content

Wire library does not send stop condition when receiving as a master on MSP430 eUSCI module #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
llozi opened this issue Nov 2, 2019 · 0 comments

Comments

@llozi
Copy link

llozi commented Nov 2, 2019

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant