Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Master_Transmit_DMA sends only one byte

Associate III
Associate III

Sorry i should post this in the question.

i am having an issue using STM32G4 with I2C DMS and FreeRTOS.

I have used the library for a long time with STM32F4 and free RTOS and it works perfectly.

Now I wanted to use it with STM32G4 but the Problem is:

  1. The SCL line stays low when calling:
  2. HAL_I2C_Master_Transmit_DMA(lcdParams.hi2c, lcdParams.address, (uint8_t*)lcdCommandBuffer, 3)
  3.  and it only sends the first byte instead of 3
  4. The program get stuck in:
  5. while (HAL_I2C_GetState(lcdParams.hi2c) != HAL_I2C_STATE_READY) { vTaskDelay(1); }

The hardware doesn’t have any problem because I can print text without DMA using blocking mode with another driver.

I have used USB Scope to inspect the problem and tried a lot of things like resetting I2C with I2C busy flag strange behaviour or reducing the speed but nothing worked.

I have used the same configurations that worked on STM32F4 with STM32G4 in CubeMX but HAL_I2C_Master_Transmit_DMA is not sending the other bytes and the bus is held

Can someone help me please? Thanks.

update 1: I changed the 3 functions to transmit in the library from DMA to blocking mode and it works but not with DMA.