cancel
Showing results for 
Search instead for 
Did you mean: 

uart1_printf_debug

StanCosgrove
Associate II

hi i would like to use uart1_printf_debug debugging on a serial terminal but error message "undefine reference to "uart1_printf_debug" what file to include except stdio.h? 

1 REPLY 1
AScha.3
Chief II

you need something like this in main.c :

 

/* USER CODE BEGIN 4 */

/**
  * @brief  Retargets the C library printf function to the USART.
  *   None
  * @retval None
  */
int __io_putchar(int ch)
{

  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);

  return (ch);
}

 

then just use printf(...);

If you feel a post has answered your question, please click "Accept as Solution".