2017-03-20 03:11 AM
2017-03-20 03:43 AM
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
2017-03-20 04:18 AM
Not necessarily.
The I2C bus does need pull-ups because it switched the direction of the lines, but SPI has only unidirectional lines.
2017-03-20 05:21 AM
how about CS of this interface ? do I need 3.3V pull up 10K resistor ?
2017-03-20 05:27 AM
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.