How to retarget printf on UART?
Hi All,
I am new on STM32 and want to use printf on UART.
I could run the printf on uart in the example folder.
But couldnt find how does it work, actually couldnt find any comment in it about enabling printf on uart.
I am useing STM32CubeMx and want to enable printf on its projects.
I have tried some suggestion like adding following function that didnt work:
void __io_putchar(uint8_t ch) {
/**
* \brief __io_putchar - A routine to transmit a single character out the serial port
* \return void
* \param[in] ch - uint8_t the character to transmit
* \author andreichichak
* \date Oct 16, 2015
* \details This routine assumes that we will be using UART2. A timeout value of 1ms (4th parameter)
* gives a retry if the transmit buffer is full when back to back characters are transmitted,
* avoiding dropping characters.
*/
HAL_UART_Transmit(&huart2, &ch, 1, 1);
}
Could someone help me on this issue?
I am using NUCLEO-L011K4 board.
Mostafa
