Skip to main content
Senior
August 21, 2024
Question

Why check only the 'hspi->hdmarx' in the 'HAL_SPI_TransmitReceive_DMA()' for STM32U5?

  • August 21, 2024
  • 1 reply
  • 905 views

Hi,

For the SPI transfer APIs with suffix '_DMA'. In the transmit and receive alone ones, they checked 'hspi->hdmatx' and 'hspi->hdmarx' respectively. But in 'HAL_SPI_TransmitReceive_DMA()', it only check the 'hspi->hdmarx'. Funny :), and why?

 

 /* Packing mode management is enabled by the DMA settings */
 if (((hspi->Init.DataSize > SPI_DATASIZE_16BIT) && (hspi->hdmarx->Init.DestDataWidth != DMA_DEST_DATAWIDTH_WORD) && \
 (IS_SPI_FULL_INSTANCE(hspi->Instance))) || \
 ((hspi->Init.DataSize > SPI_DATASIZE_8BIT) && (hspi->hdmarx->Init.DestDataWidth == DMA_DEST_DATAWIDTH_BYTE)))
 {
 /* Restriction the DMA data received is not allowed in this mode */
 /* Unlock the process */
 __HAL_UNLOCK(hspi);
 return HAL_ERROR;
 }

 

Thanks.

 

This topic has been closed for replies.

1 reply

ST Technical Moderator
August 21, 2024

Hello @diverger,

I have passed this issue along to our development team for fix via an internal ticket number 189085 (this ticket number is only for reference and not available outside of ST).

Thank you for your contribution.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks