cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware problem with NSS pin on SPI

Natsu
Associate II

I cannot to set NSS pin in push-pull mode. What is may be wrong?

I use SPI1 on stm32F7 as a master only mode with SSOE config bit. My system use SPI clock speed 13,5 MHz. GPIOA#4 is used as NSS pin alternative function 5, push-pull output.

This configuration does not work, but if I set pull-up mode on NSS pin I see (NSS is yellow):

0693W00000FC0s2QAD.bmp

7 REPLIES 7

As soon as you disable SPI (i.e. clear SPI_CR1.SPE), all pins related to SPI (including NSS) are not driven anymore (i.e. they are high-Z).

NSS as it is implemented in hardware is not very useful and you may want to set it as GPIO Output and control it "manually".

JW

S.Ma
Principal

Nss is mainly useful in slave mode to high impedence the spi data pins asap.

Natsu
Associate II

Thank you. I'm begin to understand that stm32 is completely illogical. It has a lot of useless functions and does not have the necessary ones. Sadly.

NSS is weird, it's an open collector output that needs a pull up resistor to work properly.

Throw a ~5k pull up on it and it'll go

Harvey White
Senior III

The way NSS works is on a per-transaction basis. Call the HAL function and NSS runs. What you can't do is to (say on a display) send a command, change the A0 (R/D) input, and then send data with the chip still selected. NSS goes away after each call.

I use SPI to talk to displays/display drivers of many varieties, and programmed control of the CS line is needed. Hardware NSS won't in many situations.

Natsu
Associate II

I'm upgrading a ready-made system. It is impossible to organize the soldering of all devices.

I have eyes and read in the manual how to set push-pull output for an alternative function. And the fact that he became an open drain, in my opinion, is outright stupidity of the crystal developer.

In the figure you can see that the processor speed is not enough to send data to SPI continuously, I'm thinking of rewriting the interrupt handler in assembler. What HAL can we talk about?

Natsu
Associate II

An open drain signal will always be distorted and the higher the frequency will be, the more noticeable it will be. In addition, the resistor will dissipate power uselessly. SPI is not the only interface I use... Dozens of extra resistors and dozens of lost milliamps due to the incompetence of the developer...