2017-09-26 11:03 AM
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 #spi2017-09-29 11:16 AM
Anyone?
Thanks again.
2017-09-29 05:32 PM
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.