Newest AVR-USB code

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Rukus
Rank 1
Rank 1
Posts: 24
Joined: Tue Nov 06, 2007 10:18 am

Newest AVR-USB code

Post by Rukus » Sun Jan 13, 2008 10:05 pm

Christian, I was wondering what is the newest version of the AVR-USB
code and where I can get it?

I'm interested in trying to get it running on a Atmega64 and I'll also be using TWI so I can't use INT0 for the USB as TWI needs those pins.

I've read that you had upgraded the AVR-USB drivers to allow other interupts? I'll be needing to use INT2 for AVR-USB as the pins for INT0 and INT1 are used for the TWI.

Have you had any experience attempting to use a ATMEGA64 with AVR-USB?

Thanks in advance

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

Post by christian » Mon Jan 21, 2008 7:41 pm

The newest version is always available in the PowerSwitch example.

We currently have a thread in this forum where somebody reports problem with using other interrupts than INT0, but many others had success.

Please note that only INT0 has the highest priority. If you use a different interrupt, it would be best if you don't use higher priority interrupts. The driver requires extremely low interrupt latency.

Guest

Post by Guest » Tue Jan 22, 2008 4:01 am

christian wrote:The newest version is always available in the PowerSwitch example.

We currently have a thread in this forum where somebody reports problem with using other interrupts than INT0, but many others had success.

Please note that only INT0 has the highest priority. If you use a different interrupt, it would be best if you don't use higher priority interrupts. The driver requires extremely low interrupt latency.


Thanks Christian.....I think I've made the proper changes to get int2 to work however I'm a bit confused regarding

Code: Select all

#define USB_INTR_CFG_CLR        0 

I'm not sure what this define is intended for?

These are the changes I've made...Does this look functionaly correct...I know you probibly don't recall all of the register names for a ATMEGA64, but does the defines look right or should I be doing something else to get int2 to work?

Code: Select all

/* The following configurations have working defaults in usbdrv.h. You
 * usually don't need to set them explicitly. Only if you want to run
 * the driver on a device which is not yet supported or with a compiler
 * which is not fully supported (such as IAR C) or if you use a differnt
 * interrupt than INT0, you may have to define some of these.
 */
 #define USB_INTR_CFG            EICRA
 #define USB_INTR_CFG_SET        ((1 << ISC20) | (1 << ISC21))
/* #define USB_INTR_CFG_CLR        0 */
 #define USB_INTR_ENABLE         EIMSK
 #define USB_INTR_ENABLE_BIT     INT2
 #define USB_INTR_PENDING        EIFR
 #define USB_INTR_PENDING_BIT    INTF2

#endif /* __usbconfig_h_included__ */

Rukus
Rank 1
Rank 1
Posts: 24
Joined: Tue Nov 06, 2007 10:18 am

Post by Rukus » Tue Jan 22, 2008 4:02 am

sorry the last post was mine....I forgot to login :)

Rukus
Rank 1
Rank 1
Posts: 24
Joined: Tue Nov 06, 2007 10:18 am

Post by Rukus » Tue Jan 22, 2008 4:19 am

woops....I must have a older version of the driver..... it didn't have the

Code: Select all

#define USB_INTR_VECTOR


in the usbconfig.h file.


I'll download the latest and make the changes again :)


Also, I use no other interupts so using int2 should be the highest priority in my case.

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

Post by christian » Tue Jan 22, 2008 12:33 pm

The macro USB_INTR_CFG_CLR is probably never needed. If some bits must be cleared in the interrupt configuration register in order to configure the interrupt correctly, set these bits in this mask.

If you create your own usbconfig.h, please start from usbdrv/usbconfig-prototype.h, not from an example project's usbconfig. Only the prototype file is updated reliably when new features are added.

Post Reply