Nucleo-F103RB - USART2 printf not working on Tera Term (No Output Displayed)
Hello,
I am working with a Nucleo-F103RB board and trying to send printf output over UART using USART2. I have configured UART2 with the following parameters:
Baud rate: 9600
Word length: 8 bits
Stop bits: 1
Parity: None
Mode: TX/RX
I also redirected printf to HAL_UART_Transmit() via __io_putchar() as shown below:
PUTCHAR_PROTOTYPE
{
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
In my main() loop, I am calling printf() every second like this:
uint8_t count = 0;
float f = 1.234;
while (1)
{
printf("hello : %d, %f\r\n", count++, f++);
HAL_Delay(1000);
}
However, nothing is being printed in Tera Term (v5.0).
I selected the correct COM port and set it to 9600 baud rate. Other serial settings are default and matched.
I have verified that:
MX_USART2_UART_Init() is called in main.c
GPIOs are configured by CubeMX for USART2 (PA2: TX, PA3: RX)
No errors are reported during initialization.
But still, I see no output on Tera Term.
How can I troubleshoot or resolve this issue?
Is there anything wrong in the way printf is being redirected or in UART2 configuration?
Any help or suggestions would be greatly appreciated!
Thanks.
Edited to apply source code formatting - see How to insert source code for future reference
