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 REPLY 1
Imen.D
ST Employee

Hello @diverger ,

I escalated your request internally via ticket number 189051.

(PS: ticket number 189051 is only for reference, not available outside of ST)

Thank you for your contribution.

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