Skip to main content
Visitor II
November 17, 2021
Solved

What is the SPI Timeout for HAL functions exactly?

  • November 17, 2021
  • 2 replies
  • 10041 views

I want to understand the Timeout parameter of the HAL_SPI_Transmit, HAL_SPI_Receive and HAL_SPI_TransmitReceive function.

    This topic has been closed for replies.
    Best answer by TDK

    0693W00000GXuHSQA1.png 

    And

    0693W00000GXuILQA1.png

    2 replies

    Technical Moderator
    November 17, 2021

    Hello @Chrizzly​ ,

    I advise your to check the user manual "Description of STM32XXxx HAL driver" (as this User manual), to have an overview of the HAL drivers with the configuration of the functions, and how to use the given API.

    Imen

    Graduate II
    November 17, 2021
    Function name
    HAL_StatusTypeDef HAL_SPI_Transmit (SPI_HandleTypeDef * hspi, uint8_t * pData, uint16_t Size,
    uint32_t Timeout)
    Function description
    Transmit an amount of data in blocking mode.
    Parameters
    • hspi: pointer to a SPI_HandleTypeDef structure that contains the configuration information for SPI module.
    • pData: pointer to data buffer
    • Size: amount of data to be sent
    • Timeout: Timeout duration
    Return values
    • HAL: status

    Sorry ST Employee, but i dont see here any info about timeout...

    Then for MASTER SPI is timeout only for peripheral is busy from previous oper.

    Or Chrizzly and i may ask crash timeout communication when i use lower time as needed to real transfer data?

    For SLAVE SPI timeout is for wait to master ? Or plus data time ??? USW.

    Explorer
    November 14, 2023

    Did you manage to get answer?

    I cannot figure out how can transmit on master in blocking mode timeout ?!

    • Master is handling CS
    • Master is handling Clock
    • Master is writing to MOSI and reading from MISO

    So even if slave does not exist, is not attached the transmit must go through and transmitreceive will go through and some garbage will be read (from floating pins) but I do not see how a timeout can happen here?

     

    TDKAnswer
    Super User
    November 17, 2021

    0693W00000GXuHSQA1.png 

    And

    0693W00000GXuILQA1.png