Skip to main content
Graduate
April 15, 2025
Question

SPI NSS cannot be switched in software mode

  • April 15, 2025
  • 2 replies
  • 581 views

I am trying to use SPI communication with the STM32H562 (for FPGA programming purposes).

 

The reference manual states that if SPI_CFG2's SSM = 1, the NSS can be toggled High/Low by switching the SSI bit in SPI_CR1.

However, the switching of SSI is not reflected in the oscilloscope observations.

Additionally, I tried setting the NSS port as GPIO instead of SPI communication and using HAL_WritePin to configure it, but this was also not reflected.

When using the NSS port for SPI, should I set the start register bits such as SPE and CSTART?

    This topic has been closed for replies.

    2 replies

    Super User
    April 15, 2025

    @Thoufiel wrote:

    The reference manual states that if SPI_CFG2's SSM = 1, the NSS can be toggled High/Low by switching the SSI bit in SPI_CR1.


    No, that's not what it says:

    AndrewNeil_2-1744712815506.png

     

     

     

     

     

    ThoufielAuthor
    Graduate
    April 16, 2025

    Thank you for your reply.

     

    I had read that section before my initial question, and regarding the content just before the red line,

    I understood it as "Slave select can be performed by setting the SSI bit."

    What does "internally" mean in this context?

    Super User
    April 16, 2025

    I guess it means something internal (so, your software?) has to do it by manipulating the SSI bit ?

    Perhaps @STTwo-32 could clarify ?

    Super User
    April 15, 2025

    In an SPI master, you can either use the NSS pin as SPI hardware-controlled, or you can configure it as GPIO.

    If a slave, it should be hardware controlled.

    > Additionally, I tried setting the NSS port as GPIO instead of SPI communication and using HAL_WritePin to configure it, but this was also not reflected.

    Show relevant code and hardware setup. Controlling the pin as GPIO should be relatively simple exercise.

    > When using the NSS port for SPI, should I set the start register bits such as SPE and CSTART?

    Yes. The peripheral needs to be enabled in order for it to do anything.