Skip to main content
MBaza.1
Associate II
February 8, 2025
Question

Can’t get SWV to work on my NUCLEO-WL55JC1

  • February 8, 2025
  • 2 replies
  • 642 views

Hello,

Apologize for the long post/question…

Using the NUCLEO-WL55JC1 board, I am trying to get SWV to redirect printf() output to the IDE console, with no luck.

I added the below code to syscalls.c and modified the _write() function to call this function. I also set the IDE to monitor port 0, and start.

 

 

 

//Debug Exception and Monitor Control Register base address
#define DEMCR *((volatile uint32_t*) 0xE000EDFCU )
// ITM register addresses
#define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 )
#define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 )

void ITM_SendChar(uint8_t ch) {
	//Enable TRCENA
	DEMCR |= (1 << 24);

	//enable stimulus port 0
	ITM_TRACE_EN |= (1 << 0);

	// read FIFO status in bit [0]:
	While (!(ITM_STIMULUS_PORT0 & 1));

	//Write to ITM stimulus port0
	ITM_STIMULUS_PORT0 = ch;
}

 

 

 

 

In addition,

- I verified that \n is at the end of the printed string.

- I checked the board and there are jumpers on the T_SWDIO, T_SWCLK, and T_SWO. I assume that having the jumpers means that this is enabled.

- The MCU datasheet states (for the M4 core):

32-bit Arm® Cortex®-M4 CPU – Adaptive real-time accelerator (ART Accelerator) allowing 0-wait-state execution from flash memory, frequency up to 48 MHz, MPU and DSP instructions.

So, I set the speed to 48.0

- When I connected the board the first time and started the IDE, it popped a window asking me to approve the upgrade to STLINK/V3. Maybe this causes the issue?

 

I would very highly appreciate your help in resolving this and helping me get this to work.

Thanks a lot,

Motti

2 replies

AScha.3
Super User
February 8, 2025

Hi,

1. the cpu frequency in ds is not important, you have to set the real frequency, the cpu is running in your program.

2. st-link update should not matter.

3. to send on SWV just put this at end of your main:

 

/* USER CODE BEGIN 4 */
int __io_putchar(int ch)
{
 ITM_SendChar(ch);
 return (ch);
}
/* USER CODE END 4 */

 

 -user code area- 

 

Thats all.

To get it running, if still problem...search here in forum "swv" and read a little...

"If you feel a post has answered your question, please click ""Accept as Solution""."
MBaza.1
MBaza.1Author
Associate II
February 8, 2025

Thanks for your quick reply!

I am new to the STM32 family so I am asking newbe questions.

I did not understand the first item:

1. the cpu frequency in ds is not important, you have to set the real frequency, the cpu is running in your program.

What should I do about that? Where to find the data and where to insert it?

Will highly appreciate your help!

Thanks a lot!

 

AScha.3
Super User
February 8, 2025

ok..

You set the clock tree in Cube...so you (should) know, what you set the clock for cpu etc.

Maybe better you read at first, how to begin; just search the tutorials on STM , or here in forum.

And how to work with the IDE -- quick start , user manual, youtube videos (a lot ! )...

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