Skip to main content
Visitor II
September 26, 2025
Question

Whether flow control byte is needed in the SPI frame for STM32F407?

  • September 26, 2025
  • 4 replies
  • 648 views

Hi,

There is a STM32F407 on my board to configure and control the optical module. Also, STM32F407 use SPI to interface with CPU. STM32F407 work as SPI slave mode, and CPU work as master mode. Some protocol require one flow control byte in SPI timing, such as OIF protocol. My understanding is :

For read operation. After slave receive the operation code and address, slave need time to prepare data according to address then put the data into TX_Buffer. This all will be finished in the one clock period as below red mark shown. If slave can't finish the job in time, slave must inform to host through flow control byte .

JieShen_Jason_0-1758880860560.png

My question is whether flow control byte is needed in the SPI frame for STM32F407?or it can mitigate this issue through reducing the SCK frequency, not through flow control byte?

 

Thanks in advance!

Best regards!

Jason

 

    This topic has been closed for replies.

    4 replies

    Super User
    September 26, 2025

    @JieShen_Jason wrote:

    There is a STM32F407 on my board


    What board is it? Please give details - see: How to write your question to maximize your chances to find a solution

    In particular:

     


    @JieShen_Jason wrote:

    optical module.


    What optical module?

     


    @JieShen_Jason wrote:

    STM32F407 use SPI to interface with CPU.


    What CPU?

     


    @JieShen_Jason wrote:

    My question is whether flow control byte is needed in the SPI frame for STM32F407?


    Whether it's needed or not has nothing to do with the STM32.

    If the STM32 is communicating with a device which uses it, then the STM32 will have to handle it!

    Super User
    September 26, 2025

    > STM32F407 on my board to configure and control the optical module

    So STM32 is master here?

    > STM32F407 work as SPI slave mode

    ???

     

    A flow control byte is not standard in SPI communication. You'll have to work out what you're talking to and whether or not that device needs it. Your architecture doesn't quite make sense.

     

    CPU -> STM32 -> Optical Module

     

    SPI can only have master and slave, not a chain of 3 devices.

    Visitor II
    September 28, 2025

    Hi,

    Thanks for your response in time!

    Sorry that I confuse you. I only care about SPI interface between STM32F407 and CPU, and just mention the optical module. You can ignore optical module. Yes, for SPI interface between STM32F407 and CPU, STM32F407 work as slave mode and CPU work as master mode. My concern is that whether STM32F407 could handle data during one clock period? If not, flow control byte is needed or reduce the frequency of SCK for mitigating it
    The format of flow  control byte is below:

    0x00: ACK, slave could handle this access, and next byte transmitted is data

    0xFF:  NACK, slave couldn't handle current access, and next byte transmitted is flow  control byte too.

    If CPU support flow control function and support it into the SPI  timing, STM32F407 also must support flow control function. And vice versa.

     

    Thanks in advance!

    Best regards!

    Jason

    Super User
    September 29, 2025

    @JieShen_Jason wrote:

    I only care about SPI interface between STM32F407 and CPU


    Still no idea what this mystery "CPU" is

     


    @JieShen_Jason wrote:

    My concern is that whether STM32F407 could handle data during one clock period?


    That's going to depend very much on your system - impossible to give a general answer.

    I'd say the safest way forward is to assume that it won't, and design-in support for this "flow control".

    Then you won't get any nasty surprises...

    Visitor II
    September 30, 2025

    Hi

    Thanks! The mystery "CPU" is Intel Xeon D1627 :). 

    SPI of MCU is driven by software, and it don't like some peripheral device which use hardware circuit to drive SPI interface. So, I will add this flow control byte firstly according to your suggestion.

     

    Thanks in advance!

    Best regards!

    Jason

    Visitor II
    October 9, 2025

    Hi:

    get it!

    Thanks!

     

    Best regards!

    Jason