cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Timeout waiting for TXIS flag

conner
Associate II
Posted on December 12, 2016 at 17:26

ST Community,

I have been trying to get I2C communication working on my STM32L073RZ Nucleo board for some time now, but to no avail. After doing a bit of stepping through the code, it looks as though a HAL_TIMEOUT occurs when the I2C driver executes the I2C_WaitOnTXISFlagUntilTimeout() function. I have looked through the datasheet for this particular micro to figure out why this flag would not be set, but it is not immediately clear and it is controlled by HW. Is there something wrong with my setup? I am using the code that is generated from CubeMX and the only code that I use is the HAL_I2C_Master_Transmit_DMA() function. I am attaching my main.c file as well as my CubeMX setup file. Any hepl would be greatly appreciated.

Thanks!

Conner

#txis-flag #i2c
2 REPLIES 2
Posted on December 13, 2016 at 01:19

RM0091 says:

The TXIS bit is not set when a NACK is received.

conner
Associate II
Posted on December 13, 2016 at 14:53

Thanks for the response.

It seems that the problem was with the hardware I was connecting the I2C lines to. Even after adding a decent pullup (4.7K resistance) to both the SDA and SCL lines, after the external hardware was powered up, the lines would sag to 2.2V. I believe that this was causing the issue with the TXIS flag not being set, because the software was not able to properly generate a START condition. Once I removed the hardware and hooked a probe up to the SDA and SCL lines, I was able to send a byte of data across the I2C bus and I did not get the HAL_TIMEOUT return. Before, I was not even able to send 1 byte of data and the software was always returning HAL_TIMEOUT.