cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8 I2C DMA transfer complete callback

Alexey Zhukov
Associate
Posted on December 29, 2017 at 12:16

I'm trying to write a code to send data with I2C using DMA. While looking for appropriate 'Transmit complete' event I've dig into STM32Cube_FW_F1_V1.6.0 sources, to be specific into stm32f1xx_hal_i2c.c's HAL_I2C_Master_Transmit_DMA function. This function contains such a code (line 2012):

/* Set the I2C DMA transfer complete callback */

hi2c->hdmatx->XferCpltCallback = I2C_DMAXferCplt;

And that XferCpltCallback called from HAL_DMA_IRQHandler. But what's I2C_DMAXferCplt for? It is in the same stm32f1xx_hal_i2c.c file and contains (line 5228) such a call:

HAL_I2C_MasterRxCpltCallback(hi2c);

So, 'Transmit' function calls 'Rx' callback only and completely misses more suitable 'Tx'. Isn't that strange and may be that's a bug? Or I've missed something here?

#i2c-write #d
0 REPLIES 0