[ABANDONED] STM32F767 - trace ETM

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [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 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
  • 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
  • When I load my program I get some information
    [img]http://zupimages.net/up/17/04/3r5h.png[/img]


    and the trace seems to work until I try to configure the clock
    [img]http://zupimages.net/up/17/04/f0we.png[/img]

    but when i run my soft and stop it a few functions after, i have no data
    [img]http://zupimages.net/up/17/04/4flj.png[/img]

    my µC is running at 192MHz

    The post was edited 1 time, last by Brice_38_FR ().

  • Hi,

    so it seems to be functional in general.


    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?
    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
  • 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 Source Code

    1. void SystemClock_Config(void)
    2. {
    3. RCC_OscInitTypeDef RCC_OscInitStruct;
    4. RCC_ClkInitTypeDef RCC_ClkInitStruct;
    5. RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
    6. /**Configure the main internal regulator output voltage
    7. */
    8. __HAL_RCC_PWR_CLK_ENABLE();
    9. __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
    10. /**Initializes the CPU, AHB and APB busses clocks
    11. */
    12. RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
    13. RCC_OscInitStruct.HSEState = RCC_HSE_ON;
    14. RCC_OscInitStruct.LSIState = RCC_LSI_ON;
    15. RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
    16. RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
    17. RCC_OscInitStruct.PLL.PLLM = 12;
    18. RCC_OscInitStruct.PLL.PLLN = 192;
    19. RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
    20. RCC_OscInitStruct.PLL.PLLQ = 8;
    21. if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    22. {
    23. Error_Handler();
    24. }
    25. /**Activate the Over-Drive mode
    26. */
    27. if (HAL_PWREx_EnableOverDrive() != HAL_OK)
    28. {
    29. Error_Handler();
    30. }
    31. /**Initializes the CPU, AHB and APB busses clocks
    32. */
    33. RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
    34. |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
    35. RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    36. RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
    37. RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
    38. RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
    39. if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_6) != HAL_OK)
    40. {
    41. Error_Handler();
    42. }
    43. PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART3
    44. |RCC_PERIPHCLK_UART4|RCC_PERIPHCLK_UART5
    45. |RCC_PERIPHCLK_I2C1|RCC_PERIPHCLK_I2C2
    46. |RCC_PERIPHCLK_I2C3|RCC_PERIPHCLK_I2C4;
    47. PeriphClkInitStruct.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
    48. PeriphClkInitStruct.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
    49. PeriphClkInitStruct.Uart4ClockSelection = RCC_UART4CLKSOURCE_PCLK1;
    50. PeriphClkInitStruct.Uart5ClockSelection = RCC_UART5CLKSOURCE_PCLK1;
    51. PeriphClkInitStruct.I2c1ClockSelection = RCC_I2C1CLKSOURCE_PCLK1;
    52. PeriphClkInitStruct.I2c2ClockSelection = RCC_I2C2CLKSOURCE_PCLK1;
    53. PeriphClkInitStruct.I2c3ClockSelection = RCC_I2C3CLKSOURCE_PCLK1;
    54. PeriphClkInitStruct.I2c4ClockSelection = RCC_I2C4CLKSOURCE_PCLK1;
    55. if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    56. {
    57. Error_Handler();
    58. }
    59. /**Configure the Systick interrupt time
    60. */
    61. HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
    62. /**Configure the Systick
    63. */
    64. HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
    65. /* SysTick_IRQn interrupt configuration */
    66. HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
    67. }
    Display All
  • Hi,

    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
  • So I check the speed with the function SEGGER_MeasureCPUPerformance() and I measure it before and after the clock configuration

    Source Code

    1. 0> SEGGER J-Link V6.12f - Real time terminal output
    2. 0> Process: Ozone.exe
    3. 0>
    4. 0> Loops/sec: 1150
    5. 0> Your target is running at 16 MHz.
    6. 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
    7. 0>
    8. 0>
    9. 0> Loops/sec: 13968
    10. 0> Your target is running at 194 MHz.
    11. 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
    12. 0>
    Display All

    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
  • 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
  • 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
  • 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