2026-02-16 9:59 PM - last edited on 2026-02-16 11:44 PM by mƎALLEm
Hello,
I'm starting a new project with the N657 device. I can't get the debug SWO port to work.
1- I'm redirecting the putchar to the SWO port:
int __io_putchar(int c) {
ITM_SendChar(c);
// HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);
return (c);
}
2- The trace and debug clock is set to 8mhz
3- In the debugger setup, i enabled the port and set it to 8mhz
4- in the debugger, I enable trace 0, and enabled it.
Nothing ever seems to get sent to this window. Note: I know the cable/usb dongle is good since it works with the h743. Does anyone have any suggestions?
thanks
Matthew
Solved! Go to Solution.
2026-02-17 10:41 AM
The new STM32 device (N657) does not use the same debug core as with older MCUs, and the debug clock speed is no longer associated with the CPU core clock. Now there is a dedicated branch in the clock tree configuration named TPIU Clock.
I read somewhere that the TPIU clock should be set to 8MHz. Then the same frequency must be entered in the Debugger setting page:
This did not work at first. I then played with the "Limit SWO clock" option in the debugger and limited the SWO clock to 2MHz.
Now, when I enter the debugger, I see that it detected the correct clock settings with the correct pre-scaler:
and now the serial wire viewer works properly in CubeIDE...
Matt
2026-02-17 1:25 AM
Hello @matt-crc
I assume that this post might be useful. Ensure that the CPU core clock configured in the debug settings matches the running core clock, including any PLL settings.
KR, Souhaib
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-02-17 10:41 AM
The new STM32 device (N657) does not use the same debug core as with older MCUs, and the debug clock speed is no longer associated with the CPU core clock. Now there is a dedicated branch in the clock tree configuration named TPIU Clock.
I read somewhere that the TPIU clock should be set to 8MHz. Then the same frequency must be entered in the Debugger setting page:
This did not work at first. I then played with the "Limit SWO clock" option in the debugger and limited the SWO clock to 2MHz.
Now, when I enter the debugger, I see that it detected the correct clock settings with the correct pre-scaler:
and now the serial wire viewer works properly in CubeIDE...
Matt