go_away

Author Topic: Recieving "calledbadISR" on Axon (not using interrupt atm)  (Read 1402 times)

0 Members and 1 Guest are viewing this topic.

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Recieving "calledbadISR" on Axon (not using interrupt atm)
« on: February 03, 2009, 04:58:36 AM »
Im having some problems with my code, im getting wierd errors in my Stuck-function. The axon prints out this over hyperterminal (together with the other rprintf stuff), and after a while the axon resets. What could be the problem?

badISR calledbadISR calledbadISR calledbadISR calledbadISR calledbadISR call

Code: [Select]
int SimpleForward(void)
{
int Front = sharp_IR_interpret_GP2Y0A02YK(a2dConvert8bit(0));;
int Left = sharp_IR_interpret_GP2Y0A02YK(a2dConvert8bit(5));;
int Right = sharp_IR_interpret_GP2Y0A02YK(a2dConvert8bit(10));;

delay_ms(50);
if (stuckcheck==50)
{
rprintf("\r\n*********************StuckCheck*********************");
delay_ms(500);
Stuck(Front, Left, Right);
stuckcheck=0;
}
stuckcheck=stuckcheck+1;
        }


int Stuck(int Front, int Left, int Right)
{

if (OldLeft>=0.95*Left && OldLeft<=1.05*Left && Left!=0 && Left>!1500)
{
GoBack(1950);

printf("\r\nLeft stuck, OldLeft=%d, Left = %d", OldLeft, Left);
return 0;
}
if (OldRight>=0.95*Right && OldRight<=1.05*Right && Right!=0 && Right>!1500)
{
GoBack(1200);
rprintf("\r\nRight stuck, OldRight=%d, Right = %d", OldRight, Right);
}
return 0;
}
if (OldFront>=0.95*Front && OldFront<=1.05*Front && Front!=0 && Front>!1500)
{
GoBack(1650);
rprintf("\r\nFront stuck, OldFront=%d, Front = %d", OldFront, Front);
return 0;
}
rprintf("\r\nFront not stuck, OldFront=%d, Front = %d", OldFront, Front);
rprintf("\r\nLeft not stuck, OldLeft=%d, Left = %d", OldLeft, Left);
rprintf("\r\nRight not stuck, OldRight=%d, Right = %d", OldRight, Right);
OldFront=Front;
OldLeft=Left;
OldRight=Right;
return 0;
}


My code runs just fine if I remove the stuck stuff.... Can anyone see something wrong in my code? A simple search on google for calledbadISR returns nothing :P

Oh, and btw, the simpleforward function is inside a while(1) loop.

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Recieving "calledbadISR" on Axon (not using interrupt atm)
« Reply #1 on: February 03, 2009, 06:59:40 AM »
Seems like the solution was to not use as many functions as I were. I were calling control function from axon.c, then within control calling another function, which was calling the SimpleForward function. And it was looping from the axon.c function. Now Im calling just simpleforward from axon.c, and I also got a while(1) inside the simpleforward function... Weird error though...

edit: sheesh, Im recieving tons and tons of errors now, for some f****d up reason. The C is all of the sudden resetting on something that has worked in ages. And it sends so much data to my computer that the computer gets BSOD over and over again (everytime I have terminal on for more than 5 seconds).
« Last Edit: February 03, 2009, 08:05:23 AM by Tomas »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,680
  • Helpful? 172
    • Society of Robots
Re: Recieving "calledbadISR" on Axon (not using interrupt atm)
« Reply #2 on: February 04, 2009, 04:53:15 AM »
Quote
badISR calledbadISR calledbadISR calledbadISR calledbadISR calledbadISR call
wow . . . I haven't a clue on how that error would actually even get transmitted via rprintf!!


Quote
The C is all of the sudden resetting on something that has worked in ages.
check the battery just in case . . .


What I recommend doing is put in random rprintf("testA"); mixed in your code. For example:

Code: [Select]
do_stuff(1);
rprintf("testA");
do_stuff(2);
rprintf("testB");
do_stuff(3);
rprintf("testC");

If you see 'testAtestB' in hyperterminal but not 'testC', you'll know that do_stuff(3) is the cause of your problems.


Also, I don't quite understand the point of 'if (stuckcheck==50)' because your code doesn't do anything if it doesn't equal 50 . . .

Offline TomasTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 0
Re: Recieving "calledbadISR" on Axon (not using interrupt atm)
« Reply #3 on: February 04, 2009, 08:49:39 AM »
Yeah, I only included the part that crashed the axon (kinda much code overall, not worth posting it all just yet).

The stuck function is supposed to run every 50x50ms, so around once 2,5 second. The function just mainly checks if three sharp ir sensors are showing the same numbers as they were last time the function ran. If they are, they are indicating that the robot has stalled, and it should therefore go another way.

Anyway, I tested the axon on another computer now, and it worked fine (with just a simple test-code). So I guess its the code or the computer making the problems. Im just relieved that its not the axon that is broken, hehe.

 


Get Your Ad Here