2017-02-09 05:47 AM
I'm using examples of project 'UART_Printf'.
But I can't use printf.
I set uart1. and I checked that uart1 tx/rx works.
I added below code to my source.
&sharpinclude 'stdio.h'
&sharpifdef __GNUC__
/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf set to 'Yes') calls __io_putchar() */&sharpdefine PUTCHAR_PROTOTYPE int __io_putchar(int ch)&sharpelse&sharpdefine PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)&sharpendif /* __GNUC__ */PUTCHAR_PROTOTYPE
{ /* Place your implementation of fputc here */ /* e.g. write a character to the USART1 and Loop until the end of transmission */ HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);return ch;
}#uart #printf #stm32f42018-01-26 06:06 PM
Hi,
look this examples:
http://www.emcu.eu/how-to-implement-printf-for-send-message-via-usb-on-stm32-nucleo-boards/