cancel
Showing results for 
Search instead for 
Did you mean: 

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

diverger
Senior

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.

 

1 REPLY 1
Imen.D
ST Employee

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.

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