2025-07-15 4:01 AM - last edited on 2025-07-15 4:37 AM by Andrew Neil
Hi all
I am working with SPI1 on stm32f407vgtx and issue what I am, facing my NSS which internally controlled by SPI is taking more time for goes high even CLOCk has been stopped . my configuration are SPI full duplex 16 bit data clock is 2.6MHZ after prescaled I am transmitting on spi every 10ms task. Please check the screenshot of logic analyzer for further understanding .
Note: in the end I have disabled SPE bit before checking TXE and busy flags.
2025-07-15 6:19 AM
NSS remaining low is not a problem for the SPI protocol. On the STM32F4, NSS will remain low as long as the SPI peripheral is enabled. I recommend using a GPIO pin for the CS pin.
2025-07-15 7:44 AM
Hi
I have a observed that every times after 4th CLOCK 5th clock is taking twice than rest.
why it happening please check the image.
2025-07-15 8:10 AM
This is a sampling rate issue. Increase the sampling rate on the logic analyzer and/or slow down the SPI clock speed if this bothers you.
2025-07-15 10:14 PM
Hi
What about the clock ..I want to know when I will start seeing clock and when it goes off, who actually controls the clock .
B.R
Ash
2025-07-16 12:13 AM - edited 2025-07-16 2:57 AM
hi stm32' community
I am sharing you zip of my project can you check my spi code is it correct on logic analyzer or anywhere.
I request you to help me to achieve SPI communication.
I am sharing screenshot you can clearly in the end you may notice a time gap how late cs goes high even when I have disabled cs immediately after reading SPI_dr register.
2025-07-16 11:53 PM
Hi
I am waiting for your response .
B.R
Ash
2025-07-17 6:58 AM
> HAL_SPI_Transmit(&hspi1, TX_Buffer, 1, 1000);
This is the only SPI-related statement in your code. I don't see manipulation of CS anywhere or disabling the SPI peripheral anywhere.
Still stand by my first statement. NSS will be low as long as the peripheral is enabled. Better to use a GPIO pin here.
2025-07-17 7:12 AM
@Ash1 wrote:who actually controls the clock .
By definition, it is the Master which controls the clock in SPI.
2025-07-17 7:17 AM
@TDK wrote:Still stand by my first statement. NSS will be low as long as the peripheral is enabled. .
Indeed - that is the defined behaviour:
via: https://www.st.com/en/microcontrollers-microprocessors/stm32f407vg.html#documentation