cancel
Showing results for 
Search instead for 
Did you mean: 

The purpose of the 'if ((hspi->hdmatx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST)' in STM32U5 SPI transfer with DMA APIs

diverger
Senior

Hi,

I'm trying to combine the SPI and GPDMA on STM32U5. In the various SPI transfer APIs with suffix '_DMA', I can see the code below:

/* Enable the Tx DMA Stream/Channel */ if ((hspi->hdmatx->Mode & DMA_LINKEDLIST) == DMA_LINKEDLIST) { if (hspi->hdmatx->LinkedListQueue != NULL) { /* Set DMA data size */ hspi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CBR1_DEFAULT_OFFSET] = hspi->TxXferCount; /* Set DMA source address */ hspi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CSAR_DEFAULT_OFFSET] = (uint32_t)hspi->pTxBuffPtr; /* Set DMA destination address */ hspi->hdmatx->LinkedListQueue->Head->LinkRegisters[NODE_CDAR_DEFAULT_OFFSET] = (uint32_t)&hspi->Instance->TXDR; status = HAL_DMAEx_List_Start_IT(hspi->hdmatx); } else { status = HAL_ERROR; } } else { status = HAL_DMA_Start_IT(hspi->hdmatx, (uint32_t)hspi->pTxBuffPtr, (uint32_t)&hspi->Instance->TXDR, hspi->TxXferCount); }

It seems the code try to support the 'DMA_LINKEDLIST' mode. But can't find a way to set it to 'DMA_LINKEDLIST' in the .ioc file. So, how ST expect us to use this mode?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @diverger ,

You can specify the DMA_LINKEDLIST mode through GPDMA1 Mode and configuration on STM32CubeMX (please see attachment files).
The Execution Mode can be: Circular or Linear (By Default) 

  • Circular Mode :

 

handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR; #define DMA_LINKEDLIST_CIRCULAR (DMA_LINKEDLIST | (0x01U)​

 

  • Linear Mode :

 

handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_NORMAL; #define DMA_LINKEDLIST_NORMAL DMA_LINKEDLIST​

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

2 REPLIES 2
Imen.D
ST Employee

Hello @diverger ,

You can specify the DMA_LINKEDLIST mode through GPDMA1 Mode and configuration on STM32CubeMX (please see attachment files).
The Execution Mode can be: Circular or Linear (By Default) 

  • Circular Mode :

 

handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR; #define DMA_LINKEDLIST_CIRCULAR (DMA_LINKEDLIST | (0x01U)​

 

  • Linear Mode :

 

handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_NORMAL; #define DMA_LINKEDLIST_NORMAL DMA_LINKEDLIST​

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Imen.D
ST Employee

Hi @diverger ,

Did the solution shared solve your problem?

I'll be waiting for your feedback :) 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen