cancel
Showing results for 
Search instead for 
Did you mean: 

Missing I2C DMA TxCpltCallback on STM32F103C8T6 Firmware F1.8.0

JSchu.2
Associate

Hi folks,

i recently tried to migrate my SSD1306-I2C-display driver using DMA from "STM32Cube FW_F1 V1.6.1" to the latest "STM32Cube FW_F1 V1.8.0".

The driver uses HAL_I2C_Mem_Write_DMA(..) routines and worked just fine on the old Cube firmware. Now with the latest one the related HAL_I2C_MemTxCpltCallback() at the end of DMA transfer does not get called. Instead the controller ends up in the HardFault_Handler.

Cube-settings for DMA are taken like that:

-DMA is set up to TX mode in cube

-DMA1 channel6 global interrupt is enabled

-I2C1 event interrupt is enabled

(just the same settings that worked fine in FW_F1 V1.6.1)

you will find my code that uses the HAL_I2C-routines attached.

Hope someone can tell me whats wrong

0690X00000DYlTKQA1.png

1 REPLY 1
JSchu.2
Associate

Finally i found a workaround that made I2C-Tx-DMA work again in STM32Cube FW_F1 V1.8.0

There are two things to do:

  1. in the HAL-generated main(), the order of hardware modules initialisation routines needs to be changed so that "MX_DMA_Init()" gets initialized before "MX_I2C1_Init()" does. Otherwise for some reason the "DMA1_Channel6_IRQHandler(void)" in smt32f1xx_it.c does not get called.
  2. The driver-module stm32f1xx_hal_i2c.c in project folder Drivers/STM32F1xx_HAL_Driver/src needs to be replaced by the corresponding module of old FW_F1 V1.6.1. In the module, there is a siginficant difference in the DMA-it-Callback related function "I2C_DMAXferCplt(DMA_HandleTypeDef *hdma)". For example in the recent version the I2C_EV_Interrupt gets disabled in this function (no idea how this could be expedient).

If anybody has a hint on how I2C-Tx-DMA is intended to be used in STM32Cube FW_F1 V1.8.0, postings are welcome.