Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
twsi: clearing of TWSI_CONTROL_ACK is moved to the state machine
Clearing of TWSI_CONTROL_ACK is moved from twsi_transfer to the state machine in twsi_intr. Specifically, the bit is cleared in the TWSI_STATUS_ADDR_R_ACK state when we want to read just one byte. We need to do that because if we send ACK after a received byte a device can send us another byte and the code may write beyond the read buffer. The old code did not work in a scenario where a single byte was read from an EEPROM device with two byte addressing. For example: i2c -m tr -a 0x50 -d r -w 16 -o 0 -c 1 -v The reason is that the first message (a write) has two bytes, so TWSI_CONTROL_ACK was never cleared at all.
- Loading branch information