cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f0DISC board i2c device communication problem

joohyun lee
Associate
Posted on March 28, 2018 at 04:38

I'm using stm32f051R8Tx(stm32f0discovery) and I'm trying to connect with i2c devices

I used HAL-driver that CUBEMX provides and i succeeded  to communicate with i2c LCD device(LCD1602A).

LCD works really well.

However, I also used mpu6050, i2c gyro sensor, in a same code, I cannot get this thing work.

I used debug session and it seems like acknowledge problem.

there are some people who have similar issues and they solved this problem with shifting address to the left.

so I tried address left shifting as well but mine doesn't work. 

anybody can help? 

2 REPLIES 2
Andrew Neil
Chief II
Posted on March 28, 2018 at 09:41

I'm using stm32f051R8Tx(stm32f0discovery)

So this: 

http://www.st.com/en/evaluation-tools/stm32f0discovery.html

 ?

I also used mpu6050, i2c gyro sensor, in a same code, I cannot get this thing work.

Do they work individually?

None of these things is actually part of the 

stm32f0discovery - so you must have added them externally.

How have you confirmed that your wiring is correct?

I used debug session and it seems like acknowledge problem.

That's a good start - so what further investigation/testing/debugging have you done based on that observation?

http://www.8052mcu.com/faqs/120313

 

The obvious first question (after checking wiring) is: do you have the Slave Addresses correct?

GenuineDeveloper
Associate III
Posted on March 28, 2018 at 11:40

so I tried address left shifting as well but mine doesn't work.

How did you left shift the address?

Are you using the same code for all the other devices you mentioned? If that's the case, do pay attention to I2C timing register values(derived from Cube MX), Slave address? I2C pull-up resistors?