cancel
Showing results for 
Search instead for 
Did you mean: 

I2C DMA Address Ack Failure

akhanna
Associate
Posted on October 22, 2015 at 19:28

Dear All,

I am making calls to the HAL_I2C_Mem_Read_DMA, HAL_I2C_Mem_Write_DMA provided by the STM32HAL driver, and in some cases expecting a Address ACK failure. It seems that the implementation of these functions involves a call first to the HAL_DMA_START_IT, which enables the DMA stream, and then proceeds to send the slave address/ memory address. However, since I expect there to be an Address ACK failure (I am trying to find multiple devices out of which only some of them will be discovered), the DMA transfer is started before the slave/ memory address is sent over, and we are constantly waiting for the DMA transfer to complete. If I swap the order-- the Slave and Memory Address is sent before the DMA transfer has been started up-- then everything works as expected. That is, I get a HAL_I2C_ERROR_AF and the DMA transfer has not been started because the call to HAL_I2C_Mem_Read_DMA has returned HAL_ERROR.

Firstly, is there a reason for the current ordering scheme of starting the DMA transfer for I2C peripheral before the sending of the slave and memory address? And, if that is so, would it be possible to somehow disable the stream (without completing the currently scheduled DMA transfer because I have tried to HAL_DMA_DeInit and HAL_DMA_Abort and they wait for the current transfer to complete before disabling the stream) and cleanly handle the Address ACK failure.

Thanks!

#board #stm32 #i2c #i2c #hal #hal #dma #discovery #cubemx
2 REPLIES 2
Amel NASRI
ST Employee
Posted on November 05, 2015 at 16:53

Hi khanna.advitya.001,

Thanks for highlighting this issue. It is a known bug, but the fix has not yet been released on the web. It will be available in a coming release of STM32CubeF4 package (most probably V1.11.0).

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

rui
Associate II
Posted on November 06, 2015 at 10:34

Hello Mayla,

I use now HAL_I2C_Mem_Write() and HAL_I2C_Mem_Read(), there is the same poblem with my program, is it also a bug?

Thanks

Ricy