AnsweredAssumed Answered

STM32F4 ETM Trace configuration problem

Question asked by Mangano.Mattia on Mar 13, 2017
Latest reply on Apr 20, 2018 by botha.philip


I'm using ULINKpro and Keil uVision as debugger.

I can't make ETM Trace (sync mode, 4-bit data) works properly on a STM32F427ZG with a core clock of 168MHz.

I tried to lower the core clock working frequency to 42MHz, and that made Trace starts working. It's a problem of too high frequency?


Before this one, I tried to configure Trace on a STM32F407ZG, on the same board (pin-to-pin compatible) and with the same software (except for small mandatory fixes due to the different microcontroller). Strangely enough, this one works also at 168MHz, with the same Trace configuration!


Here is the configuration screen:




This is the initialization file:

FUNC void DebugSetup (void) {

 // Enable trace port and clock signals
  _WDWORD(0x40023830, _RDWORD(0x40023830) | 0x00000010); // RCC_AHB1ENR:   IO port E clock enable
  _WDWORD(0x40021000, 0x00002AA0);                        // GPIOE_MODER:   PE2..PE6 = Alternate function mode
  _WDWORD(0x40021008, 0x00003FF0);                        // GPIOE_OSPEEDR: PE2..PE6 = 100 MHz speed
  _WDWORD(0x4002100C, 0x00000000);                        // GPIOE_PUPDR:   PE2..PE6 = No Pull-up/Pull-down
  _WDWORD(0x40021020, 0x00000000);                        // GPIOE_AFRL:    PE2..PE6 = AF0
  _WDWORD(0xE0042004, 0x000000E0);                        // DBGMCU_CR: TRACE DATA enabled Size 4
  _WDWORD(0xE0042008, 0x00001000);                        // DBGMCU_APB1_FZ: the independent watchdog counter clock is stopped when the core is halted

SAVE CalibValue.hex 0x8004000, 0x08010000   // save device data

LOAD CalibValue.hex INCREMENTAL;            // load device data before reprogramming

** Invoke the function at debugger startup
DebugSetup();                               // Debugger Setup

** Execute upon software RESET
FUNC void OnResetExec(void)  {


When I run the debug, Trace status is "Data stream error". When I stop the execution, there is an attempt to process the captured data, and after an anomalous long time I get something like this:


Best regards.