cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-H743zi standard output to the STM32CubeIDE console

MRait.7
Associate

I have a Nucleo-H743zi board and am debugging an application using STM32CubeIDE. There is some legacy code that does some debug printf's I don't see anything on the debug console or the regular console. How does one configure standard output to redirect so that it shows up over the IDE's USB link? Or do you have to use spearate user USB I/O ?

4 REPLIES 4

Depends how STM32CubeIDE does it's GNU/GCC implementation.

ST has historically used __io_putchar() for the implementation of the character IO in main.c, with the supporting code in syscalls.c

You must initialize the USART properly, and provide the body to the __io_putchar() function.

The NUCLEO-H743ZI / H743ZI2 provides for a VCP USART, don't recall off the top of my head which, or if it is the same for both, but it is described in the User Manual for the specific boards.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

USART3 PD8/PD9 VCP NUCLEO-H743ZI / H743ZI2

LPUART1 PB6/PB7 option NUCLEO-H743ZI2

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MRait.7
Associate

Thanks. I saw those two ports eventually. I saw this code....

int __io_putchar(int ch)

{

   uint8_t ch8=ch;

   HAL_UART_Transmit(&huart1,(uint8_t *)&ch8,1,HAL_MAX_DELAY);

   return ch;

}

int __io_getchar()

{

   uint8_t ch8;

   HAL_UART_Receive(&huart1,&ch8,1,HAL_MAX_DELAY);

   return (int)ch8;

}

Where does it get the, I suppose, handle for the device.... &huart1 I added syscalls.c to the build. What else am I missing? It looks like USART3 PD8/PD9 VCP NUCLEO-H743ZI / H743ZI2 is used for the debug connection to the IDE via ST-LINK Is that the one I'd use for standard I/O ? Won't they crash into each other? And will that eventually end up going to either the console or debug console on the IDE in some magic form? Or do I need to use a different port and use some terminal program?

Not using STM32CubeIDE, the ST-LINK VCP is the USART3 I mentioned. It could also perhaps use the SWO pin and SWV Viewer (Debug Channel), that would use ITM_SendChar()

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..