Winavr 3.4.1 AVR studio 4.1
I have a new program that keeps resetting. Also the timer interrupts
keeps firing too quick once I turn on the interrupts with sei. I have to
keep clicking through it and after maybe 10 times I get to step through
a single line of non timer0 interrupt code. The only difference is this
program and the other one I have no problem debugging is the board I
will run it on has a 32K external crystal clock and so I was using that
as my source code
Here is the code from the problem program for initializing the timer
/*
* Initialize timers - init timer 0 to use the real time clock crystal
* connected to TOSC1 and TOSC2. Use this timer as a 1 ms thread
* scheduling timer.
*/
void init_timers(void)
{
/*
* Initialize timer0 to use the 32.768 kHz real-time clock crystal
* attached to TOSC1 & 2. Enable output compare interrupt and set
* the output compare register to 32 which will cause an interrupt
* to be generated every 0.9765625 milliseconds - close enough to a
* millisecond.
*/
TIFR |= BV(OCIE0);
TIMSK |= BV(OCIE0); /* enable output compare interrupt */
ASSR |= BV(AS0); /* use asynchronous clock source */
TCNT0 = 0;
OCR0 = MS_OCRMATCH; /* non debug use 32 match in 0.9765625 ms */
TCCR0 = BV(WGM01) | BV(CS00); /* CTC, no prescale */
while (ASSR & 0x07)
;
}
The only differences are the ASSR |= BV(AS0); and then while (ASSR &
0x07) and I define MS_OCRMATCH to be 125 in the other program.
Am I doing something wrong?Message
Problem with AVR studio debugger reseting
2005-04-10 by wbounce
Attachments
- No local attachments were found for this message.