2024-08-21 01:00 AM
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.
Solved! Go to Solution.
2024-08-21 02:14 AM - edited 2024-08-22 06:15 AM
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)
handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR;
#define DMA_LINKEDLIST_CIRCULAR (DMA_LINKEDLIST | (0x01U)
handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_NORMAL;
#define DMA_LINKEDLIST_NORMAL DMA_LINKEDLIST
2024-08-21 02:14 AM - edited 2024-08-22 06:15 AM
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)
handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR;
#define DMA_LINKEDLIST_CIRCULAR (DMA_LINKEDLIST | (0x01U)
handle_GPDMA1_Channel15.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_NORMAL;
#define DMA_LINKEDLIST_NORMAL DMA_LINKEDLIST
2024-08-27 07:30 AM
Hi @diverger ,
Did the solution shared solve your problem?
I'll be waiting for your feedback :)