ism330dlc: I2C errors are hidden in the polling example

未关闭
#191 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
67/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c

调研方向

Start in ism330dlc_STdC/examples/ism330dlc_read_data_polling.c, focusing on the NUCLEO_F401RE implementations of platform_read() and platform_write() and the configuration and sample-read calls. Trace how callback errors and failed reads are handled before initialization continues or data is interpreted. Done when bus failures are reported and the example stops or skips the corresponding work on failed operations.

由索引模型根据 Issue 内容生成。

描述

bug

Hi,

I was looking through ism330dlc_STdC/examples/ism330dlc_read_data_polling.c and noticed that the NUCLEO_F401RE versions of platform_read() and platform_write() ignore the HAL return value and always return 0.

Since the driver treats zero as success, an I2C failure gets reported as a successful transaction. I checked this at commit 1f848c38e84b4144d55c66fb5411e78bdb9f96f1, using the pinned ISM330DLC driver.

The example also ignores the return values from its configuration and sample-read calls, so returning the HAL status from the callbacks would only address part of it. The application would still need to check those results before continuing initialization or using the data.

I reproduced the callback behavior with mocked HAL results in a host build. For example, a failed configuration write still allows the rest of setup to run. The driver itself already propagates nonzero errors correctly when the callbacks provide them.

Would you be open to a small change covering this example’s F401RE/I2C configuration? I’d like to:

  • Propagate bus failures through the existing callbacks.
  • Check configuration calls before continuing initialization.
  • Skip status interpretation or sample conversion/output when the corresponding read fails.

For initialization failures, would stopping with a short error message fit the intended scope of the example?

I wanted to check the approach here before preparing a patch.

cc @avisconti

主要语言
C
星标
888
派生
540
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

STMicroelectronics/STMems_Standard_C_drivers 的其他 Issue

查看 STMicroelectronics/STMems_Standard_C_drivers 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。