Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/libs/mcu/arm_cm7/i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ auto EnablePeripheralClock(I2CId id) -> void {
const std::uint32_t start = Millis();
while ((registers->ISR & flag) == 0U) {
if ((registers->ISR & I2C_ISR_NACKF) != 0U) {
registers->ICR = I2C_ICR_NACKCF | I2C_ICR_STOPCF;
// Clear only NACKF. Autoend generates the STOP itself in response to the
// NACK, and FinishTransfer is what waits for and clears the resulting
// STOPF -- clearing it here would leave that wait with nothing to
// observe, burning the whole transfer timeout on every failed transfer.
registers->ICR = I2C_ICR_NACKCF;
return std::unexpected(common::Error::kOperationFailed);
}
if ((Millis() - start) > kTransferTimeoutMs) {
Expand Down
Loading