AnsweredAssumed Answered

No Carrige return when redirect printf() to UART2

Question asked by Fede Rico on Jun 15, 2016
Latest reply on Jun 16, 2016 by Fede Rico
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




Outcomes