View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
dsPIC30F5015 in debug mode |
Posted: Wed Dec 09, 2015 4:13 am |
|
|
Greetings! I'm using MPLab v8.91, CCS v5.025 and dsPIC30F5015. When I'm using the motor control unit and I'm experiencing a small problem - the debugger doesn't show the current state of PORTE. For example if I set the PCDs to 500 (pwm 2500) and I have this code:
Code: |
if(PORTE!=0)
{
delay_us(1);
}
|
When I set a breakpoint to the delay it triggers but in the view window PORTE is 0! I test on a pcb and I have proper pwm on the outputs! Why I don't see the changes in the debug mode ? I tested when the debugger is freezing all the peripherals and when it doesn't - no change!
Is this a bug or I'm doing something wrong ?
Thanks! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Wed Dec 09, 2015 4:49 am |
|
|
Show us your definition of 'PORTE'. |
|
|
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Dec 09, 2015 5:06 am |
|
|
Also, the debugger is not a hardware debugger, it's a software monitor. The peripherals are not "frozen" at a breakpoint, they stay running.
The values for peripherals, including timers/counters, shown while debugging are a snap shot of their values at the time the debugger code read them, which is quite a long time after the breakpoint happened. This means the value you see may not be consistent with the value at the breakpoint. |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Sat Dec 12, 2015 12:08 pm |
|
|
Code: |
#word PORTE = getenv("SFR:PORTE")
|
This is bad! How can I be sure everything is configurated correctly. I can see the output pulse, but this is not the whole thing. I need to have correct update time, correct errors check and so on... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Sat Dec 12, 2015 12:25 pm |
|
|
This is the 'snare' of the ICD. In the past you used to get genuine hardware ICE units, which actually could snapshot the memory, and ports at specific points. Unfortunately the ICD can't do this.
The way you can record things is to do it yourself. In your code, at the point where you read the port to test something, write the value read, into an array. You can then stop, and look at the array, and see what the code actually 'saw' at this instant.... |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Sun Dec 13, 2015 10:37 am |
|
|
You mean I have to read the value of the register before the breakpoint occurs?! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Sun Dec 13, 2015 11:46 am |
|
|
You read the port at the point in the code where you want to know what the code is seeing.
You can break at any point you want after this, and look at the value that was read. |
|
|
|