AVR-USB and atmega88

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
John

AVR-USB and atmega88

Post by John » Tue Oct 02, 2007 6:52 am

hey guys, just need a bit of a hand getting the powerswitch project working on an atmega88 chip. i only needed to modify a small amount of the code in order to get it to compile since the registers are a little different from the 90s2313 --

Code: Select all

static void eepromWrite(unsigned char addr, unsigned char val)
{
    while(EECR & (1 << EEPE));
    EEARL = addr;
    EEDR = val;
    cli();
    EECR |= 1 << EEMPE;
    EECR |= 1 << EEPE;  /* must follow within a couple of cycles -- therefore cli() */
    sei();
}

static uchar    eepromRead(uchar addr)
{
    while(EECR & (1 << EEPE));
    EEARL = addr;
    EECR |= 1 << EERE;
    return EEDR;
}


the settings in usbconfig.h seemed to be ok, nothing needed to be modified. however, two lines also needed to be commented out in order to compile, as it couldn't find their definition (usbdrv.c):

Code: Select all

GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18)
GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport)

the assembly source file i'm using is usbdrvasm.S.

anyway for some reason, having done all that, it just says 'device malfunctioned, or cannot be recognised' when connected to a windows pc.
am i missing something?

thanks for your help.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Tue Oct 02, 2007 12:11 pm

You should not need to modify usbdrv.c. The macros you mentioned should expand to no-ops unless you have configured a HID device.

When you use the Mega88, please make sure that your fuse settings are correct. You must ensure that the processor runs on external crystal clock. And you may have to change the I/O pins in usbconfig.h. Please make sure that you also change all direct references to the USB I/O pins in main.c and that you don't have a conflict between the relay I/Os and the USB pins.

Post Reply