Monday, February 19th 2018, 8:31pm UTC+1

You are not logged in.

  • Login
  • Register

jheissjr

Beginner

Date of registration: May 5th 2016

Posts: 4

1

Tuesday, February 6th 2018, 2:29pm

why does SWO Viewer change SWO clock frequency

I observe that when Edit->Configure is selected in the SWO Viewer, the data rate of ITM data coming out of the target SWO pin changes frequency. That is, the frequency of signal changes. Is that correct behavior?

I also observe that running the SWO Viewer simultaneously with JLinkGDBServer.exe is not reliable. Should only one be open at a time?

Can you suggest any checks when SWO data is going into the JLink SWO pin but data is not displayed in the SWO Viewer?

SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

2

Wednesday, February 7th 2018, 12:32pm

Hello,

Thank you for your inquiry.

Quoted

That is, the frequency of signal changes. Is that correct behavior?

Could you provide screenshots that show the behaviour you are seeing?

Quoted

I also observe that running the SWO Viewer simultaneously with JLinkGDBServer.exe is not reliable. Should only one be open at a time?

They should be working next to each other. In what order are you enabling the programs? Does the behaviour change if you switch the start order?

Quoted

Can you suggest any checks when SWO data is going into the JLink SWO pin but data is not displayed in the SWO Viewer?

You can see SWO trasactions int he J-Link Control panel in the SWV tab.

Best regards,
Nino

jheissjr

Beginner

Date of registration: May 5th 2016

Posts: 4

3

Wednesday, February 7th 2018, 6:03pm

Here is a video for your request of SWO Viewer changing the signal frequency of the SWO output data. The frequency changes when OK is selected in Config Dialog. The oscilloscope monitors the data going into the JLink SWO pin and shows how the speed changes when OK is selected. Equally important is that data streaming into the JLink SWO pin is not shown in the viewer. Data is streaming into the JLink on stimulus port 0 and stimulus port 1 but it is not shown in the window. The target CPU clock is 300,000kHz which agrees with the Measure Dialog which reports 304,000kHz so I don't believe that is the issue.

https://youtu.be/2kr0FdegiWU

Quoted

In what order are you enabling the programs? Does the behaviour change if you switch the start order?

Use these steps to reproduce the unresponsive behavior of Jlink and SWO Viewer running simultaneously.
- Start a debug session in an IDE.
- Open SWO Viewer. Establish a connection so SWO data is streaming in SWO Viewer.
- Close SWO Viewer.
- At this point, the debug session in the IDE becomes unresponsive. Single Line Stepping, Start, Stop, etc stops working.

SWO Viewer hangs from 0:13 to 0:43 for 30 seconds. At 0:44, debug functions like single line stepping, run stop responding in the IDE. They worked before SWO Viewer was opened.
https://youtu.be/rA-9U2kgJ2Q

This post has been edited 1 times, last edit by "jheissjr" (Feb 7th 2018, 6:16pm)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

4

Friday, February 9th 2018, 11:27am

Hello,

Thank you for providing the additional information.
What target device are you trying to debug?
Is it an eval board or custom hardware?
To understand you correctly. You set the SWO clock manually in your target application?
The reason the clock changes is because SWO viewer will check which swo clock speeds are available on your debug probe.
Then it will set it to the highest possible value automatically.
You seem to be using an older version of J-Link software. Could you update to the latest version and see if the behaviour changes?
More information about the SWO Viewer default settings can be found in the J-Link user manual.

Best regards,
Nino

jheissjr

Beginner

Date of registration: May 5th 2016

Posts: 4

5

Friday, February 9th 2018, 2:17pm

J-Link was upgraded when you said an outdated version of J-Link was being used. There is no difference when upgrading to V6.30. The behavior still occurs with V6.30.

Target - Atmel Cortex-M7 ATSAMS70N20
SWO Clock - Set manually in application, code provided below.
Board - Custom, schematic provided below.

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
void init_swo(const uint32_t cpuCoreFreqHz) /* cpuCoreFreqHz = 300000000 */
{
	uint32_t SWOSpeed = 19200; /* default 19.2k baud rate */
	uint32_t SWOPrescaler = (cpuCoreFreqHz/(SWOSpeed*2)) - 1; /* SWOSpeed in Hz, note that cpuCoreFreqHz is expected to be match the CPU core clock */

	/* Configure the TPIU - pages and info from ATSAMS70N20 datasheet */
	CoreDebug->DEMCR = (1UL<<24); 			/* page 83, step 1 - "Debug exception and monitor register": bit 24 is TRCENA which enables DWT and ITM units. page 766 at https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf */
	TPI->SPPR = 0x00000002; 				/* page 83, step 2 - "Selected PIN Protocol Register": Select which protocol to use for trace output (2: SWO UART/NRZ, 1: SWO Manchester encoding) */
	TPI->FFCR = 0x00000100; 				/* page 83, step 3 - Formatter and Flush Control Register */
	TPI->ACPR = SWOPrescaler; 				/* page 83, step 4 - "Async Clock Prescaler Register". Scale the baud rate of the asynchronous output */
	ITM->LAR = 0xC5ACCE55; 					/* ITM Lock Access Register, C5ACCE55 enables more write access to Control Register 0xE00 :: 0xFFC */
	ITM->TCR |= ((1UL<<16) | (1UL<<4) | (1UL<<2) | (1UL<<0)); 	/* pg 776, ITM Trace Control Register at https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf;
																	- set TraceBusID to 1,
																	- enable SWOENA (async clocking of timestamp counter
																	- enable SYNCENA (Synchronization packet transmission for a synchronous TPIU)
																	- enable ITMENA (enable ITM)*/
	ITM->TER = (0xFFFF); 					/* ITM Trace Enable Register. Each bit location corresponds to a virtual stimulus register; when a bit is set, a write to the appropriate stimulus location results in a packet being generated, except when the FIFO is full.
												- only ITM_TER0 is implemented as ITM_TER according to one register in .h file. Registers ITM_TER1 to ITM_TER7 seem unimplemented
												- ITM_TER0.0 - ITM_STIM0 (ITM->PORT[0])
												- ITM_TER0.1 - ITM_STIM1 (ITM->PORT[1])
												- ITM_TER0.31 - ITM_STIM31 (ITM->PORT[31]) */
	DWT->CTRL = 0x400003FE; /* DWT_CTRL */

	/* Check if Trace Control Register (ITM->TCR at 0xE0000E80) is set */
	if ((ITM->TCR & (1UL<<0)) == 0) /* check Trace Control Register if ITM trace is enabled (ITM->TCR.ITMENA)*/
		while(1){} /* not enabled? */

	/* Check if the requested channel stimulus port (ITM->TER at 0xE0000E00) is enabled */
	if ((ITM->TER & (1UL<<0))==0) /* check Trace Enable Register if requested port is enabled */
		while(1){} /* requested port not enabled? */
}

void SWO_send_char(void)
{
	while (ITM->PORT[0].u32 == 0) /* Wait until STIMx is ready, then send data */
	{}
	ITM->PORT[port_bit].u8 = 'A';
}
jheissjr has attached the following image:
  • schematic.PNG

This post has been edited 2 times, last edit by "jheissjr" (Feb 9th 2018, 2:21pm)


SEGGER - Nino

Super Moderator

Date of registration: Jan 2nd 2017

Posts: 699

6

Monday, February 12th 2018, 9:46am

Hello,

Quoted

SWO Clock - Set manually in application, code provided below.


This will not work. For SWO to work with a debug probe, target and debug probe need to set the same SWO speed which both support with their dividers.
So each time you start SWOViewer or any debug software that supports SWO your application ITM settings will be overwritten.
To use SWO remove any SWO init from your application and let J-Link handle it, otherwise it will not work.

Best regards,
Nino

jheissjr

Beginner

Date of registration: May 5th 2016

Posts: 4

7

Monday, February 12th 2018, 2:43pm

Nino,

I used this sequence. Open JLink.exe. Connect to the target. Open SWO Viewer. Select Measure in the dialog. When Measure is selected this message is given. SWO Viewer stops responding after closing the message.
jheissjr has attached the following image:
  • swo viewer message.GIF