cancel
Showing results for 
Search instead for 
Did you mean: 

Chip select pin for SPI

arslanoglu
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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).

View solution in original post

5 REPLIES 5
SofLit
ST Employee

Hello,

See this thread. Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I'm not sure, please other answers

Andrew Neil
Chief III

@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?

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 on "Accept as Solution" on the reply which solved your issue or answered your question.

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).