Skip to main content
Grant Bt
Associate III
May 23, 2025
Question

Make SWO character output non-blocking?

  • May 23, 2025
  • 3 replies
  • 439 views

Correct me if I'm wrong, but it seems that ITM_SendChar() is blocking on the character transmission. Has anyone attempted to compensate for this or do people just put up/move to a UART?

At this point all I can think of is to implement a FIFO queue and tie a timer interrupt to it to fake the equivalent of Transmit Data Register Empty. Thoughts?

FYI I'm using an STM32F411 in CubeIDE and Keil uVision connected via ST-Link/V2.

3 replies

TDK
Super User
May 23, 2025

It has to be blocking. There is no buffer available for storing data to be sent out here. It’s a low level cortex interface. Dont think there’s an interrupt like TXE you can co-opt for this.

I use UART.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Super User
May 23, 2025

People just put up or move to a UART. Optionally with DMA.

 

Tesla DeLorean
Guru
May 23, 2025

Yeah, a TIM or SysTick.

Or you can wrap such that it can either send immediately or enqueue. Perhaps pump in a yield routine or the main loop

 So checking queue and outputting as available, but leaving immediately if not ready.

 

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Pavel A.
Super User
May 24, 2025

This basically is the Segger RTT library for J-Link. Pity that ST does not offer a similar library for ST-Link. Keil has something like that too, and it works with ST-Link, but only for use with their own debugger IIRC.