lpcware

LPC824 MTB (Micro Trace Buffer) in standalone mode

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 18, 2016 by lpcware
Content originally posted in LPCWare by mariusz.mpicosys on Tue Apr 19 22:44:27 MST 2016
Hello,

I'm trying to use MTB on LPC824 in standalone mode.
The idea is to activate MTB on power up and then output the buffer
using UART when some unexpected event happens like hard fault.
The initialization looks like this:


#if !defined (__MTB_DISABLE)
    Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_MTB);
    LPC_MTB->MASTER = 0x00000000UL;
    LPC_MTB->POSITION = 0x00000000UL;
    LPC_MTB->FLOW = 0x00000000UL;
    // __MTB_BUFFER_SIZE == 256
    LPC_MTB->MASTER = MTB_MASTER_EN | (8UL - 4UL);
    LPC_SYSCON->EXTTRACECMD = (1 << 0)
#endif


All seems okay. I can see the POSITION register increment and some values
written at addresses 0x10000000-0x100000FF. The problem is that there are gaps
in the branching history. Running the code in debug mode or just attaching via SWD
fixes the situation until next power off.

Is this expected behavior?
How can fix this problem without attaching a programmer via SWD?

Thanks,
Mariusz

Outcomes