avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Bootloader question


From: Scott Morken
Subject: [avr-gcc-list] Bootloader question
Date: Fri, 14 Dec 2007 00:26:41 -0800
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]