ST意法半导体
直播中

陈珂瑾

7年用户 171经验值
私信 关注
[问答]

与STEVAL-MKI137V1的I2C连接不稳定

大家好,
我通过I2C将STEVAL-MKI137V1(万用表传感器)连接到STM32L152D-EVAL。我使用的库来自STM32CubeExpansion_MEMS1_V4.0.0。
我将I2C引脚连接到PB11和PB10,没有任何外部电阻
STEVAL-MKI137V1侧面。
这个问题对我来说很奇怪。大多数情况下代码不起作用,它会产生类似Acknowledge Failure的错误,有时代码运行良好而没有任何错误!
这个问题的预期原因是什么?我该如何解决?
注意:与外部上拉电阻有关的问题是什么?因为我没有使用它们。
提前致谢。

#steval-mki137v1#i2c

以上来自于谷歌翻译


以下为原文




Hi all,
I connected STEVAL-MKI137V1 (Magnometer sensor) to STM32L152D-EVAL through I2C. The library I am using is from STM32CubeExpansion_MEMS1_V4.0.0.
I connected I2C pins to PB11 and PB10 without any external resistors on
STEVAL-MKI137V1 side.
The problem is weird for me. Most of the times the code do not work, it give error like Acknowledge Failure, and sometimes the code works very well without any error!
What is the expected reason of this problem? How can I solve it?
Note: is the problem related to external pull-up resistors? Because I did not use them.
Thanks in advance.

#steval-mki137v1 #i2c

回帖(5)

曾玲娟

2019-3-14 11:07:07
I2C总线需要上拉电阻(SDA,SCL信号)。

以上来自于谷歌翻译


以下为原文




Pull-up resistors are needed for the I2C bus (SDA, SCL signals).
举报

陈珂瑾

2019-3-14 11:12:07
可能是问题吗?
另外,外部电阻的价值是多少?
最好的祝福。

以上来自于谷歌翻译


以下为原文




Could it be the problem?
Also, what is the value of the external resistors?
Best regards.
举报

张茜

2019-3-14 11:22:26
是的,它可以。
尝试通常的4k7值。
如果您想要一种更科学的方法来计算电阻值,请查看
https://www.nxp.com/docs/en/user-guide/UM10204.pdf
,第7.1节。大卫

以上来自于谷歌翻译


以下为原文




Yes, it can.
Try the usual 4k7 value.
If you wanted a more scientific method to compute the resistor values, have a look at
https://www.nxp.com/docs/en/user-guide/UM10204.pdf
, section 7.1David
举报

陈珂瑾

2019-3-14 11:37:18
我将审查该文件。谢谢你。
我不确定问题是因为上拉电阻。代码有时会工作,但在大多数情况下会给我不同的错误。
再次,我感谢你的帮助。

以上来自于谷歌翻译


以下为原文




I will review the document. Thanks for it.
I am not sure yet that the problem is because the pull-up resistor. The code works sometimes while gives me different errors on most of the times.
Again, I appreciate your help.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分