2024-01-29 05:18 PM
Hello, everyone.
I use STM32L496 on my board, and use PA9 as a GPIO for input, without any external resister.
Software program is based on HAL. I have a sample demo like this:
int main(void)
{
HAL_Init();
BSP_Init();
while(1)
{
delay_ms(1000);
}
}
While, in the BSP_Init(), like this:
void BSP_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; // or GPIO_PULLDOWN
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
But, on the board, I measured PA9 has a high voltage level, but PA10 and PA11 is low. If do not call BSP_Init(), PA9 is high level,too. If a change GPIO_InitStruct.Pull to GPIO_PULLDOWN, the result is same as above. I checked the register, three pin has the same configure. And no other place configure these pin.
Is there same mistake about my use? It's been bothering me for a long time. Does anyone provide any help, Thanks very much!
Solved! Go to Solution.
2024-01-30 09:16 AM
A) Show us all relevant schematic (U1 TX2)
B) Check PCB trace from shortcut to VCC
C) Explain how exactly did you measured "high level" on pin without pullup/down. It is little bit tricky to measure floating input !
2024-01-30 03:51 AM
Hello,
In your schematics there is the signal called "U1 TX2". What kind of signal is this: input or output? The voltage you are measuring could be sourced by this signal.
Could you please share the schematics?
2024-01-30 09:16 AM
A) Show us all relevant schematic (U1 TX2)
B) Check PCB trace from shortcut to VCC
C) Explain how exactly did you measured "high level" on pin without pullup/down. It is little bit tricky to measure floating input !
2024-01-30 09:31 PM
Thank you for reply. "U1 TX2" is input, and it connect nothing. I will check carefully.
2024-01-30 09:33 PM
Thank you for reply. I will check carefully according to your recommendation.