Timers not stopping properly while step-debugging

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User22281
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted
Dear Aurix Experts,

I use the STM0 to trigger an interrupt every 1 ms. In normal execution mode, everything works as expected.
In debug mode, I have configured STM to halt on debug suspend, so I can step through the code and perform some debugging.
However, even a single instruction step causes the STM0 to advance a few milliseconds, triggering the STM interrupt after every step.
In practice, this means I cannot step through the application code because the STM interrupt is firing all the time in an endless loop.

It seems that the debugger is taking a really long time to suspend the STM0 after the CPU is halted (STM0 should be suspended immediately after CPU has performed the requested step).
Is there any way to configure how timers/peripherals are suspended when debugging is enabled?

I have read in other posts about disabling interrupts while debugging. This is not a suitable solution for me since it would impact the temporal results of the execution.

My STM initialization function (using iLLD drivers):

void SystemTmrInit(void)
{
IfxStm_CompareConfig cfg;

/* Suspend by debugger enabled */
IfxStm_enableOcdsSuspend(&MODULE_STM0);

/* Prepare timer compare configuration */
IfxStm_initCompareConfig(&cfg);
cfg.triggerPriority = SYS_TMR_ISR_PRIO;
cfg.ticks = SYS_TMR_PER >> 5; /* 0x186A0U = 1ms@100 MHz */
cfg.compareOffset =IfxStm_ComparatorOffset_5;
cfg.compareSize = IfxStm_ComparatorSize_12Bits;

/* Write configuration in registers */
IfxStm_initCompare(&MODULE_STM0, &cfg);
}

My setup:
IDE:AURIX DS Version: 1.5.0, Build id: 20210623-0545
Board: TriBoard TC3X4L
Debugger: Infineon DAP miniwiggler (on-board)

Many thanks in advance.
0 Likes
7 Replies
ScottW
Employee
Employee
10 sign-ins First solution authored First like received
Are you debugging a single core or multiple cores?
0 Likes
User22281
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted
Hello Scott,

I am using only one core (the second core is always suspended).
0 Likes
ScottW
Employee
Employee
10 sign-ins First solution authored First like received
I've tested using multiple debuggers and this behavior depends on the debugging environment. Using the built-in USB DAP interface with ADS results in the behavior you describe.
0 Likes
User22281
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted
Is it possible to modify some configuration parameter or register in the debugger/controller to correct this behavior? Otherwise, this would mean that the on-board debugger is pretty much useless.

Or should I look for other (and possibly more expensive) debugging solutions, like PLS UDS, Lauterbach or similar?
0 Likes
ScottW
Employee
Employee
10 sign-ins First solution authored First like received
If I set:

CBS_TRC0.B.SUSIN = 1;


in ADS, I consistently get 599 STM counts per step, which is much better than what was happening before (but still not ideal). This is likely due to the information the miniwiggler exchanges with the device on each step.

If you want more precise control over the timing, an external professional debugger like one of the ones you mentioned (or iSYSTEM) is recommended. I tested on Lauterbach.
0 Likes
User22281
Level 2
Level 2
10 replies posted 10 sign-ins 5 replies posted
If I set at the beginning of the core0_main() function:

MODULE_CBS.TRC[0].B.SUSIN = 1;

Now I cannot step at all. F5 (step into) or F6 (step over) in Aurix DS remain static in the same instruction.

Where can I find information about CBS registers? I checked the AURIX™ TC3xx User’s Manual V2.0.0 but CBS registers are not listed there (unless I missed them).

Thank you very much.
0 Likes
User20311
Level 1
Level 1
10 sign-ins 10 replies posted 5 replies posted
For FreeRTOS:
5343.attach
5344.attach
0 Likes