i'am beginner of using libary HAL, i use CubeMX to generate code. At first, I use usart1 to send message and i work, and then i try to use usart2 but i cant can't send any message.
There should be no pullup (nor pulldown), and I/O speed should be low (unless the baudrate is higher than 4 MHz).
Check the board user manual, PA2 and PA3 might be connected to the onboard debug adapter by default, and not available on the pin headers, unless you modify some solder bridges first.