Skip to main content
mwp
Associate III
September 26, 2017
Question

State of GPIOs after AF pin setup, but before peripheral init?

  • September 26, 2017
  • 2 replies
  • 608 views
Posted on September 26, 2017 at 20:03

Greetings all,

Does anyone know what the state of IO pins is after they have been setup by HAL, but before the the peripheral has been started?

For example:

The pins are initialised as AF-PP for SPI peripheral use...

GPIO_InitStruct.Pin = SPI_SS_Pin|SPI_CLK_Pin|SPI_MISO_Pin|SPI_MOSI_Pin;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

GPIO_InitStruct.Alternate = GPIO_AF0_SPI2;

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

then after some large delay...

HAL_SPI_Init(&hspi2)

 ;

What are the pin states going to be between the HAL GPIO init call and the HAL SPI init call?

I gather they will be push/pull, but will they be high or low?

And will other peripherals act in a similar manor?

Thanks in advance!

#stm32 #hal #gpio #spi
This topic has been closed for replies.

2 replies

mwp
mwpAuthor
Associate III
September 29, 2017
Posted on September 29, 2017 at 20:16

Anyone?

Thanks again.

Tesla DeLorean
Guru
September 30, 2017
Posted on September 30, 2017 at 00:32

Well, it's likely to be dependent on the peripheral, the direction and enablement of it's interfaces, ie SPI can be master or slave, the USART can have RX and TX enabled independently, or use a single pin. There's also a lot of internal connectivity that simply isn't documented. Assume it is some what indeterminate, or you can just observe experimentally in the narrow case you have. If you really have a compelling need to know, you should discuss with the FAE or staff assigned to your company/project.

Set the pin to an analogue input, and flip to the AF mode once you have the peripheral configured/enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..