Scott Morken wrote:
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
You call your bootloader like a function, so the MCU is not re-initialized: pending interrupts may be fired if ever the booloader call sei(), the stack may be near its end, etc. Why not do your timing loop, but with the watchdog still enabled? That would make the MCU restarts and go to the bootloader if the fuses are set correctly (I'm used to 64/128/1280 pieces, I dunno about the 168 bootloading requirements)

 Bernard


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to