Skip to main content
Visitor II
February 29, 2024
Solved

Chip select pin for SPI

  • February 29, 2024
  • 2 replies
  • 9270 views

I want to communicate with STM32f427 processor and 3 sensors via SPI. I want to use only SPI1 line. I need 3 chip select pins. There are 2 SPI1_NSS pins on the datasheet of the processor. What can I use as 3 CS pins? Is any GPIO pin suitable?

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

    YES, all the nCS signal in SPI SW mode - generate the nCS signals yourself (via toggling GPIOs). Works fine (I use it).

    Bear in mind: you can (should) use nSS (nCS) in SW mode: you cannot use the intended SPI nSS HW signal in HW mode (it would toggle all the time with a new SPI transaction). All nCS signals are now a GPIO signal. You can use the intended GPIO (pin) for nSS also in GPIO mode: just make sure you do not configure all the nSS signal as SPI nSS signal (instead as a GPIO).

    2 replies

    Technical Moderator
    February 29, 2024

    Hello,

    See this thread. Hope it helps.

    Visitor II
    February 29, 2024

    I'm not sure, please other answers

    Technical Moderator
    February 29, 2024

    You need to emulate CS signals by GPIOs .. Each time you need to read from/write to a slave you need to activate its corresponding "chips select" by GPIO pins.

    Super User
    February 29, 2024

    @arslanoglu wrote:

     Is any GPIO pin suitable?


    Yes.

    But you will have to manage it manually - which may mean that you also need to manage the other two manually?