cancel
Showing results for 
Search instead for 
Did you mean: 

Trace.ini file for STM32H753 tracing with Keil IDE and ULINK Pro

Rajesh Tripathi
Associate III

Where to find trace.ini file or it's content for STM32H743/53 tracing with Keil uVision and ULINKPro ?

5 REPLIES 5

Probably something you want to query Keil for. The H7 has a SWO Trace Funnel, it doesn't use the TRACEDATA/TRACECLK pins.

The script would need to walk through enabling clocks, like those in DBGMCU_CR and DBGMCU_APBxyz

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I'm thinking something like this, working blind...

FUNC void SetupTrace (void) {
 
  _WDWORD(0x5C001004,(_RDWORD(0x5C001004) | 0x00700000)); // DBGMCU_CR D3DBGCKEN, D1DBGCKEN, TRACECLKEN
 
  _WDWORD(0x5C004FB0, 0xC5ACCE55); // Unlock Funnel
  _WDWORD(0x5C003FB0, 0xC5ACCE55);
 
  //SWO current output divisor register
  //This divisor value (0x000000C7) corresponds to 400 MHz, with 2 MHz SWO Clock
  //To change it, you can use the following rule
  // value = (CPU Freq/sw speed)-1
  //_WDWORD(0x5C003010, 0xC7);
 
  //SWO selected pin protocol register
  _WDWORD(0x5C0030F0, 0x00000002);
 
  //Enable ITM input of SWO trace funnel
  _WDWORD(0x5C004000, (_RDWORD(0x5C004000) | 0x00000001));
 
  // ENABLE SWO PB3
 
  //RCC_AHB4ENR enable GPIOB clock
   _WDWORD(0x580244E0, (_RDWORD(0x580244E0) | 0x00000002));
 
  // Configure GPIOB pin 3 as AF
  _WDWORD(0x58020400, ((_RDWORD(0x58020400) & 0xffffff3f) | 0x00000080));
 
  // Configure GPIOB pin 3 Speed
  _WDWORD(0x58020408, (_RDWORD(0x58020408) | 0x00000080));
 
  // Force AF0 for GPIOB pin 3
  _WRDWORD(0x58020420, (_RDWORD(0x58020420) & 0xFFFF0FFF));
}
 
// Executed after reset via uVision's 'Reset'-button
FUNC void OnResetExec (void) {
  SetupTrace();
}
 
SetupTrace();

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Rajesh Tripathi
Associate III

Thanks Clive for prompt reply. I'll contact Keil. I actually want to use ETM for performance monitoring with 4 bit use for trace data. I've found example trace.ini file for STM32F4

http://www.keil.com/support/man/docs/ulinkpro/ulinkpro_STM32F4xx_ETM.htm

Not sure if the same file can work or needs some additional settings.

Thanks

The Data Sheet talks about PE2..PE6, but the Reference Manual says it doesn't route "no synchronous trace output, that is, no TRACEDATA or TRACECLK pins"

The F4 initialization brings up GPIOE and the pins, you'd have to replicate that on the H7 for a starts. The registers will be at different locations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
  //RCC_AHB4ENR enable GPIOE clock
  _WDWORD(0x580244E0, (_RDWORD(0x580244E0) | 0x00000010));
 
  // Configure GPIOE pin 2-6 as AF
  _WDWORD(0x58021000, ((_RDWORD(0x58021000) & 0xffffc00f) | 0x00002AA0));
 
  // Configure GPIOE pin 2-6 Speed
  _WDWORD(0x58021008, (_RDWORD(0x58021008) | 0x00002AA0));
 
  // Force AF0 for GPIOE pin 2-6
  _WRDWORD(0x58021020, (_RDWORD(0x58021020) & 0xF00000FF));

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..