fix[STM32][I2C]: stabilize async completion and recovery flow for hard i2c#11366
fix[STM32][I2C]: stabilize async completion and recovery flow for hard i2c#11366wdfk-prog wants to merge 1 commit intoRT-Thread:masterfrom
Conversation
…d i2c enable I2C error irq when async transfer paths are used fall back to polling when scheduler or interrupt context cannot wait for completion complete the wait path on HAL error callback and abort the transfer on async timeout or error allow INT and DMA mode flags to coexist and keep recovery behavior aligned across STM32 I2C IPs
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: bsp_stm32Reviewers: @Liang1795 @hamburger-os @wdfk-prog Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-05-06 18:32 CST)
📝 Review Instructions
|
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
STM32 hard I2C 在使用 IRQ/DMA 异步传输时依赖 HAL 回调唤醒
rt_completion_wait()。当前错误中断未完整启用,且错误回调没有通知等待线程,可能导致 NACK、BERR 或异常状态下等待超时,后续恢复流程不稳定。你的解决方案是什么 (what is your solution)
async_allowed参数,避免在调度器不可用或全局中断关闭时进入 IRQ/DMA 等待路径。ErrorCode,在错误回调中唤醒等待线程。HAL_I2C_Master_Abort_IT(),并等待外设恢复到 READY 状态。请提供验证的bsp和config (provide the config and bsp)
BSP_I2C*_USING_INT、BSP_I2C*_TX_USING_DMA、BSP_I2C*_RX_USING_DMA组合。]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up