cancel
Showing results for 
Search instead for 
Did you mean: 

SWV ITM Data Console is empty

NateS
Associate III

This problem is common, but I've reviewed my setup and everything appears to be correct, yet it still doesn't work.

  1. My programmer is an STLINK-V3PWR, connected via a 6 pin Tag-Connect (TVCC, SWDIO, NRST, SWCLK, GND, SWO) to an STM32F411CEU6.
  2. In the STM32CubeIDE IOC, under SYS I've enabled Trace Asynchronous Sw.
  3. In my STM32CubeIDE debug config, I'm using GDB, SWD, and enabled SWV at 25MHz, matching my SystemCoreClock. SWO clock is limited to 2000KHz (25MHz / 13 = 1920KHz).
  4. In the SWV ITM Data Console settings, I've checked port 0. The red "Start trace" button is pressed.
  5. My logging uses ITM_SendChar and ends with \n. I can suspend execution and step through the ITM_SendChar function in core_cm4.h: ITM and port 0 are enabled and ITM->PORT[0U].u8 = (uint8_t)ch; is executed.
  6. Still, nothing appears in the SWV ITM Data Console or SWV Trace Log views.

At this point it seems like SWO is not connected, but it is definitely connected to pin PB3.

Next I tried this code:

 

 

 

while (1) {
	ITM_SendChar('h');
	ITM_SendChar('i');
	ITM_SendChar('\n');
	int i = 100000;
	while (i > 0) i--;
}

 

 

 

If I place this in main() after everything (in USER CODE BEGIN 2 where SystemCoreClock is 25000000) I still get nothing. However, if I place it before SystemClock_Config() (in USER CODE BEGIN Init just after HAL_Init() where SystemCoreClock is 16000000) then I see entries in the SWV Trace Log view: ITM port 16 and DATA_TRACE_VALUE (comp 0) (W).  I have no comparator configured. Maybe these are erroneous due to clocks not matching, but does it at least shows that SWO is indeed connected?

Edits:

I changed the SWV core clock to 16MHz and now I see entries in SWV ITM Data Console! But only when logging before SystemClock_Config(). Why doesn't it work after SYSCLK is changed to 25Mhz and I specify 25MHz for the SWV core clock? I also tried 96MHz, but got the same nothing.

SWV core clock 16Mhz with SYSCLK 25MHz and logging after SystemClock_Config(), I see gibberish SWV Trace Log entries. That makes sense. Changing the SWV core clock to 25MHz, I see nothing. That makes no sense! Maybe the STLINK-V3PWR doesn't work correctly? It's pretty new. I updated the firmware to the latest (V4.J3.B1.P4).

Changing SYSCLK to 16MHz (by using HSI), I do get logging. That's great, but I can't use HSI. I'm doing time sensitive operations (modulating a laser to keep it eye safe) and need to use HSE.

I don't know what else to try. I need logging and don't have a UART available because I was planning to use SWO. Any assistance is greatly appreciated!

14 REPLIES 14
NateS
Associate III

Some screenshots may help make my configuration clear:

 

 

AScha.3
Chief III

i just can say: it works. but getting it to work - is more like a game with greetings from mr. murphy .

try:

- not limit the clock, just leave on auto. (it should set the best speed itself.) 

- uncheck the timestamps enable (it will overflow the buffer after some seconds..)

- click the red button ...2, 3 times and again when pause/debug , re-start debug again...after some tries it should work.

+ when it works, it will also work on next debug sessions, no need to start again. :)

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for your response.

I tried not limiting the SWO speed, also limiting it at 200KHz, 2000KHz, and other values. I tried 1920KHz to match 25MHz / 13.

I tried with and without timestamps.

I have clicked that red button many times, starting and stopping debugging with it on and off.

None of this voodoo is working. :(

I have an STDC14 Tag-Connect so to try another programmer it'd need to be V3SET or V3MINI. Do those work reliably?

Usually its a relationship between what the core is running at, and the clock used by the ST-LINK.

I'd perhaps try the old ST-LINK Utilities, or the SWV mode in STM32 Cube Programmer.

Sorry more of a Keil guy myself..

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

I gave STM32CubeProgrammer's SWV mode a try. It doesn't show anything for 25MHz SYSCLK. With verbose level 3 I see logs like:

  15:13:49:419 : r ap 0 @0x1FFF76DE 0x00000004 bytes Data 0xFFFF00D0
  15:13:50:421 : r ap 0 @0x1FFF76DE 0x00000004 bytes Data 0xFFFF00D0
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:363 : Unknown Packet
  15:13:51:424 : r ap 0 @0x1FFF76DE 0x00000004 bytes Data 0xFFFF00D0

I could change my HSE oscillator. Is 25MHz a poor choice? Is there a standard value around 25MHz that would work better?

i never used a core at 25M. so cannot say about it better or not...

on F411 not tried yet. on F303 at 60M core.

just : its working on H743 and H563 , core at 200 or 250M.  with st-link V2 ("clone") and V3 .

->

AScha3_0-1697658725272.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Are you saying you tried a V3 at 25MHz SYSCLK and it worked? If so, thanks for giving that a try. I don't see the V3 anywhere, instead I see: V3SET, V3MINIE, V3MODS, and V3PWR. Which one did you try?

Should I expect ST to eventually chime in to this thread? If not, is there a way to escalate an issue to get support?

Never ever at 25M core.

Why don't you go higher, with using the pll ?

+

I have V3mods, soldered to proto board and standard 2.54mm pin header.

Ask STM direct ->  ols.st.com

Try...

 

If you feel a post has answered your question, please click "Accept as Solution".

Turns out my HSE is actually 10MHz. It's unbelievable I suffered so long without realizing it! My code was running with SystemCoreClock showing 25000000 so I assumed it was good. SWO is working now after specifying 10MHz. I feel so dumb but I'm happy to be able to move on. Sometimes even the simplest problem can cause much pain!