cancel
Showing results for 
Search instead for 
Did you mean: 

Unstable I2C Connection to STEVAL-MKI137V1

Khaled Aljehani
Associate III
Posted on September 15, 2017 at 10:26

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
1 ACCEPTED SOLUTION

Accepted Solutions
Khaled Aljehani
Associate III
Posted on September 23, 2017 at 05:47

The problem was solved. In the datasheet it is written that:

'To select/exploit the I2C interface, the CS line must be tied high (i.e. connected to Vdd_IO).'

So, I connected the pin.

Best regards.

View solution in original post

5 REPLIES 5
Miroslav BATEK
ST Employee
Posted on September 15, 2017 at 11:47

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

Posted on September 16, 2017 at 00:21

Could it be the problem?

Also, what is the value of the external resistors?

Best regards.

Legacy member
Not applicable
Posted on September 16, 2017 at 16:23

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.1

David

Posted on September 16, 2017 at 19:07

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.

Khaled Aljehani
Associate III
Posted on September 23, 2017 at 05:47

The problem was solved. In the datasheet it is written that:

'To select/exploit the I2C interface, the CS line must be tied high (i.e. connected to Vdd_IO).'

So, I connected the pin.

Best regards.