Skip to main content
antonius
Associate III
March 20, 2017
Question

Pull up resistor ?

  • March 20, 2017
  • 3 replies
  • 1513 views
Posted on March 20, 2017 at 11:11

Everyone,

Do I need pull up resistor for SPI and GPIO port ? thanks

#gpio #pull-up-resistor #spi
This topic has been closed for replies.

3 replies

antonius
antoniusAuthor
Associate III
March 20, 2017
Posted on March 20, 2017 at 11:43

The setting is :

 /**SPI1 GPIO Configuration    

    PA5     ------> SPI1_SCK

    PA6     ------> SPI1_MISO

    PA7     ------> SPI1_MOSI

    */

    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    GPIO_InitStruct.Pin = GPIO_PIN_6;

    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Push pull doesn't need pull up resistor, but correct me if I'm wrong

AvaTar
Senior III
March 20, 2017
Posted on March 20, 2017 at 12:18

Not necessarily.

The I2C bus does need pull-ups because it switched the direction of the lines, but SPI has only unidirectional lines.

antonius
antoniusAuthor
Associate III
March 20, 2017
Posted on March 20, 2017 at 12:21

how about CS of this interface ? do I need 3.3V pull up 10K resistor ?

S.Ma
Principal
March 20, 2017
Posted on March 20, 2017 at 13:27

You don't need pull up or down on SPI bus, unless the SPI bus can be cut between master and slave (ribbon cable).

What you need to be careful is the choise for the GPIO SPEED value for best signal shape on oscilloscope.