Figure 49. Usart2 Setting With Stm32Cubemx - STMicroelectronics STM32 Application Note

Microcontroller debug toolbox
Hide thumbs Also See for STM32:
Table of Contents

Advertisement

Printf debugging
Retargeting printf to UART depends on the toolchain.
For IAR™ EWARM and Keil
function
#include "stdio.h"
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&UartHandle, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
For GCC based toolset like STM32CubeIDE, two cases can be met.
With syscall.c integrated to the project:
#include "stdio.h"
int __io_putchar(int ch)
{
70/118

Figure 49. USART2 setting with STM32CubeMX

®
MDK-Arm µVISION this is done by overriding the stdio fputc
AN4989 Rev 3
AN4989

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF