Hi everyone,
I've been referred to this forum from the Energy Micro forum. My issue is the following: I have two enegy micro starter kits, one with an EFM32G890F128 (ARM Cortex M3) and EFM32WG990F256 (ARM Cortext M4F), both on the starter kits, using JLink. I can compile and run my code in uVision 5, no problem. I can set breakpoints, step through code, etc...
However, I fail to be able to do any tracing. I can not profile my code. It always says 'No synchronization' below in the status bar.
The EMF32G ha no ETM, so I try using SWO using the following code:
/* Enable GPIO clock */ CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO; /* Enable Serial wire output pin */ GPIO->ROUTE |= GPIO_ROUTE_SWOPEN; /* Set correct location */ GPIO->ROUTE = (GPIO->ROUTE & ~(_GPIO_ROUTE_SWLOCATION_MASK)) | BSP_TRACE_SWO_LOCATION; /* Enable output on correct pin. */ TRACE_ENABLE_PINS(); /* Enable debug clock AUXHFRCO */ CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN; /* Wait until clock is ready */ while (!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY)) ; /* Enable trace in core debug */ CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; /* Enable PC and IRQ sampling output */ DWT->CTRL = 0x400113FF; /* Set TPIU prescaler to 16. */ TPI->ACPR = 0xf; /* Set protocol to NRZ */ TPI->SPPR = 2; /* Disable continuous formatting */ TPI->FFCR = 0x100; /* Unlock ITM and output data */ ITM->LAR = 0xC5ACCE55; ITM->TCR = 0x10009;
The EMF32WG does have an ETM, so I try this code.
/* Enable peripheral clocks */ CMU->HFCORECLKEN0 |= CMU_HFCORECLKEN0_LE; CMU->HFPERCLKEN0 |= CMU_HFPERCLKEN0_GPIO; CMU->OSCENCMD = CMU_OSCENCMD_AUXHFRCOEN; /* Wait until AUXHFRCO clock is ready */ while (!(CMU->STATUS & CMU_STATUS_AUXHFRCORDY)) ; /* Enable Port D, pins 3,4,5,6 for ETM Trace Data output */ GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE3_MASK) | GPIO_P_MODEL_MODE3_PUSHPULL; GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE4_MASK) | GPIO_P_MODEL_MODE4_PUSHPULL; GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE5_MASK) | GPIO_P_MODEL_MODE5_PUSHPULL; GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE6_MASK) | GPIO_P_MODEL_MODE6_PUSHPULL; /* Enable Port D, pin 7 for DBG_TCLK */ GPIO->P[3].MODEL = (GPIO->P[3].MODEL & ~_GPIO_P_MODEL_MODE7_MASK) | GPIO_P_MODEL_MODE7_PUSHPULL; /* Configure trace output for alternate location */ GPIO->ROUTE = GPIO->ROUTE | GPIO_ROUTE_TCLKPEN | GPIO_ROUTE_TD0PEN | GPIO_ROUTE_TD1PEN | GPIO_ROUTE_TD2PEN | GPIO_ROUTE_TD3PEN | GPIO_ROUTE_ETMLOCATION_LOC0;
Nothing really seems to matter. Note that I can profile in the enegy aware profiler, from Energy Micro, but its not as feature rich as I would like. Anyone have any idea what I am doing wrong, and how I need to configure my MCU to get this up and running?
Thanks in advance!
Vincent