2025-09-10 8:22 AM - last edited on 2025-09-10 8:46 AM by Andrew Neil
Split from STM32H5 SWO debugging.
I want use SWO pin like standalone debug. Send data by "ITM_SendChar('A');" and want to read data from SWO pin by USB-UART dongle, SWO pin => Rx pin UART-USB on PC.
I try blue and black pill (STM32F103 and STM32F411), in stm32 cube ide I configured SysremCore->SYS->Debug: Trace Asynchronus Sw. In "Debug configuration" is Enable for SWV and clock core 8Mhz (SYSCLK and HCLK = 8MHz).
In main sycle:
while (1)
{
/* USER CODE END WHILE */
HAL_GPIO_TogglePin(Led_GPIO_Port, Led_Pin);
HAL_Delay(1000);
for (int i = 0; i < 10000; ++i) ITM_SendChar('A');
HAL_GPIO_TogglePin(Led_GPIO_Port, Led_Pin);
HAL_Delay(1000);
/* USER CODE BEGIN 3 */
}
LED is blinking, but SWO pin out is NO SIGNAL (Checking by oscillograph).
Where is it possible problem?
2025-09-10 8:51 AM
Note that Blue & Black Pills are not ST products, and likely do not have genuine STM32 chips.
In the other thread, @AScha.3 said that it's important to end your output with \r\n - did you try that?
2025-09-10 9:23 AM
you wrote:
> SWO pin => Rx pin UART-USB on PC
Are you sure this is correct?
I would expect to send from STM32-SWO via a pin labeled Tx or TxD to the PC. Maybe you want to double check the doc of your USB converter.
2025-09-10 9:30 AM
@mfgkw wrote:I would expect to send from STM32-SWO via a pin labeled Tx or TxD to the PC
Really?
SWO = Serial Wire Output - so I'd expect it to go to RX (an input) on the PC (a DTE) ?
2025-09-10 9:43 AM
It will depend on how the developer of the converter looks on its baby.
The doc should tell...
2025-09-10 9:50 AM
> want to read data from SWO pin by USB-UART dongle, SWO pin => Rx pin UART-USB on PC.
The SWO signal is not a UART signal. This has no hope of working.
2025-09-10 9:52 AM - edited 2025-09-10 9:55 AM
>and want to read data from SWO pin by USB-UART dongle, SWO pin => Rx pin UART-USB on PC.
This wont work.
Its more complex, than you are thinking :
+
You can connect with the CubeProgrammer -> ST-link -> to the ITM : then see SWV -> SWO output:
+
>want to read data .. by USB-UART dongle, .. pin => Rx pin UART-USB on PC.
If you just want serial "debug" messages, use an UART at "some speed" .(I use 3 Mbit for this.)
Or the USB , as CDC device , so you can connect to a PC /USB directly.
2025-09-10 9:56 AM
@TDK wrote:The SWO signal is not a UART signal.
In principle, it could be:
Do (any) STM32 support that ?
@mkigor Generally, it's connected to the debug probe; eg, ST-Link.
2025-09-10 10:42 AM - edited 2025-09-10 10:44 AM
>Do (any) STM32 support that ?
Yes. On the "clone" ST-link V2 just need to connect to PB7 , UART1 Rx , to get the SWO data.
(The pic i showed, with CubeProgrammer connected to a H743 cpu showing SWV data, is made with an modified
ST-link V2 , working 100% reliably at 2 Mbit. With a ST-link V3 higher speed is no problem.)
here with cmsis-DAP , also STM32F103 cpu :