Skip to main content
Associate III
November 27, 2023
Question

SPI CS unable to pull to high initally

  • November 27, 2023
  • 11 replies
  • 3809 views

Hi I m using STM32H7 for SPI transmit & receive, the code is working and able to transmit 2 byte successfully as seen from scope, but the inital CS pin was unable to set to high from .ioc. CS = PA4 and set to GPIO output level HIGH and max output speed to Very high, but waveform show low at start and then high to low again... why is this so.  any one can advise how to set CS to high then low initally..

CS not lo.jpg

This topic has been closed for replies.

11 replies

David Littell
Senior II
November 27, 2023

Ensure the .ioc configures the initial output level to HIGH and place a pull-up resistor (10K should be fine) on the signal to keep it high during the time the pin isn't yet configured (i.e., from reset until MX_GPIO_Init()).

Associate III
November 28, 2023

Hi David, the SPI CPOL and CPHA was set to mode 2 i.e. high and edge1 but the clk waveform show start from low to high then low to init SPI ... why is this so? shouldn't it be showing starting high then low to init SPI? 

 

David Littell
Senior II
November 28, 2023

Think of it this way: what's the nCS pin state prior to the SPI module taking control of the pin?

ST Technical Moderator
November 28, 2023

Hello  @StanCosgrove 

Which board are you using? Is it custom board?

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
Associate III
November 29, 2023

STM32H743

AScha.3
Super User
November 28, 2023

you should set : keep io state enable

AScha3_0-1701188278038.png

and pullup on nss pin

AScha3_1-1701188404054.png

+ dont set hi speed, try medium first . ( high speed giving lot of ringing...)

If you feel a post has answered your question, please click on " Best Answer ".