Skip to content
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

Fix I2C stop condition when receiving 1 byte with USCI #226

Merged
merged 1 commit into from Apr 29, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions hardware/msp430/cores/msp430/twi.c
Expand Up @@ -266,6 +266,11 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen
#ifdef __MSP430_HAS_USCI__
twi_state = TWI_MRX; // Master receive mode
UCB0CTL1 |= UCTXSTT; // I2C start condition

if(length == 1) { // When only receiving 1 byte..
while(UCB0CTL1 & UCTXSTT); // Wait for start bit to be sent
UCB0CTL1 |= UCTXSTP; // Send I2C stop condition after recv
}
#endif
#ifdef __MSP430_HAS_EUSCI_B0__
twi_state = TWI_MRX; // Master receive mode
Expand Down