Author Topic: Axon constantly resetting when I enable interrupts  (Read 2083 times)

0 Members and 1 Guest are viewing this topic.

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Axon constantly resetting when I enable interrupts
« on: September 02, 2009, 10:28:21 AM »
I was working on interfacing a SmartCard and using interrupts and clock pulses and stuff. Then my Axon started acting all wierd and resetting. After some sleuthing I found the problem to be interrupts.
When I disable interrupts the axon does not reset. However if I don't disable interrupts then it constantly resets. I've commented out uartInit and rprintfInit as well as all the timer stuff, but no matter what I do if I don't put cli() then it will reset.
Any ideas how to fix this problem?

EDIT: Battery is fully charged and I double checked fuse settings - everything checks out.

Take a look this stripped down code:
Code: [Select]
int main(void)
{
int i=0;//useless variable
int j=0;//useless variable


/****************INITIALIZATIONS*******************/
uartInit();  // initialize the UART (serial port)
    uartSetBaudRate(0, 4800); // set UARTE speed, for Bluetooth  before was 115200
    uartSetBaudRate(1, 115200); // set UARTD speed, for USB connection
   uartSetBaudRate(2, 9600);
    uartSetBaudRate(3, 115200); // set UARTJ speed, for Blackfin


rprintfInit(uart1SendByte);// initialize rprintf system and configure uart1 (USB) for rprintf


// initialize the timer system (comment out ones you don't want)
// disable all these !!!
timer0Init();
timer1Init();
// timer2Init();
// timer3Init();
// timer4Init();
//timer5Init();

configure_ports(); // configure which ports are analog, digital, etc.

a2dInit(); // initialize analog to digital converter (ADC)
a2dSetPrescaler(ADC_PRESCALE_DIV32); // configure ADC scaling
a2dSetReference(ADC_REFERENCE_AVCC); // configure ADC reference voltage

LED_on();

rprintf("\r\nSystem Warming Up");

//let system stabelize for X time
for(i=0;i<=16;i++)
{
delay_cycles(5000);
rprintf(".");
}

delay_cycles(6000);

//read each ADC once to get it working accurately
for(i=0;i<16;i++)
{
j=a2dConvert8bit(i);
}
LED_off();
/**************************************************/

rprintf("Initialization Complete \r\n");
cli();   // disable interrupts.  if this is commented out then the Axon resets
while(!button_pressed()); //wait until user pushes button


while(1) {
control();
delay_cycles(100);
}

return 0;
}

« Last Edit: September 02, 2009, 10:41:47 AM by airman00 »
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

paulstreats

  • Guest
Re: Axon constantly resetting when I enable interrupts
« Reply #1 on: September 02, 2009, 04:25:07 PM »
does it have any kind of watchdog timer that needs resetting regularly?

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Axon constantly resetting when I enable interrupts
« Reply #2 on: September 02, 2009, 04:44:52 PM »
does it have any kind of watchdog timer that needs resetting regularly?
no, and anyways a watchdog timer would be a fuse, with no relationship to any interrupts. ( i think)
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Axon constantly resetting when I enable interrupts
« Reply #3 on: September 02, 2009, 06:10:07 PM »
I think something is causing an interrupt but no ISR has been set up so it jumps to location 0 and reboots.

If your cut down code still gives the issue then try commenting out the stuff that will create interrupts but isn't used - ie the timers, uarts etc

rprintf can also do this if rprintfInit hasn't been called before its first used. So you can always write a dummy routine the just throws away the output ie

void chuck(char c){
}

and then rprintfInit(&chuck) at the top of your program. That will let you get rid of all the uart stuff as well.

Keep stripping until the problem goes.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline airman00Topic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Axon constantly resetting when I enable interrupts
« Reply #4 on: September 03, 2009, 09:21:45 AM »
Yea its definitely not a hardware issue, as I tested it with another program and hte Axon was fine.

I redid the code using the latest Axon source code and it works now.

@Webbbot
I'll try stripping it down as well because I'm curious to know what caused the reset.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

 


Get Your Ad Here

data_list