AVR-USB on ATmega128

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

AVR-USB on ATmega128

Post by alanp » Thu May 15, 2008 12:01 am

Hi Guys,

New to the forum and new to AVRs, but have programmed other microcontrollers.

I'm just laying out a board with an ATmega128 on it. I have a question about the interrupts that are used with AVR-USB.

On the ATmega128 there are 8 interrupts, INT0-3 are asynchronous, INT4-7 are synchronous. With the latest AVR-USB software you can change which interrupt is used. I understand that the interrupt used for the USB must be the highest priority, but does the interrupt need to be one of INT0-3 or can I used INT4-7???

I'm guessing this might change with clock frequency?

Thanks in advance.

Alan

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

Post by christian » Thu May 15, 2008 2:59 pm

It depends on whether you implement USB suspend or not. If you implement suspend, you need to wake up your CPU from sleep mode with the interrupt. This works only with INT0 - 3. Otherwise the additional synchronization with the I/O clock should not matter.

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

Post by alanp » Fri May 30, 2008 4:42 am

Just an update.

AVR-USB will work with INT4-7. My setup for INT5 is:

Code: Select all

#define USB_INTR_CFG            EICRB
#define USB_INTR_CFG_SET        ((1 << ISC50) | (1 << ISC51))
#define USB_INTR_CFG_CLR        0
#define USB_INTR_ENABLE         EIMSK
#define USB_INTR_ENABLE_BIT     INT5
#define USB_INTR_PENDING        EIFR
#define USB_INTR_PENDING_BIT    INTF5
#define USB_INTR_VECTOR         SIG_INTERRUPT5

It worked with no problems at all.

Post Reply