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

STM32: Check for NACK #6687

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/stm32/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ i2c_wait(I2C_TypeDef *i2c, uint32_t set, uint32_t clear, uint32_t timeout)
uint32_t sr1 = i2c->SR1;
if ((sr1 & set) == set && (sr1 & clear) == 0)
return sr1;
if (sr1 & I2C_SR1_AF)
shutdown("I2C NACK error encountered");
if (!timer_is_before(timer_read_time(), timeout))
shutdown("i2c timeout");
}
Expand Down
2 changes: 2 additions & 0 deletions src/stm32/stm32f0_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ i2c_wait(I2C_TypeDef *i2c, uint32_t set, uint32_t timeout)
uint32_t isr = i2c->ISR;
if (isr & set)
return isr;
if (isr & I2C_ISR_NACKF)
shutdown("I2C NACK error encountered");
if (!timer_is_before(timer_read_time(), timeout))
shutdown("i2c timeout");
}
Expand Down
Loading