cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7RS GPDMA Circular w/ Linked List issue

Deimos
Associate II

Hello,

Using a NUCLEO H7S3L8, I'm trying to run a test where, using circular DMA with a linked list, I'm trying to send a buffer in memory over to the SAI for audio playback, using an external DAC. This configuration is based on either other tutorials or the reference manual, but it always throws a User Error flag and calls the DMA's IRQ handler, right after the HAL_DMAEx_List_Start_IT() call (whether done on its own after the necessary configuration, or as part of HAL_SAI_Transmit_DMA()). 
Even with some changes, it always yields the same results. The only one that seemed to have any effect was setting the Transfer Event mode to trigger the TC flag for each linked list item, which confirmed that a transfer might have been completed, despite the error flag.

I have also seen GPDMA being configured with circular, using both Standard Request Mode and a Linked List, but haven't gotten any success out of that myself (with even TC flag not being raised).
In case it causes any complications, the board also is configured as a USB Audio device (leftover from previous test, not used currently), and the SAI is configured at 16 bits, at 48 kHz.

Below are images of the configuration:

GPDMA.png

 

LL1.png

 

 

LL2.png

I'll also leave main.c of the application project, where the only parts of relevant user code have been written.

Any help or advice would be greatly appreciated.

11 REPLIES 11

Hello @Deimos ,

 

Thank you for your reply.

I have tried to take the reference from example code: DMA_LinkedList and DAC_SignalGeneration_DMA. If I run both this examples as it is then they work well. But if I modify DMA_LinkedList for sending output on external pin then it does not work. 

1. DAC_SignalGeneration_DMA - This example if you see then it has the linked_list.c file in it. Also, in main.c file queue is linked and other important steps. But actually at the start of transmission, src buffer is passed in argument. In main.c file,

if (HAL_DAC_Start_DMA(&hdac1, DAC_CHANNEL_1, &data_sin[0], 128, DAC_ALIGN_12B_R) != HAL_OK)
  {
    /* Start DMA Error */
    Error_Handler();
  }

I feel like it is pure DMA transmission only for DAC. Not DMA+linked list transmission. In linkedlist.c file, Node's source address and dest address are set to 0. In this way the node is added and queue is circular queue.

2. DMA_LinkedList - This example is transferring data between RAM to RAM using linked list. it does not have DAC into it. 

So, I tried to combine these examples.  

I have attached the DAC_SignalsGeneration_DMA.ioc which can be found in STM32U575 examples as well. 

I am not using it for Audio output purpose.

Thank you very much again.

Regards,

Malay

First off, sorry for taking a while to get back to you, it has been busy lately.

Second, unfortunately, I can't make any specific notes on why your code can't work, without it or your ioc specifically, or a board to test things with, but to make some notes on the LL mode of the GPDMA that may answer some of your points:
The HAL function for DAC_Start_DMA accounts for both LL transfers and not (looking at the function body in stm32u5xx_hal_dac.c, l.733 in your case).
In linked_list.c, the config values for source/destination/size are left as 0 because the DAC_Start_DMA function changes them regardless, based on the arguments given.
The example you've mentioned works with the LL mode (circular), because it sets up a continuous stream of a wave on a button press, only to be stopped/reconfigured on another press. In your case, if you want a simple, non-continuous transmission of a buffer triggered by a function call or a timer, you probably should do a plain DMA transfer. LL would only be useful in linear mode if there were any consecutive transfers, or reconfiguration of the GPDMA was necessary during the transfer.

I'd recommend making a separate post for your issue, and posting your ioc/code there, it's possible you could get more to-the-point input.