cancel
Showing results for 
Search instead for 
Did you mean: 

SPI CS unable to pull to high initally

StanCosgrove
Associate II

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

11 REPLIES 11

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

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? 

 

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

FBL
ST Employee

Hello  @StanCosgrove 

Which board are you using? Is it custom board?

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.

AScha.3
Chief III

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 "Accept as Solution".

STM32H743

CS pin inital state should be high then low to initialise the SPI.....

Sigh.  Did you even try the pull-up resistor?

yes, try already... same result...