Page 1 of 1

USBaspLoader locking up

Posted: Fri May 30, 2008 11:28 pm
by alanp
Hi Guys,

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

Posted: Thu Jun 05, 2008 10:04 am
by alanp
I'm making some progress.

The original problem was that the bootloader was being put at the wrong memory address. I had it at 0x9000, but this is the address in words. The correct address is 0x1E000 bytes.

So now I know it's at the correct memory location and it seems to run, but no USB devices are seen on the PC.

I have found a german newsgroup which talks about using USBaspLoader with the ATmega128. http://www.mikrocontroller.net/topic/100710

At the bottom it is talked about changing pgm_read_byte with pgm_read_byte_far because the program is in the upper 64kbytes. However I could not get this to work.

Has anyone got USBaspLoader working in the large memery size parts? Could anyone give me some tips?

Thanks

Alan