Friday, November 24th 2017, 9:11pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

1

Thursday, January 26th 2017, 3:35pm

[ABANDONED] STM32F767 - trace ETM

Hi

I'm trying to activate the ETM trace (TRACED[0-3] + TRACECK) on my STM32F767BI

I download "Ozone J-Trace PRO Tutorial Project" at https://www.segger.com/ozone-trace-tutorial.html to see how to use it on STM32
But i didn't find (or didn't understand) how you activate the trace. On this exemple I can only see basic function whitout relation to trace.

Do you have some documentation or exemple ?

I use a J TRACE with ozone (or eclipse).
Code is compiled with GNU ARM GCC

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

2

Thursday, January 26th 2017, 3:52pm

Hi,


what is displayed in the Instruction Trace window of Ozone ?
(View->Instruction Trace)

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

3

Thursday, January 26th 2017, 4:44pm

When I load my program I get some information



and the trace seems to work until I try to configure the clock


but when i run my soft and stop it a few functions after, i have no data


my µC is running at 192MHz

This post has been edited 1 times, last edit by "Brice_38_FR" (Jan 26th 2017, 4:45pm)


SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

4

Thursday, January 26th 2017, 5:01pm

Hi,

so it seems to be functional in general.


Quoted

and the trace seems to work until I try to configure the clock

Does trace stop working exactly when clock is switched? Or could it be that Pins are reconfigured shortly before or after?

Quoted

my µC is running at 192MHz

Are you sure? Maximum core clock of the device is 216 MHz, and Trace clock is usually 1/2 of core clock.
J-Trace only supports up to 100MHz Trace clock (J-Trace Pro supports 150MHz).

Therefore you either need to use a core clock of <200MHz or (if possible by chip design) change the Trace clock to core clock ratio.


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

5

Thursday, January 26th 2017, 5:18pm

About the cpu speed: I'm sure about 192MHz, I configure it at this speed in CubeMx to be able to use the trace :) but i will check to be sure

I remove all code after the clock initialisation to be sure about gpio reconfiguration and I still loss trace after the clock initialisation.

I look deeper in the SystemClock_Config function and i find that the trace stop when I enter in the function HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) at l:46

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
void SystemClock_Config(void)
{

  RCC_OscInitTypeDef RCC_OscInitStruct;
  RCC_ClkInitTypeDef RCC_ClkInitStruct;
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;

    /**Configure the main internal regulator output voltage
    */
  __HAL_RCC_PWR_CLK_ENABLE();

  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

    /**Initializes the CPU, AHB and APB busses clocks
    */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.LSIState = RCC_LSI_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 12;
  RCC_OscInitStruct.PLL.PLLN = 192;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = 8;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

    /**Activate the Over-Drive mode
    */
  if (HAL_PWREx_EnableOverDrive() != HAL_OK)
  {
    Error_Handler();
  }

    /**Initializes the CPU, AHB and APB busses clocks
    */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK) 
  {
    Error_Handler();
  }

  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART3
                              |RCC_PERIPHCLK_UART4|RCC_PERIPHCLK_UART5
                              |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_I2C2
                              |RCC_PERIPHCLK_I2C3|RCC_PERIPHCLK_I2C4;
  PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
  PeriphClkInitStruct.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
  PeriphClkInitStruct.Uart4ClockSelection = RCC_UART4CLKSOURCE_PCLK1;
  PeriphClkInitStruct.Uart5ClockSelection = RCC_UART5CLKSOURCE_PCLK1;
  PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
  PeriphClkInitStruct.I2c2ClockSelection = RCC_I2C2CLKSOURCE_PCLK1;
  PeriphClkInitStruct.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1;
  PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PCLK1;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
  {
    Error_Handler();
  }

    /**Configure the Systick interrupt time
    */
  HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

    /**Configure the Systick
    */
  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

  /* SysTick_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

6

Friday, January 27th 2017, 8:57am

Hi,

Quoted

About the cpu speed: I'm sure about 192MHz, I configure it at this speed in CubeMx to be able to use the trace :) but i will check to be sure

I am looking forward for your feedback.
Another option would be to select a slower clock (e.g. 96 MHz) and test if this works.

Switching the core / trace clock should not cause issues with the trace function of J-Link / Ozone.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

7

Friday, January 27th 2017, 9:10am

So I check the speed with the function SEGGER_MeasureCPUPerformance() and I measure it before and after the clock configuration

Source code

1
2
3
4
5
6
7
8
9
10
11
12
 0> SEGGER J-Link V6.12f - Real time terminal output
 0> Process: Ozone.exe
 0> 
 0> Loops/sec: 1150
 0> Your target is running at 16 MHz.
 0> This value is calculated in comparison to a reference Cortex-M4 running in iRAM with zero wait states and full compiler optimizations built on GCC V5.4.3 used in Segger Embedded Studio
 0> 
 0> 
 0> Loops/sec: 13968
 0> Your target is running at 194 MHz.
 0> This value is calculated in comparison to a reference Cortex-M4 running in iRAM with zero wait states and full compiler optimizations built on GCC V5.4.3 used in Segger Embedded Studio
 0> 

I don't have any code optimisation (-O0) and the debug optmisation is ondefault ( -g)
I continue looking in the function "HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) " and I found that the trace stop working just after I configure the system clock source with __HAL_RCC_SYSCLK_CONFIG(RCC_ClkInitStruct->SYSCLKSource);

edit: just saw your answer, will try cpu at 96MHz

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

8

Friday, January 27th 2017, 9:16am

I just try at 96MHz and it works ....

I don't understand why it doesn't work at 192MHz

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

9

Friday, January 27th 2017, 9:30am

Hi,


when using the 96MHz configuration..
a) What does SEGGER_MeasureCPUPerformance() report?
b) Could you please make a screenshot of the Rawtrace tab in the J-Link Control panel (can be opened by clicking the green J-Link icon in the system tray) while the application is been debugged and traced in Ozone, and the CPU is not stopped?


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

10

Friday, January 27th 2017, 9:46am

The report and the trace tab

Quoted

Loops/sec: 6988
Your target is running at 97 MHz.



SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

11

Friday, January 27th 2017, 10:41am

Hi,


thanks for the screenshot.
So it works as expected - 96 MHz core clock, 48 MHz trace clock.

Would it be possible for you to provide us with your project so that we can give it a try here?

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

12

Friday, January 27th 2017, 11:55am

Hi

Yes I could send you the cubeMx project and/or the eclipse project. How do we proceed ?

I did more tests and found that the trace is working with a 120MHz CPU

The main difference between 120MHz and 192MHz is flash latency and overdrive

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

13

Monday, January 30th 2017, 5:08pm

a small update on my problem :)

Brice_38_FR

Beginner

Date of registration: Jan 26th 2017

Posts: 9

14

Wednesday, February 1st 2017, 3:54pm

Niklas , any idea ?

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,691

15

Wednesday, February 1st 2017, 4:04pm

Hi,


I am currently pretty booked.
Can you please provide all files/projects necessary to replicate and test the issue?

Do you want to send it via mail or do you have some webspace yourself...?


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link