Did you check that your treatment is not too long and that you do not
have a problem with nested interrupt ?
How is your interrupt treatment ?
Is it possible to set the timer frequency differently to avoid the "mod3
% 40" test ?
Eric Pasquier
----- Original Message ----- From: "Scott Morken" <address@hidden>
To: <address@hidden>
Sent: Friday, December 14, 2007 9:26 AM
Subject: [avr-gcc-list] Bootloader question
Hi
I have an application that jumps to the bootloader using this function
(it's a slightly modified avr109 bootloader made by atmel):
void (*funcptr)( void ) = (void *)0x3800; // Set up function pointer to
the bootloader start.
I call it when a command is sent over the serial port, making this code
run:
UART_SendByte('B');
wdt_disable();//disable watchdog
cli();//disable all interrupts
for(counter = 0; counter<20000; counter ++)
{
asm("NOP");
}
funcptr();//goto bootloader
It has been working great until some code was added to my application.
Now it will not enter the bootloader properly when I send the command.
I suspect the chip is crashing before it gets to the funcptr(); line. I
have narrowed down the code to about 10 lines in a timer overflow
interrupt, when I comment it out it works fine. Here are the suspect
lines. All of the arrays are floats and the capital letter variables are
integers:
if ((mod3 % 40) == 0) //we are here 25x per second, for 25Hz
sampling rate filter code
{
//1st order, 7Hz -3dB lowpass, 25Hz sampling filter
xv4[0] = xv4[1];
xv4[1] = (float)GEN_V_DIV_ADC / 1.827271946;
yv4[0] = yv4[1];
yv4[1] = (xv4[0] + xv4[1]) + (-0.0945278312 * yv4[0]);
GEN_V_DIV_ADC_FILTERED = yv4[1];
//1st order, 3Hz -3dB lowpass, 25Hz sampling filter
xv5[0] = xv5[1];
xv5[1] = (float)SUPERCAP_DIV_ADC / 3.525711689;
yv5[0] = yv5[1];
yv5[1] = (xv5[0] + xv5[1]) + (0.4327386423 * yv5[0]);
SUPERCAP_DIV_ADC_FILTERED = yv5[1];
}
Does anyone know of a reason why it would crash?
Scott
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list