Skip to main content
Associate III
Mar 28, 2025 11:15 PM UTC
Solved

HAL_I2C_Master_Transmit works, HAL_I2C_Master_Transmit_IT does not.

I’m trying to replace a blocking call to HAL_I2C_Master_Transmit() with the interrupt version HAL_I2C_Master_Transmit_IT(). The blocking HAL_I2C_Master_Transmit() call works perfectly. The HAL_I2C_Master_Transmit_IT() call sends completely different data. Specifically:

My buffer contains: 00 00 00 00 00 00 00 BF 00 3F 00 00 00 00 00 00 00

When I call HAL_I2C_Master_Transmit(&hi2c4, I2C_ADDRESS, buffer, 17, 100), I see this:

1.png

When I call HAL_I2C_Master_Transmit_IT(&hi2c4, I2C_ADDRESS, buffer, 17), I see unrecognized data:

2.png

I’m using a STM32H755.

This topic has been closed for replies.
TDK
TDKBest answer
Mar 28, 2025 11:47 PM UTC

Probably the buffer you are sending is going out of scope before the transfer completes. Use a global variable.

"If you feel a post has answered your question, please click ""Accept as Solution""."

2 replies

TDK
TDKBest answer
Mar 28, 2025 11:47 PM UTC

Probably the buffer you are sending is going out of scope before the transfer completes. Use a global variable.

"If you feel a post has answered your question, please click ""Accept as Solution""."
SoCalJimAuthor
Associate III
Mar 29, 2025 2:30 AM UTC

That was it! Thank you!!!