cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] STM32F4 I2C Master Clock Stretching Fail

Kyle Klumper
Associate II
Posted on September 26, 2017 at 02:56

Hi there,

I am attempting to get an STM32F411CE microcontroller to interface with a BNO055 IMU using the I2C peripheral. This particular IMU uses clock stretching which doesn't seem to work with the HAL_I2C library that was auto-generated from STM32CubeMX. See image below:

0690X00000608QMQAY.png

I attached a second I2C device to the bus and was able to communicate with the library so I'm pretty sure it is only the clock stretching that is causing an issue.

As a reference, here is a waveform of an Atmel microcontroller interfacing with the same BNO055 device and it appears to be working as intended:

0690X00000608N3QAI.png

Any ideas on what could be causing this issue?

Thanks,

Kyle

10 REPLIES 10
Bob S
Principal

What makes you think your code isn't working?

You thought maybe it keeps the line low? Show us the logic analyzer traces along with the data that your code receives.

Does the device really expect two separate I2C transactions to read data? Or is it expecting one transaction with a "repeat start" in the middle? Check the return values from the HAL calls and make sure they return HAL_OK before you try to use the angleData.