Code get reset when i tried to run small application please help me to solve this issue - MC9S08AC128

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

Code get reset when i tried to run small application please help me to solve this issue - MC9S08AC128

2,180 Views
sbharsha
Contributor I
Dear All,
 
I am using the MC9S08AC128 Simulator. I am using the Special edition Code warrior
 
I have created a project with IEEE32 Floating support enabled.
 
I have small piece of code which will calculate the distunce between two coardinates of the Earth.
 
I am using library functions like sinf, cosf, atan2f.
 
 ..............
................. some Declarations here all are float values
.................... 
line1.   sin2lat = sinf(Dlat2Rad/2);
  ....................
 
line2.  sin2lng = sinf(DLng2Rad/2);
  ......................................
 
line3.  a = sin2lat + cosf(Lat1Rad) * cosf(Lat2Rad) * sin2lng;
 
A_sqrt = sqrtf(a);
 
  A_sqrt1 = sqrtf(1-a);
............................................ Till here it works fine .
 
c = 2 * atan2f(A_sqrt,A_sqrt1); When i press f9 here it resets the CPU andgoes to 0x000 PC..

Here i noticed that i can call only four library functions ex. sinf,cosf ......which i have done in code...
 
 
If i Remove any 2 calls of library function() (Remove line1 & line2 ) then my code will work fine(i am able to call atan2f and CPU doesn't reset executes normally ).... I don't understand what might be the probelm ...........
 
please anybody can give some suggestions....
 
Warm Regards,
Harsha S
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-12-17 07:48 AM
Labels (1)
0 Kudos
8 Replies

641 Views
J2MEJediMaster
Specialist I
Sounds like the stack is overflowing.

---Tom

0 Kudos

641 Views
sbharsha
Contributor I
Hi,
 
I cross checked the stack. stack is not over flowing..
 
I allocated stack to 1.7KB And checkd the Stack memory for any over flow.
 
But Max stack used is around 100 bytes..
 
Its not a stack problem .......
 
any other guesses please ...
 
 
Harsha S
0 Kudos

641 Views
kef
Specialist I
Is COP reset enabled? If yes, then could it timeout?
 
Could you somehow read contents of SRS after reset? Enetering BDM mode can alter SRS, so maybe send SRS over SCI, show it on MCU pins. Or just copy to not used RAM locations, then read copy in RAM via BDM.
0 Kudos

641 Views
sbharsha
Contributor I
Hi,
 
Iam getting message "COP watchdog caoused Reset".
 
Just attached the screen shot of the reset mode.
 
I have checked the SRS its COP reset bit is enable SRS = 0x20.
 
whats the necessary steps needs to be taken.
 
Please suggest me.
 
Harsha S
 
Message Edited by t.dowe on 2009-10-27 11:57 AM
0 Kudos

641 Views
peg
Senior Contributor IV
Hi,

Strange how you failed to mention this (the COP reset) in your previous two posts.
I'm no expert on the AC, but...

To prevent it, either:
1. Extend the COP reset time.
2. Reset it before the time expires.
3. Disable it altogether.

and above all else, RTFM!

0 Kudos

641 Views
sbharsha
Contributor I
Hi,
 
>>Strange how you failed to mention this (the COP reset) in your previous two posts.
>>I'm no expert on the AC, but...
 
Sorry about that i couldn't notince that earlier as you mentionsomethng about SRS a hat time i could able to check out properly ...

>>To prevent it, either:
>>1. Extend the COP reset time.
Could you mentioen where/how i can do it ?

>>2. Reset it before the time expires.
Thats fine...

>>3. Disable it altogether.
Thats right  ......... Mean tme i tried dissabling it It worked for me
 

>>and above all else, RTFM
RTFM ?
 
 
Harsha S
0 Kudos

641 Views
peg
Senior Contributor IV
Hi again,

sbharsha wrote:
Hi,
 
>>Strange how you failed to mention this (the COP reset) in your previous two posts.
>>I'm no expert on the AC, but...
 
Sorry about that i couldn't notince that earlier as you mentionsomethng about SRS a hat time i could able to check out properly ...

>>To prevent it, either:
>>1. Extend the COP reset time.
Could you mentioen where/how i can do it ?

>>2. Reset it before the time expires.
Thats fine...

>>3. Disable it altogether.
Thats right  ......... Mean tme i tried dissabling it It worked for me
 

>>and above all else, RTFM
RTFM ?
 
 
Harsha S


RTFM loosely translates to "read the manual"

This is how you will discover the answer to your question at my point one.
look for COPCLKS in SOPT2 and COPT in SOPT.

0 Kudos

641 Views
sbharsha
Contributor I
Hi,
 
Thanks buddy .....  I hope my issue is resolved fully ...
Thanks or your valuable suggestions..
 
Harsha S
0 Kudos