Using Pin change interrupt instead of INT0

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Posts: 4
Joined: Sun Aug 13, 2017 5:28 am

Using Pin change interrupt instead of INT0

Post by NewbeeV-USB » Tue Oct 03, 2017 12:14 pm

Can I use pin change interrupt available in ATmega328p to connect to vusb instead of INT0 to connect to D+.

Rank 2
Rank 2
Posts: 63
Joined: Tue Mar 04, 2008 2:26 pm
Location: Berlin & Lindau, Germany

Re: Using Pin change interrupt instead of INT0

Post by horo » Tue Oct 03, 2017 8:40 pm

Yes, you can do so. I did it for an ATtiny85, have a look at my project here in the forum.
You have to define it in the file usbconfig.h

Code: Select all

/* ----------------------- Optional MCU Description ------------------------ */

/* 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            PCMSK
#define USB_INTR_CFG_SET        (1 << USB_CFG_DPLUS_BIT)
#define USB_INTR_CFG_CLR        0
#define USB_INTR_ENABLE         GIMSK
#define USB_INTR_PENDING        GIFR
#define USB_INTR_VECTOR         PCINT0_vect

Ciao, Martin

Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

Re: Using Pin change interrupt instead of INT0

Post by ulao » Sun Oct 08, 2017 7:10 pm

I find this rather interesting, could anyone explain the advantages/disadvantages or reason for wanting to do so? I'm thinking it would allow the device to sync to the usb poll better but not sure I follow the intention.

Post Reply