2013-11-07 10:02 AM
Hi,
I am currently stuck with stlink v2 and ITM trace on a STM32F103RB. I am using CMSIS debug support by simply calling ITM_SendChar(). This is the only trace specific code than I am using. I used SWV in the stlink tool as well as st-trace but I don't see any data. When debugging I can also see that I can reach and executeITM->PORT[0].u8 = (uint8_t)ch;
I have not found a single hint on certain startup-code or device, clock or other activation code that needs to be used.
Anything I am potentially missing?
I think I saw somewhere that trace is only working when connected with a debugger but that sounds too odd to me. I am not debugging and tracing at the same time.
Physically I am only using GND, VREF, SW CLK, SW DATA IO, SWO and RST of the stlink - works well for debugging and flashing. SWCLK and TRACESWO show some activity on the oscilloscope and only when activated - so something is happening.
Thanks,
Bernd
2013-11-07 11:02 AM
It is critical that the SWV/ITM tool understands exactly what frequency you are running the core.
2013-11-07 11:37 AM
That was already set wrong. Now I set to 72MHz and SWV Frequency is auto-set to 2MHz. Does that make sense?
But still no data.2013-11-07 12:44 PM
I haven't played with a stand-alone ST-LINK, mainly the Discovery boards, and via U-LINK and J-LINK. What firmware do you have on the ST-LINK? Confirm not in JTAG mode. If you have a serial port perhaps you'd want to display the APB/AHB clocks, and ITM registers.
RCC_ClocksTypeDef RCC_ClockFreq;
RCC_GetClocksFreq(&RCC_ClockFreq);
printf(''SYS:%d H:%d, P1:%d, P2:%d
'',
RCC_ClockFreq.SYSCLK_Frequency,
RCC_ClockFreq.HCLK_Frequency, // AHB
RCC_ClockFreq.PCLK1_Frequency, // APB1
RCC_ClockFreq.PCLK2_Frequency); // APB2
printf(''%08X %08X %08X %08X %08
X'',
*(volatile unsigned int *)0xE0000E00,
*(volatile unsigned int *)0xE0000E80,
*(volatile unsigned int *)0xE000EDF0,
*(volatile unsigned int *)0xE000EDFC,
*(volatile unsigned int *)0xE0042004);
For several of the Discovery boards you have to solder one of the SB (solder bridge) to get PB3 (SWO) to the F103 implementing the ST-LINK
2013-11-07 01:17 PM
{SYSCLK_Frequency = 72000000, HCLK_Frequency = 72000000, PCLK1_Frequency = 36000000, PCLK2_Frequency = 72000000, ADCCLK_Frequency = 36000000}
ITM_TER = 0xFFFFFFFF
ITM_TCR = 0x1000D
0xE000EDF0 = 0x30003
0xE000EDFC = 0x1000001
0xE0042004 = 0x27
2013-12-05 06:04 AM
Have you been able to solve the problem? I am having the same issue with ST Link Utility Serial WIre Viewer... Thanks!
2013-12-05 07:00 AM
Have you been able to solve the problem? I am having the same issue with ST Link Utility Serial WIre Viewer...
The same issue? Can you be a little bit more specific about your set up and tool chain, and such?2013-12-05 08:04 AM
I am using Em::Blocks IDE, which doesn't support ITM viewing, together with with ST-Link V2/ISOL for programming and debugging. This config works fine. For serial wire viewing, I am just using the STM32 STLink Utility.
2013-12-05 08:21 AM
And what board/chip is this with? Do you have a schematic?
The critical connection is PB3 SWO. The critical setting is that of the speed. The other setting should be the defaults for ITM_SendChar(), the ST-Link can let you mess with the channel setting, but not much else. Pay attention to the connectivity, and firmware version.2013-12-06 08:31 AM
Well, it's always a stupid mistake, like connecting to the wrong pin!
It is working now. Thank you for your interest.