cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U575 I2C LPDMA Data Transfer Error(DMA_FLAG_DTE) for Data Transfer

APati.9
Associate

Hi Team,

I have configured the I2C in Master Mode and Enabled LPDMA channel 2 and 3 respectively for I2C3Tx and I2C3Rx.

/* I2C3 DMA Init */

  /* LPDMA1_REQUEST_I2C3_TX Init */

  handle_LPDMA1_Channel2.Instance = LPDMA1_Channel2;

  handle_LPDMA1_Channel2.Init.Request = LPDMA1_REQUEST_I2C3_TX;

  handle_LPDMA1_Channel2.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;

  handle_LPDMA1_Channel2.Init.Direction = DMA_MEMORY_TO_PERIPH;

  handle_LPDMA1_Channel2.Init.SrcInc = DMA_SINC_INCREMENTED;

  handle_LPDMA1_Channel2.Init.DestInc = DMA_DINC_FIXED;

  handle_LPDMA1_Channel2.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE;

  handle_LPDMA1_Channel2.Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;

  handle_LPDMA1_Channel2.Init.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT;

  handle_LPDMA1_Channel2.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;

  handle_LPDMA1_Channel2.Init.Mode = DMA_NORMAL;

  if (HAL_DMA_Init(&handle_LPDMA1_Channel2) != HAL_OK)

  {

   Error_Handler();

  }

  __HAL_LINKDMA(hi2c, hdmatx, handle_LPDMA1_Channel2);

  if (HAL_DMA_ConfigChannelAttributes(&handle_LPDMA1_Channel2, DMA_CHANNEL_NPRIV) != HAL_OK)

  {

   Error_Handler();

  }

  /* LPDMA1_REQUEST_I2C3_RX Init */

  handle_LPDMA1_Channel3.Instance = LPDMA1_Channel3;

  handle_LPDMA1_Channel3.Init.Request = LPDMA1_REQUEST_I2C3_RX;

  handle_LPDMA1_Channel3.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;

  handle_LPDMA1_Channel3.Init.Direction = DMA_PERIPH_TO_MEMORY;

  handle_LPDMA1_Channel3.Init.SrcInc = DMA_SINC_FIXED;

  handle_LPDMA1_Channel3.Init.DestInc = DMA_DINC_INCREMENTED;

  handle_LPDMA1_Channel3.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE;

  handle_LPDMA1_Channel3.Init.DestDataWidth = DMA_DEST_DATAWIDTH_BYTE;

  handle_LPDMA1_Channel3.Init.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT;

  handle_LPDMA1_Channel3.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;

  handle_LPDMA1_Channel3.Init.Mode = DMA_NORMAL;

  if (HAL_DMA_Init(&handle_LPDMA1_Channel3) != HAL_OK)

  {

   Error_Handler();

  }

  __HAL_LINKDMA(hi2c, hdmarx, handle_LPDMA1_Channel3);

  if (HAL_DMA_ConfigChannelAttributes(&handle_LPDMA1_Channel3, DMA_CHANNEL_NPRIV) != HAL_OK)

  {

   Error_Handler();

  }

  /* I2C3 interrupt Init */

  HAL_NVIC_SetPriority(I2C3_EV_IRQn, 0, 0);

  HAL_NVIC_EnableIRQ(I2C3_EV_IRQn);

Configured I2C as Master and Standard Mode.

Now if Tried to send 10bytes of data using

HAL_I2C_Master_Transmit_DMA(&hi2c3, 0x3A, tx_bufferTemp, 10);

I am getting error at DMA_TX handler as

if ((__HAL_DMA_GET_FLAG(hdma, DMA_FLAG_DTE) != 0U))

 {

  /* Check if interrupt source is enabled */

  if (__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_DTE) != 0U)

  {

   /* Clear the transfer error flag */

   __HAL_DMA_CLEAR_FLAG(hdma, DMA_FLAG_DTE);

   /* Update the DMA channel error code */

   hdma->ErrorCode |= HAL_DMA_ERROR_DTE;

  }

 }

Please look into this issue and help to move forward to communicate with external sensor.

3 REPLIES 3

What Sensor?

Does it work in Polled operation?

Is the address you're using in memory visible to the LPDMA1 unit?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
APati.9
Associate

@Community member​ : Yes it is working in polling mode and tested. It is magnetic sensor.

What is the mean of memory visible to the LPDMA1 unit?

GDC
Associate II

@APati.9

Maybe Tesla referred to

"The SRAM4 is the only SRAM that can be accessed by the LPDMA1"

-> Reference Manual -> 2.1.13 SmartRun Domain

____________________________________________________________

What do you think about AI? What would AI think about us?