hal_i2c_slave_receive_it问题?

发布于 2025-01-29 09:00:10 字数 207 浏览 3 评论 0原文

我使用此api hal_i2c_slave_receive_it(& hi2c1,buff,100)遇到了问题不会以接下来的100个字节传输的方式将它们与20个字节混合在一起,而我的回调(20 +(100-20))会损坏的框架!

有没有办法避免使用此用例,然后更新HAL_I2C_SLAVE_RECEIVE_IT API中的第三个参数为1而不是100?

提前致谢!

I had a problem using this API HAL_I2C_Slave_Receive_IT(&hi2c1, buff, 100) in case I send 20 bytes for example which is a corrupted frame for me (I am waiting for 100 bytes) then i2c driver will stack this 20 bytes and it does not free them in a manner that the next 100 bytes transmitted will be mixed with that 20 bytes and I will got a corrupted frame in my callback (20 + (100-20))!

Is there a way to avoid this use case other then updating the third parameter in HAL_I2C_Slave_Receive_IT API to 1 instead of 100?

thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

書生途 2025-02-05 09:00:10

此功能不知道您的意图是什么。您告诉它要接收100比较,它将这样做,直到实际收到100个字节或发生错误为止。您可以将其发送到一块或许多人中。它不会丢弃任何数据。

您需要自己实施此逻辑。

This function does not know what your intentions are. You told it to receive 100bytes and it will do it until 100 bytes are actually received or an error occurs. You can send it in one chunk or in many. It will not discard any data.

You need to implement this logic yourself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文