Skip to main content
YKuo.1
Associate II
May 5, 2023
Solved

STM32F429 i2c master transmit always returns busy

  • May 5, 2023
  • 2 replies
  • 3236 views

Hi,

I'm using STM32F429 to talk to TI BQ40Z50 via I2C, and I ran into an issue I have no clue.

First of all, the code simply reads registers, and it works on TI BQ20Z95. The same code doesn't work on BQ40Z50. The HAL library always returns HAL_BUSY, and the error code is 32 (timeout). However, the logic analyzer doesn't have any waveforms. Both SCL and SDA are held high the entire time.

The most puzzling part is that if I disconnect the BQ40Z50, let the STM read registers (reads nothing obviously) several times, and connect the chip back. It works like a charm.

any suggestions I can try?

The I2C is running at 100KHz, with internal pull-up registers.

Thanks!

This topic has been closed for replies.
Best answer by Bob S

Internal pull-ups are too weaker than I2C spec calls for. They may work, most of the time, depending on your hardware configuration. The system will be more reliable with external, lower value resistors.

What IS your hardware configuration? Is this a NUCLEO board wired to TI Eval Boards? Are you connecting GND between the boards? Are you powering the TI board from the NUCLEO?

Look at the I2C lines with a scope instead of a logic analyzer. See what voltage levels you are getting.

2 replies

Bob S
Bob SBest answer
Super User
May 5, 2023

Internal pull-ups are too weaker than I2C spec calls for. They may work, most of the time, depending on your hardware configuration. The system will be more reliable with external, lower value resistors.

What IS your hardware configuration? Is this a NUCLEO board wired to TI Eval Boards? Are you connecting GND between the boards? Are you powering the TI board from the NUCLEO?

Look at the I2C lines with a scope instead of a logic analyzer. See what voltage levels you are getting.

YKuo.1
YKuo.1Author
Associate II
May 8, 2023

Hi Bob,

Thanks for the insight. it was indeed the internal pull-up issue. it works great with external pull-ups.

Thanks!