cancel
Showing results for 
Search instead for 
Did you mean: 

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

mwp
Senior
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
2 REPLIES 2
mwp
Senior
Posted on September 29, 2017 at 20:16

Anyone?

Thanks again.

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 Up vote any posts that you find helpful, it shows what's working..