cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner's question: Can't get ITM/SWO to work

MDaub.1
Associate III

I am doing my first steps on the NUCLEO-WL55JC1 and one of the first things I like to get working is of course some debug printfs. Though I could of course use the VCP via the integrated STLink I'd like to use ITM_SendChar() to output some informtion. Though I think I did everything the same as when I also configured the STM32H735-Discovery, where I got ITM working, nothing is output with the WL55 board. As far as I understood from the documentation SWO output via PB3 should be possible on this board as well? Using WL55 Firmware pack v1.0.0 with CubeIDE 1.6.0

Below are the steps I did to configure my app:

  • Create an empty STM32 project for the NUCLEO-WL55JC1
  • Initialize all peripherals with their default configuration: No
  • In CubeMX: Set Debug/Trace: JTAG and Trace: Trace asynchronous sw
  • In CubeMX: Clock config: Set MSI RC to 48000 setzen, to get output clock of 48 MHz
  • Save CubeMX config and auto-generate source

Add to <Projectname>_CM4/Core/Src/main.c in the central while(1)-Loop in main():

uint32_t cnt = 0;
 
 while (1)
 {
	 cnt++;
	 if (cnt>=65535)
	 {
		 ITM_SendChar(0x41);
		 cnt=0;
	 }
	 cnt++;
  /* USER CODE END WHILE */
  /* USER CODE BEGIN 3 */
 }
 /* USER CODE END 3 */
  • Start debugging  
  • Edit debug configuration
  • Interface: SWD
  • SWV: Enable
  • Set SWV Core Clock to 48 MHz
  • Start debugging
  • In the initial hold after debug start
  • Open View "SWV/SWV ITM Data Console" or "SWV Trace Log"
  • Tick: PC Sampling: Enable, Timestamps: Enable, ITM Stimulus Ports: 0, Trace Events: CPI
  • Click "Start Trace" Button im View
  • Resume program

To my understanding every 65k iterations an "A" should be printed via ITM and logged to the view. Also the Trace Log View should show some infos about clocks, timestamps, etc (It did with the STMH7)

Nothing is output to the SWV windows.

What am I missing?

2 REPLIES 2
Pavel A.
Evangelist III

Are you sure that global variable SystemCoreClock is indeed 48000000? Check using debugger.

Send LF characters after every so many text chars. Try in your test:

ITM_SendChar(0x41);
ITM_SendChar('\n');

MDaub.1
Associate III

Yes, the clock was indeed 48 MHz, and basically also sending strings without newline works. I think I found the reason.... if I read the schematics and board specs correctly, the PB3\SWO pin of the MCU is simply not connected to the ST-STLink... solder bridge SB8 (chapter 6.7) is open per default and thus PB3 is used as an alternate pin for timer 2 (TIM_CH2)

0693W000008wrbmQAA.pngThe same code to print some ITM debug messages worked perfectly on a NUCLEO-STM32F413 board and the STM32H735-Disco board.

References:

https://www.st.com/resource/en/user_manual/dm00622917-stm32wl-nucleo64-board-mb1389-stmicroelectronics.pdf, page 30

https://www.st.com/content/ccc/resource/technical/layouts_and_diagrams/schematic_pack/group1/3b/39/a7/68/04/96/4a/6e/MB1389-WL55JC-highband-D04_schematic/files/MB1389-WL55JC-highband-D04_Schematic.pdf/jcr:content/translations/en.MB1389-WL55JC-highband-D04_Schematic.pdf, page 3