Difference between revisions of "4-Pin Trace with STM32F2 / STM32F4"

From SEGGER Wiki
Jump to: navigation, search
Line 1: Line 1:
'''To enable 4-Pin Trace with STM32F429 device:'''
 
 
 
== Configure required pins for trace output ==
 
== Configure required pins for trace output ==
   
1. Create a file for the device:
+
=== 1. Create a file for the device: ===
  +
 
/*-------------------------------------------------------------------
 
/*-------------------------------------------------------------------
 
** Define the function to enable the trace port
 
** Define the function to enable the trace port
 
**-----------------------------------------------------------------*/
 
**-----------------------------------------------------------------*/
 
FUNC void EnableTPIU(void) {
 
FUNC void EnableTPIU(void) {
_WDWORD(0x40023830, 0x00000010); //Enable GPIOE clock
+
_WDWORD(0x40023830, 0x00000010); // Enable GPIOE clock
_WDWORD(0x40021000, 0x00002AA0); //Configure PE2, PE3, PE4, PE5, and PE6 as AF
+
_WDWORD(0x40021000, 0x00002AA0); // Configure PE2, PE3, PE4, PE5, and PE6 as AF
 
_WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR
 
_WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR
 
}
 
}
Line 18: Line 17:
 
EnableTPIU();
 
EnableTPIU();
   
2. Set the file as initialization file
+
=== 2. Set the file as initialization file ===
  +
  +
* Open the dialog "Options for Target - Debug".
   
 
[[File:wiki-trace-initfile.png]]
 
[[File:wiki-trace-initfile.png]]
  +
  +
* Set the created file as Initialization File.
  +
 
== Configure µVision for ETM trace ==
 
== Configure µVision for ETM trace ==
  +
  +
* Click Settings to open the "Target Driver Setup" dialog.
  +
* Click the Trace tab.
   
 
[[File:wiki-trace-settings-wclock.png]]
 
[[File:wiki-trace-settings-wclock.png]]
  +
  +
* Set Enable and ETM Trace Enable.
  +
* Set Trace Port to "Sync Trace Port with 4-bit Data".
  +
* The Core Clock must be adjusted accordingly the device configuration.
  +
* Start the debugging session and open an "Instruction Trace" window.

Revision as of 14:37, 15 January 2016

Configure required pins for trace output

1. Create a file for the device:

/*-------------------------------------------------------------------
** Define the function to enable the trace port
**-----------------------------------------------------------------*/
FUNC void EnableTPIU(void) {
  _WDWORD(0x40023830, 0x00000010); // Enable GPIOE  clock
  _WDWORD(0x40021000, 0x00002AA0); // Configure PE2, PE3, PE4, PE5, and PE6 as AF
  _WDWORD(0xE0042004, 0x000000E0); // Set 4-pin tracing via DBGMCU_CR
}

/*-------------------------------------------------------------------
** Invoke the function at debugger startup
**-----------------------------------------------------------------*/
EnableTPIU();

2. Set the file as initialization file

  • Open the dialog "Options for Target - Debug".

wiki-trace-initfile.png

  • Set the created file as Initialization File.

Configure µVision for ETM trace

  • Click Settings to open the "Target Driver Setup" dialog.
  • Click the Trace tab.

wiki-trace-settings-wclock.png

  • Set Enable and ETM Trace Enable.
  • Set Trace Port to "Sync Trace Port with 4-bit Data".
  • The Core Clock must be adjusted accordingly the device configuration.
  • Start the debugging session and open an "Instruction Trace" window.