Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H723ZG ITM printf / SWV problems



My new nucleo-h723zg board has just arrived and I immediately tried it with the updated STM32CubeIDE 1.6.0.

The HAL driver is the latest: STM32Cube_FW_H7_V1.9.0 I also updated the on-board ST-LINK/V3 with the latest firmware.

Unfortunately, ITM printf and the entire SWV system seem unusable. Maybe I'm doing something wrong?

If I use on-board st-link/v3, nothing works in SWV. If I use an external J-Link EDU, data is received with it but it is incorrect.

Previously, I successfully used ITM printf with STM32F3 and STM32F4 microcontrollers. I know the STM32H7 is a Cortex-M7 based and much more complex device.

I attach the .ioc file of the project.

Thanks in advance for all the help!

Pavel A.
Evangelist III

Whatever it's worth, ITM printf works for me after update to 1.6.0 on Nucleo-H743.

But... if some other software touched SWO interface before CubeIDE, such as ST-LINK utility - the SWV console fails to connect:

Says "SWO trace already running on another core". The poor thing got too sophisticated....

To clear this state and let the GDB server connect, power cycling the board helps.

0693W000007ZhwpQAC.pngIIRC something like this is mentioned in release notes of 1,6,0.

-- pa


I start the debug session but the SWO data is incomprehensible. The other interesting thing is that after 1-2 seconds the data stream stops.

The test program printing the "System initialized!"-string after the hardware was initialized, then incrementing the value of a variable every 500ms and printing it.

I've included some screenshots of the issue:



I also attach the project file!


Does anyone have any ideas?

It's also weird that I only send data on channel 0 (printf), but other channel numbers appears in the log.


The problem still persists.

I put together the same project for a NUCLEO-H743ZI2 board. This board also has ST-LINK/V3, but the SWO works.

What is the key difference related to SWO/SWV between the two MCUs?

This is very annoying, especially because I don’t understand the reason.0693W000008w9Z3QAI.png0693W000008w9YyQAI.png

Senior III

After reviewing all the information entrained in this thread I would like to summarize what worked for me so it is all in one place and concise.

Windows 10

CubeIDE 1.7.0

CubeMX 6.3.0

STM32H7xx MCU package 1.9.0

STM32H723ZG Nucleo board

Add the following code to main.c: (note - USER CODE BEGIN and END are only shown for location purposes in main.c, Do Not add them to your code!)


int _write( int file, char *ptr, int len )


int i = 0;

for( i=0 ; i < len ; i++ ) ITM_SendChar(( *ptr++));

return len;


void SWD_Init(void)


*(__IO uint32_t*) (0x5C003010) = ((SystemCoreClock / 2 / 2000000) - 1);





/* USER CODE END SysInit */

Then open the Debug configuration and in the Debugger Tab, do the following:

1) Verify the debug probe is set to ST-LINK (ST-LINK GDB server)

2) Verify the Interface is set to SWD

3) Verify Interface Frequency is set to Auto

4) Verify Serial Wire Viewer (SWV) is Enabled (check box checked)

5) Verify Serial Wire Viewer (SWV) Core Clock is set to the same value as found in the CubeMX SYSCLK value

6) Verify Serial Wire Viewer (SWV) Limit SWO clock is checked

7) Verify Serial Wire Viewer (SWV) Maximum SWO clock (kHz) is set to 2000

😎 Verify Misc Enable live expressions is checked

Once the Debugger is started:

1) Verify the Window->Show View->SWV ITM Data Console is selected

2) Click on Configure Trace (the tools icon)

3) Verify in ITM Stimulus Ports that Port 0 is checked (Enabled).

Senior III

Sorry forgot to include this is for STM32H723ZG Nucleo Board

Associate II

I am developing with the same board. After much trial and error, using the above tactics works, but only if you have the system clock at 550MHz and set the core clock of SWV to 275.0 MHz.  If the system clock is set to another value and the SWV clock is set to half of the system clock, I just get gibberish from the printf().  If the System Clock is set back to 550 and the SWV is set to 275, it works.  I had to add fflush(stdio) after printf() statements or would sometimes lose some characters.

If there is a solution to this, I would certainly like to know as I would like to use a System Clock of 528MHz or 480MHz.

Right now I am just running at the higher clock so I can debug all the features.  I run large sets of data and print the result to the terminal and save it to a text file (.csv) so I can open it in a spreadsheet and validate the data.

It would be nice if there was a way to have the debugger take a range of memory or watch variables and just press a debugger button and all the data got saved into a file based on a template you set up.  Then Printf would not be necessary (or have a HAL command that does that which can be used  during the debugging process or as a feature in a finished project)