Redirect Printf through UART2
Are you creating the project through CubeMX then importing it in?
Im using the F7 and also had some headaches to get the printf working, but have finally suceeded ;
When you make a project via SW4STM32, it includes a file in there called syscalls.c . the CubeMX generated project in my case at least, does not have it. Within is the extern definition for the _ _io_putchar() also the _write(0 and _read(). So I created a basic project for the same target then located this file and copy it into the project Src folder.
In main.c , #include "stdio.h" , also create the new implementation for this method ;
void __io_putchar(uint8_t ch) {
HAL_UART_Transmit(&huart3, &ch, 1, 1);
}
For me this sort of worked - it did spit out the printf output but only after 1024bytes had been buffered, then write() was called!
To resolve that "mode" we need the printf to flush immediately, can be done using the following call. I inserted
setbuf(stdout, NULL);
after the uart init is done but prior to using printf().
hope it helps....