20 Star 150 Fork 72

合宙Luat / luatos-soc-air32f103

 / 详情

[🐛Bug]: HAL_I2C 读异常

待办的
创建于  
2023-10-21 12:20

描述一下这个bug / Describe the bug

使用该函数读异常,但软件模拟I2C没有问题

for (int i = 0; i < 10; ++i) {
    HAL_I2C_Mem_Read(&hi2c1, 0x80, addr[i], I2C_MEMADD_SIZE_8BIT, i2c_dat, 2, HAL_MAX_DELAY);
    __NOP();
}

复现步骤 / To Reproduce

  1. 使用CUBEMX配置项目,配置I2C1全默认配置,引脚PB6,PB7
  2. 运行上述读代码
  3. 在第二次读取时卡死在以下循环
/* Wait until BTF flag is set */
     if (I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_BTF, RESET, Timeout, tickstart) != HAL_OK)
     {
       return HAL_ERROR;
     }

怀疑在双字节读时有不一致的地方。

以下是逻辑分析仪信息:

  • 硬件I2C

输入图片说明

如果正常,应该是什么样 / Expected behavior

应当和软件I2C一致

  • 软件I2C

输入图片说明

截图 / Screenshots

rt

日志 / Logs

rt

PACK包版本 / Version

验证

  • 检查过该问题,之前没有人提过 / Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • 提供了最小可复现工程或详细的复现步骤,确保开发者可以复现 / The provided reproduction is a minimal reproducible example of the bug.
  • 已经提供了完整的报错信息、日志、截图,没有经过删减。

评论 (1)

wenwenla 创建了任务

我也发现有此问题

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
C
1
https://gitee.com/openLuat/luatos-soc-air32f103.git
git@gitee.com:openLuat/luatos-soc-air32f103.git
openLuat
luatos-soc-air32f103
luatos-soc-air32f103

搜索帮助