i am using stm32f7 and for debugging ulink pro, i have tried to enable ETM but not succeeded.
the connector i am using is, where traceD0-D3 are PE3-PE6.
the *ini file i used is
01. /*------------------------------------------------------------------- 02. ** Define the function to enable the trace port 03. **-----------------------------------------------------------------*/ 04. FUNC void EnableTPIU(void) { 05. _WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR 06. // _WDWORD(0xE0042004, 0x00000020); // Set 4-pin tracing via DBGMCU_CR 07. 08. _WDWORD(0xE000EDFC, 0x01000000); // 09. _WDWORD(0xE00400F0, 0x00000000); // 10. _WDWORD(0xE0040004, 0x00000008); // 11. _WDWORD(0xE0001020, 0x002002CA); // 12. _WDWORD(0xE0001024, 0x0000000); // 13. _WDWORD(0xE0001028, 0x00000008); // 14. 15. _WDWORD(0xE0041004, 0x00000000); // 16. _RDWORD(0xE004100C, 0x00000003); // 17. _WDWORD(0xE0041040, 0x00000002); // 18. _WDWORD(0xE0041080, 0x00000001); // 19. _WDWORD(0xE004108C, 0x000000FF); // 20. _WDWORD(0xE0041004, 0x00000001); // 21. 22. } 23. 24. /*------------------------------------------------------------------- 25. ** Invoke the function at debugger startup 26. **-----------------------------------------------------------------*/ 27. EnableTPIU(); 28. 29. /*------------------------------------------------------------------- 30. ** Execute upon software RESET 31. **-----------------------------------------------------------------*/ 32. FUNC void OnResetExec(void) { 33. EnableTPIU(); 34. }
which was given in reference manual as
40.15.4 Configuration example
To output a simple value to the TPIU:
• Configure trace I/Os: enable TRACE_CLKINEN in the STM32F75xxx and
STM32F74xxx debug configuration register (DBGMCU_CR).
• Write @ E000EDFC 01000000; SCS: set TRCENA, otherwise trace registers are not
accessible.
• Write @ E00400F0 00000000; TPIU: select SYNC PORT Mode
• Write @ E0040004 00000008; TPIU: select TPIU PORT SIZE=4
• Write @ E0001020 002002CA; WT: PC MATCH Comparator (PC=0x2002CA)
• Write @ E0001024 00000000; DWT: No mask apply on comparator
• Write @ E0001028 00000008; DWT: ETM trig on PC on match
ETM:
• Write @ E0041004 00000000; Disable ETM
• Read @ E004100C 00000003; ETM should be in Idle state
• Write @ E0041040 00000002; Instruction trace source ID = 0x2
• Write @ E0041080 00000001; Resource for ViewInst enabling event is “always
TRUE”
• Write @ E004108C 000000FF; Processor comparator selection for Start:
pc_match0 (=>DWT match)
• Write @ E0041004 00000001; Enable ETM
Hello Bilal,
at the moment, our debug description ties the trace pins to the PE* port. If you want to use the INI file method, you have to uncheck the Enable box on the Pack tab of the Cortex-M Target Driver Setup. This will give you the option to use the INI file method and define your trace pins as you see fit.
Kind regards,
Christopher
Thank you Christopher for your quick reply
I unchecked Enable box on the Pack tab of the Cortex-M Target Driver Setup, included ini file but etm not working. i am adding my ini file, can you guide me where am i doing it wrong.
/*------------------------------------------------------------------- ** Define the function to enable the trace port **-----------------------------------------------------------------*/ FUNC void EnableTPIU(void) { _WDWORD(0x40023830, _RDWORD(0x40023830) | 0x00000004); // RCC_AHB1ENR: IO port PC 1,8,12 clock enable _WDWORD(0x40021000, 0x02020008); // GPIOC_MODER: PC1,PC8,PC12 = Alternate function mode _WDWORD(0x40021008, 0x0303000C); // GPIOC_OSPEEDR: PC1,PC8 PC12 = 100 MHz speed _WDWORD(0x4002100C, 0x00000000); // GPIOC_PUPDR: PC1,PC8 PC12 = No Pull-up/Pull-down _WDWORD(0x40021020, 0x00000000); // GPIOC_AFRL: PC1,PC8 PC12 = AF0 _WDWORD(0x40021024, 0x00000000); // GPIOC_AFRH: PC1,PC8 PC12 = AF0 _WDWORD(0x40023830, _RDWORD(0x40023830) | 0x00000008); // RCC_AHB1ENR: IO port D2 clock enable _WDWORD(0x40021000, 0x00000002); // GPIOD_MODER: PD2 = Alternate function mode _WDWORD(0x40021008, 0x00000003); // GPIOD_OSPEEDR: PD2 = 100 MHz speed _WDWORD(0x4002100C, 0x00000000); // GPIOD_PUPDR: PD2 = No Pull-up/Pull-down _WDWORD(0x40021020, 0x00000000); // GPIOD_AFRL: PD2 = AF0 _WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR _WDWORD(0xE000EDFC, 0x01000000); // _WDWORD(0xE00400F0, 0x00000000); // _WDWORD(0xE0040004, 0x00000008); // _WDWORD(0xE0001020, 0x002002CA); // _WDWORD(0xE0001024, 0x0000000); // _WDWORD(0xE0001028, 0x00000008); // _WDWORD(0xE0041004, 0x00000000); // _RDWORD(0xE004100C, _RDWORD(0xE004100C) | 0x00000003); // _WDWORD(0xE0041040, 0x00000002); // _WDWORD(0xE0041080, 0x00000001); // _WDWORD(0xE004108C, 0x000000FF); // _WDWORD(0xE0041004, 0x00000001); // } /*------------------------------------------------------------------- ** Invoke the function at debugger startup **-----------------------------------------------------------------*/ EnableTPIU(); /*------------------------------------------------------------------- ** Execute upon software RESET **-----------------------------------------------------------------*/ FUNC void OnResetExec(void) { EnableTPIU(); }
2.) can you tell why JTAG is not working for stm32f7,instead it is working for stm32f4.
thank you and regards Bilal
can you please contact support regarding this issue?
I would like to continue this discussion via our support channel. I might have a solution for your problem.
Thank you christopher, my problem is still unsolved. Can you guide me, how can i write ini file according to assigned pins.
Thank you so much Bilal
please contact support: support.intl@keil.com and refer to this forum thread.
Hello,
I'm working on a custom board using STM32F765 and want to use ULINKpro+ETM. Did you find a solution for your problem? What max. core clock is possible with ETM enabled? Thank you.