2014-03-26 12:06 PM
Hello,
I cannot start SWO trace (nothing received in debug window) with STM32 W108CB. I have standard configuration of ITM, listed below. And i configured the 33 pin for SWO with line ''REG_GPIOC->CRL = 0x900;''. Software used is uVision 4.76, jtag ULINK2.
static
int
Debug_ITMDebug = 0;
void
InitializeTrace(
void
)
{
volatile
uint *ITM_TER = (
volatile
uint *)0xE0000E00;
volatile
uint *SCB_DHCSR = (
volatile
uint *)0xE000EDF0;
*SCB_DHCSR = 0x30003;
*((
volatile
uint *)0xE000EDFC) = 0x01000000;
// ''Debug Exception and Monitor Control Register (DEMCR)''
*((
volatile
uint *)0xE0042004) = 0x00000027;
*((
volatile
uint *)0xE00400F0) = 0x00000002;
// ''Selected PIN Protocol Register'': Select which protocol to use for trace output (2: SWO)
*((
volatile
uint *)0xE0000FB0) = 0xC5ACCE55;
// ITM Lock Access Register, C5ACCE55 enables more write access to Control Register 0xE00 :: 0xFFC
*((
volatile
uint *)0xE0000E80) = 0x00010009;
// ITM Trace Control Register
*((
volatile
uint *)0xE0000E40) = 0x0000000F;
// ITM Trace Privilege Register
*((
volatile
uint *)0xE0000E00) = 0x00000001;
// ITM Trace Enable Register. Enabled tracing on stimulus ports. One bit per stimulus port.
*((
volatile
uint *)0xE0001000) = 0x400003FE;
// DWT_CTRL
*((
volatile
uint *)0xE0040304) = 0x00000100;
// Formatter and Flush Control Register
if
((*SCB_DHCSR & 1) && (*ITM_TER & 1))
// Enabled?
Debug_ITMDebug = 1;
}
void
TraceChar(
char
ch)
{
static
volatile
unsigned
int
*ITM_STIM0 = (
volatile
unsigned
int
*)0xE0000000;
// ITM Port 0
static
volatile
unsigned
int
*SCB_DEMCR = (
volatile
unsigned
int
*)0xE000EDFC;
if
(Debug_ITMDebug && (*SCB_DEMCR & 0x01000000))
{
while
(*ITM_STIM0 == 0);
*((
volatile
char
*)ITM_STIM0) = ch;
}
}
2014-03-26 12:25 PM
Practically no support available here for the W108
The initialization seems like overkill, what's critical with SWO/SWV trace is that the CPU clock rate, and presumably ''baud'' rate, is consistently understood. Keil expects the Core Clock to be correct.2014-04-01 04:25 AM
Hello kashlikov.sergey,
You are using JTAG as Debug Probe. Please switch to SWD (Serial Wire Debug
).The Serial Wire Trace Output pin (SWO) can be used in Serial Wire Debug mode only.
Best Regards, Nouha