SWV in STM32F302 - printf() with different characters

Viewed 299

I found some answers that didn't solve my issue for STM32F302. I configured the debug run as follows, to printf() in the SWV ITM Data Console:

IMG-Debug_Config

I implemented the _write function as follows:

int _write(int file, char *ptr, int len)
{
     int DataIdx;
     for (DataIdx = 0; DataIdx < len; DataIdx++)
     {
         ITM_SendChar((*ptr++));
     }
     return len;
}

And tried to setup the sys clock for "Asynchronous Trace" and "Serial Wire", none worked and I keep getting the same output (SWV Graph does not work either):

IMG-SWV_Output

Any suggestion about this issue? I just want to debug the variable to make sure I'm getting the correct measurement.

PS. Just a brief of my project: An ADC for a light sensor. I need to generate a graph from a laser sample measurement. Make this measurement with the STM32 and a photodiode, finish the measurement and send the .csv or .txt from USB to a computer to analyse the data.

2 Answers

I found what my problem was:

My "Core Clock (MHz)", in the debug settings, was wrong and that's why my SWV was not working properly

If no SWV data - you need to connect the SWO pin to ST-LINKV2. The SWV data transmission is on the SWO pin. On my STM32F3DISCOVERY, the SB10 was not soldered, SB10 connecting the PB3 SWO pin to the T_SWO debugger net. After soldering SB10 SWV work perfectly.

Related