Application components for STMicro STM32 MCUs
Toolchain: Migrating from TrueSTUDIO+CubeMX to STM32CubeIDE
I managed to support printf on USART2.
Physical configuration:
STM32F407
+------------+
X 5V |
GND ----- GND FTDI |
PA3(RX) ----- TX USB-UART ===== USB ======> PC
PA2(TX) ----- RX converter |
+------------+
Include the following snippet in main.c to support printf:
int _write(int file, char *pbuf, int len)
{
HAL_UART_Transmit(&huart2, (uint8_t *)pbuf, len, 1000);
return len;
}
PWM output (100Hz, 50% duty) to PA8: