Error after suspend/breakpoint during debug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error after suspend/breakpoint during debug

2,131 Views
buch2001
Contributor II

Hi all,
I inherited a project to develop and I have a problem with debugging.
When I put a breakpoint (or do "suspend") the software does not resume working properly.
I give an example with the code:
if(locVBatt >= VBATT_MAX_OFF)
{
batSts = BAT_FILT_OVERV;
vCnt++;
}
else if(locVBatt <= VBATT_MIN_OFF)
{
batSts = BAT_FILT_UNDERV;
vCnt++;
}
else
{
vCnt = RESET;
}
I put a breakpoint inside the first "if" (let's say it's "true"), then restart code execution. The brekpoint continues to run ad always enters the first branch.
Then I move the brekpoint into the "else if", change the conditions so that it is "true" but never enters the "else if" but continues to enter the first "if".

Obviously if I create the conditions that it is true the "else if" at the first execution works correctly.

Same thing if instead of a brekpoint I make a normal "suspend" during the run.
It just seems that the software does not resume working properly, I have never seen such behavior and I really don't know how to fix it.

Thank you very much to those who can help me

 

0 Kudos
Reply
9 Replies

2,123 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @buch2001,

Can you specify the MCU, IDE and the debug probe?

 

Thank you,

BR, Daniel

0 Kudos
Reply

2,122 Views
buch2001
Contributor II

Sure, sorry.

I'm using MC9S12ZVMARM, the IDE is CodeWarrior and I'm debugging via Multilink universal

0 Kudos
Reply

2,115 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Have you tried updating the PE Micro Multilink drivers

danielmartynek_0-1674554561327.png

 

and the firmware of the probe?

https://www.pemicro.com/products/product_viewDetails.cfm?product_id=15320180&productTab=4

danielmartynek_1-1674555254471.png

danielmartynek_2-1674555315697.png

 

 

0 Kudos
Reply

2,112 Views
buch2001
Contributor II

I did but nothing changed. 

There seems to be some configuration options, but I don't know which ones....

 

I just add a little information that might be helpful:

Looking at the previous code example (I put numbers), the starting condition is the following:

buch2001_2-1674557185676.png

buch2001_3-1674557224191.png

so putting a brekpoint it enters in the correct branch.

 

Then

 

if I try to change the value of the variable AFTER stopping the code with a breakpoint and advancing step-by-step the software seems to ignore the new value and continues to enter the previous branch:

buch2001_4-1674557628257.png

buch2001_5-1674557641881.png

 

buch2001_0-1674557065148.png

buch2001_6-1674557675881.png

 

0 Kudos
Reply

2,104 Views
danielmartynek
NXP TechSupport
NXP TechSupport

I'm not able to reproduce it.

Does the variable change in the memory view?

Can you read it in the memory before the condition is executed?

Is it a global variable or is it on the stack?

 

 

0 Kudos
Reply

2,100 Views
buch2001
Contributor II

after some analysis it seems to me that it is the adc that stops working. But I really can't understand why

0 Kudos
Reply

2,088 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi Marco,

I'm not sure what you mean, and how it is related to the original issue.

Where are the ADC commands stored?

Do you see any ADC error (ADCEIF)?

 

BR, Daniel

 

0 Kudos
Reply

2,083 Views
buch2001
Contributor II

At the end of my investigation it seems that the whole problem stems from the fact that the Autonomous Periodic Interrupt continues to be active during debugging, triggering its interrupt when time expires and then setting an internal error that resets some variables.
Now we are a bit off topic from the original topic, but is it possible to disable it during debugging?

 

In my debug coonfiguration I've set this option, I hoped was enough

buch2001_0-1674725998335.png

 

0 Kudos
Reply

2,077 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Yes, this disables it during the stepping through the code, but not while you are debugging.

It should be disabled by default though.

Was it enabled in your original configuration?

 

When you let the code run without stepping, doesn't the API overwrite the variables too?

 

You can disable the API interrupt at the first breakpoint by writting to the (CPMUAPICTL_APIE = 0) register via the debugger.

 

0 Kudos
Reply