Skip to main content
Associate
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?

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

mƎALLEm
Technical Moderator
February 29, 2024

Hello,

See this thread. Hope it helps.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate
February 29, 2024

I'm not sure, please other answers

mƎALLEm
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.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Andrew Neil
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?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.