cancel
Showing results for 
Search instead for 
Did you mean: 

I2C DMA issues with latest HAL

AndyJT
Associate III
Posted on December 15, 2016 at 16:04

I'm trying to get I2C to work in DMA mode from STM32Cube_FW_F7_V1.5.1

My first error was that the I2C handle remains busy after the first DMA transfer is complete.

I've looked at the procedure  I2C_DMAMasterTransmitCplt in stm32f7xx_hal_i2c.c which gets called by DMA1_Stream0_IRQHandler()

It appears as though this code is vastly changed from v1.3.0 HAL and I can't immediately see how the DMA complete handler will reset the I2CHandle.State to be HAL_I2C_STATE_READY

As a test I've also tried Transmitting 4000 bytes through the I2C with:

HAL_I2C_Master_Transmit_DMA(&I2C1Handle, I2C_ADDRESS, OutBuf, 4000);

I've found that the 

DMA1_Stream0_IRQHandler() is called after 255 bytes are transmitted

I then call HAL_DMA_IRQHandler(I2C1Handle.hdmatx);

From then on, the I2C remains busy but no further bytes are transmitted.

Am I missing some more code within the DMA1_Stream0_IRQHandler procedure ?

A working example of I2C DMA tx and rx using the latest HAL would be great

Regards

1 REPLY 1
AndyJT
Associate III
Posted on December 15, 2016 at 17:04

Ok, I've found part of the culprit, I had commented out the HAL_NVIC_EnableIRQ(I2C1_EV_IRQn); line in my I2C msp initialistation so I2C1_EV_IRQHandler wasn't getting called.

Things are working better now but still doesn't want to transmit more than 255 bytes....