Question
No Carrige return when redirect printf() to UART2
Posted on June 15, 2016 at 15:41
Hi there,
I'm working on custom board based on STM32F103 and the IDE is Keil. I will use UART2 to print some debug logs. To do this I add the fputc function to my code in order to redirect printf to UART2.int fputc(int ch, FILE *f)
{
/* Place your implementation of fputc here */
/* e.g. write a character to the USART */
HAL_UART_Transmit(&uart_debug_handler,(uint8_t*)&ch,1,1);
return ch;
}
Everything work but the output on serial port seems to haven't the Carrige Return (CR). There is only the Line Feed (LF).
This is an extract of serial output:
I'm Alive: 2269
I'm Alive: 2270
I'm Alive: 2271
I'm Alive: 2272
Any suggestions?
Thanks a lot!
Federico