stm32: Add workaround for STM32 i2cv1 errata #2887
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Applies to #2372, and may be ONE of the root causes.
This partially addresses the STM32F405 (and likely all other i2cv1) errata that if the device thinks it hears a STOP at the wrong time, it'll refuse to ever send a START again, causing all i2c transactions to lock up.
Ideally we'd do this at runtime, not to force users to re-configure their devices like I do, but then we'd need to hold onto the config, detect the lockup (timeout on read/write? check the BUSY flag is set when it shouldn't?), wait for the bus to be idle, apply the workaround, reapply config (as swrst resets the peripheral config), and start again.
At least now users can clear the fault by re-initializing the I2C device within their firmware.