USBaspLoader locking up

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
alanp
Posts: 6
Joined: Wed May 14, 2008 11:46 pm
Location: Christchurch, NZ

USBaspLoader locking up

Post by alanp » Fri May 30, 2008 11:28 pm

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

alanp
Posts: 6
Joined: Wed May 14, 2008 11:46 pm
Location: Christchurch, NZ

Post by alanp » Thu Jun 05, 2008 10:04 am

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

Post Reply