Skip to main content
Explorer
December 5, 2024
Solved

SPI communication - interval between bytes

  • December 5, 2024
  • 1 reply
  • 1196 views

Question about SPI communication interval

We are using HAL_SPI_TransmitReceive to achieve SPI communication, but there is an interval of some us after the SCLK outputs for 8 bits. Is it possible to change this interval time?

    This topic has been closed for replies.
    Best answer by Andrew Neil

    That's probably just the overhead in the HAL code while it handles completion of the previous byte, fetches the next byte, and starts transmission of that next byte.

     


    @pass3master wrote:

    Is it possible to change this interval time?


    What compiler optimisation level are you currently using? What happens if you increase it?

    Have you tried using DMA?

    Otherwise, optimise the code by hand.

    1 reply

    Super User
    December 5, 2024

    That's probably just the overhead in the HAL code while it handles completion of the previous byte, fetches the next byte, and starts transmission of that next byte.

     


    @pass3master wrote:

    Is it possible to change this interval time?


    What compiler optimisation level are you currently using? What happens if you increase it?

    Have you tried using DMA?

    Otherwise, optimise the code by hand.

    Explorer
    December 5, 2024

    Thank you for your response.
    I see what you mean!

    Then we can optimize the HAL code or use DMA for SPI communication!