cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743: DMA constantly returns error HAL_DMA_ERROR_DME, no data transfer done.

QuBi
Associate

Hello,

I'm working on target STM32H743ZI.

I would like to copy a memory buffer to the SAI interface (master).

For some reason, when calling the function HAL_SAI_Transmit_DMA in the main, no transfer occurs.

Going through more details, it seems that the DMA raises the HAL_DMA_ERROR_DME.

The error seems to be specific to direct mode/peripheral to memory transfer, though I'm using neither of that, since the DMA FIFO is enabled and the transfer goes from memory to peripheral.

The buffer of data I'd like to transfer is located at 0x2400_000, so this other DMA-related issue does not apply here (https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices).

Detailed DMA configuration :

hdma_sai1_a.Instance                 = DMA1_Stream0;

hdma_sai1_a.Init.Request             = DMA_REQUEST_SAI1_A;

hdma_sai1_a.Init.Direction           = DMA_MEMORY_TO_PERIPH;

hdma_sai1_a.Init.PeriphInc           = DMA_PINC_DISABLE;

hdma_sai1_a.Init.MemInc              = DMA_MINC_ENABLE;

hdma_sai1_a.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

hdma_sai1_a.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;

hdma_sai1_a.Init.Mode                = DMA_CIRCULAR;

hdma_sai1_a.Init.Priority            = DMA_PRIORITY_VERY_HIGH;

hdma_sai1_a.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;

hdma_sai1_a.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;

hdma_sai1_a.Init.MemBurst            = DMA_MBURST_SINGLE;

hdma_sai1_a.Init.PeriphBurst         = DMA_PBURST_SINGLE;

I tried various alignments, bursts configuration, priority, ... It does not change anything.

Most of the code was generated automatically using STM32CubeIDE, so there is not much of my own code running here.

main.c sample code:

...
#define SAMPLES_BUFF_SIZE_WORDS 128
#define SAMPLES_BUFF_SIZE_BYTES 512
 
uint8_t samples_buff[SAMPLES_BUFF_SIZE_BYTES] = 
{
  #include "wave_LUT.txt"
};
...
HAL_SAI_Transmit_DMA(&hsai_BlockA1, samples_buff, SAMPLES_BUFF_SIZE_WORDS);
 
 

Also, I'm not so sure about the exact value expected for the size argument in "HAL_SAI_Transmit_DMA". Is it expressed in bytes? in words?

Data transfer to SAI without DMA works fine.

Thanks in advance,

Regards,

Q

2 REPLIES 2
TDK
Guru

> Also, I'm not so sure about the exact value expected for the size argument in "HAL_SAI_Transmit_DMA". Is it expressed in bytes? in words?

It's expressed in units of your transfer size, which in this case is a word.

Show the values in the DMA1_Stream0 registers.

If you feel a post has answered your question, please click "Accept as Solution".
QuBi
Associate

Hi there.

Problem solved.

In the code generated from the CubeIDE, the function MX_DMA_Init() was not the first to be called among the all list of init functions.

Thanks a lot Icont.1 and Imen DAHMEN from https://community.st.com/s/question/0D53W00001BQv6oSAD/hali2cmemreaddma-return-error

This did not solve your problem unfortunately, but solved mine 🙂

Regards,

Q