cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Master_Transmit works, HAL_I2C_Master_Transmit_IT does not.

SoCalJim
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

View solution in original post

2 REPLIES 2
TDK
Guru

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

That was it! Thank you!!!