Skip to main content
Visitor II
November 27, 2023
Question

SPI CS unable to pull to high initally

  • November 27, 2023
  • 3 replies
  • 2726 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.

    3 replies

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

    Visitor II
    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? 

     

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

    Technical Moderator
    November 28, 2023

    Hello  @StanCosgrove 

    Which board are you using? Is it custom board?

    Visitor II
    November 29, 2023

    STM32H743

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