Skip to main content
Graduate
December 30, 2023
Question

H5 DMA - How to start

  • December 30, 2023
  • 3 replies
  • 2243 views

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?

    This topic has been closed for replies.

    3 replies

    Super User
    December 30, 2023

    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 . :)

    TheRaprusAuthor
    Graduate
    December 30, 2023

    Thanks Kudos.

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

    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.

    Super User
    December 30, 2023

    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 ...

    ST Employee
    January 5, 2024

    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).