STM32U5 : GPDMA sort of double buffering with LLI and buffer looping
Hello,
I'm working on a led display solution and I'm using a STM32U5 with GPDMA to pilot daisy-chained shift-registers through GPIOs. I could have used the SPI interface but I'm driving several differents chains of shift registers and I prefer to make bit-banging with DMA > GPIO.BSRR registers.
Everything is working but sometimes we can observe glitches in the led display. We think that is because we are modifying the buffer sent by the DMA at the middle of a frame. Currently, there is not synchronisation between the application and the DMA transfers.
We think it would be better to use double buffering, one for storing the current display data, and one for the future data to be displayed. We don't want to update very often the data to be displayed so we called sometimes a function that do the job of updating the content to be displayed, so ideally the DMA should loop on the same buffer and switches to the second buffer only when the function is called.
In the following schematic, I've tried to represent our needs :

Do you have any idea how to do this task ? I'm not sure it is actually the "normal operation" of a double buffering system because we need to loop on the same LLi until the SW switches to the 2nd LLi and vice versa.
The best solution for me would be without interrupting the application (we don't use Half and Complete Transfer IT) and do the switch automatically at the end of one LLi to the 2nd LLi (to start on a fresh new updated buffer).
Best regards.
Lilian.
