cancel
Showing results for 
Search instead for 
Did you mean: 

H5 DMA - How to start

TheRaprus
Associate III

I'm trying to implement a SPI transfer between flash and SPI2 - a simple display. I'm using LL everywhere.
No problem with M3 and M4 - But GPDMA is completely different. "Normal" SPI work but no way to enable DMA.

Based on the only example with LL (All the examples are flash to ram only!). I wrote this:

LL_DMA_SetSrcAddress(GPDMA1, LL_DMA_CHANNEL_0, (uint32_t)&icon1);
LL_DMA_SetDestAddress(GPDMA1, LL_DMA_CHANNEL_0, LL_SPI_DMA_GetTxRegAddr(SPI2));
LL_DMA_SetBlkDataLength(GPDMA1, LL_DMA_CHANNEL_0, icon1_size_byte);

/* Enable DMA transfer complete/error interrupts */
LL_DMA_EnableIT_TC(GPDMA1, LL_DMA_CHANNEL_0);
LL_DMA_EnableIT_DTE(GPDMA1, LL_DMA_CHANNEL_0);

/* Start the DMA transfer Flash to Memory */
LL_DMA_EnableChannel(GPDMA1, LL_DMA_CHANNEL_0);

Icon size is about 2kB. Unfortunately no interrupt occours.
I'll hope that some example will be added on the next H5 update (HAL &LL).

Any suggestions?

4 REPLIES 4
AScha.3
Chief II

But GPDMA is completely different - that already took me some hours.

Here example, how to write the magic "list" , for dma -> SAI tx + rx :

https://github.com/STMicroelectronics/stm32h573i-discovery-bsp/blob/main/stm32h573i_discovery_audio.c#L2709

But with HAL ...+ i got it working . 🙂

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

Thanks Kudos.

Just a quick glance, but seems very hard... for the LL and flash to RAM only a couple of commands 🤔

But... The LLI (Linked List) seems very complicate and hard to understand. Are they necessary for this case?  

I will study the code again, but on M3/M4 was easiest.

Linked List is not necessary, the dma has an "standard mode" :

AScha3_0-1703955443131.png

But - i didnt get it working....so i tried the list-mode from the example and it worked as it should.

 

M3/M4 was more easy, also on H7 i had no problems. It seems, STM wants to raise the bar ...

If you feel a post has answered your question, please click "Accept as Solution".
Sarra.S
ST Employee

Hello @TheRaprus

>>I'll hope that some example will be added on the next H5 update (HAL &LL).

Thank you for the suggestion, LL examples of SPI with DMA (master and slave) will be added soon 

This request is tracked internally (Ticket 164113).

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.