I'm trying to compile USBaspLoader for the ATmega128.
I have got the powerswitch running without any problems so the hardware side of things should be good.
I have slightly modified the main() code to find out what's going on. I have 8 LEDs on PORTA.
Code: Select all
int main(void)
{
DDRA = 0xFF;
/* initialize */
bootLoaderInit();
odDebugInit();
DBG1(0x00, 0, 0);
#ifndef NO_FLASH_WRITE
GICR = (1 << IVCE); /* enable change of interrupt vectors */
GICR = (1 << IVSEL); /* move interrupts to boot flash section */
#endif
if(bootLoaderCondition()){
PORTA = 0x01;
uint i = 0;
initForUsbConnectivity();
do{
usbPoll();
#if BOOTLOADER_CAN_EXIT
if(requestBootLoaderExit){
if(--i == 0)
break;
}
#endif
PORTA++;
}while(bootLoaderCondition()); /* main event loop */
}
PORTA = 0x04;
leaveBootloader();
return 0;
}
BOOTLOADER_CAN_EXIT is set to 0.
The LEDs start counting/flashing to start with as one would expect in the usbPoll loop but then stop on a random number. To me this looks like something in the usbPoll locking up.
Could anybody shed some light on this or offer any advice in where to look further??
Thanks
Alan