cancel
Showing results for 
Search instead for 
Did you mean: 

How to trace the data in SWV using STM32F303RE Nucleo board?

PDeva.1
Associate

Actually, I could able to debug the STM32F303RE Nucleo board and could see the value of the variables by keeping the breakpoint while debugging.

Instead of keeping the breakpoint, I want to trace the value of the variable using SWV and also I want to print the logs which need to be displayed in the SWO console.

But I am blocking somewhere else after tried the below steps

I am using the Atollic TRUE Studio and Configured the Debug options for the project. Used the ST-Link-V2 Incircuit Programmer/debugger for debugging

I set the Core Clock as 72MHz(which I referred from STM32Cube IDE for STM32F303RE Nucleo) and SWO clock as 2000 KHz.

I used the ITM related functions(ITM_SendChar) to print the log or single character in the SWO console and enabled the port "0" in the SWO settings.

But nothing displayed in the SWO console.

I don't know what I need to do exactly. Do I need to use the SWD port which present in the Nucleo board to print the log in SWO console.

Kindly help on this.

1 REPLY 1
Imen Ezzine
ST Employee

Hi ,

I believe ST-Link-V2 is sufficient to trace the data using the Nucleo board.

In order to activate the ITM trace (printf) maybe you need to add the fputc function definition just after the main function in your code as below:

/*----------------------------------------------------------------------------
  Write character to Serial Port
*----------------------------------------------------------------------------*/
int SER_PutChar (int c) {
 
                ITM_SendChar (c);
  return (c);
}
 
int fputc(int c, FILE *f) {
  return (SER_PutChar(c));
}

Also you can check with the User manual in case there is a hardware modification needed in order to activate trace (switch, solder bridge SB etc)

I hope this help!

-Imen