V-USB on Pin-Change interrupts

Hello there,

I’m trying to build a device using ATtiny24/44/84 series (experimenting with -84) that uses V-USB software stack.

This particular ATtiny has only 4 pins of PORTB (INT0 port), two of which are taken by XTAL and 1 by ~RESET. That makes it unusable for V-USB purposes.

The documentation mentions, but never explains, the possibility of using V-USB on PCINT ports, I tried that while changing the config section as follows:

#define USB_INTR_CFG            PCMSK0 
#define USB_INTR_CFG_SET        (1 << 1) 
#define USB_INTR_CFG_CLR        0 
#define USB_INTR_ENABLE         GIMSK
#define USB_INTR_ENABLE_BIT     PCIE0
#define USB_INTR_PENDING        GIFR 
#define USB_INTR_PENDING_BIT    PCIF0
#define USB_INTR_VECTOR         SIG_PIN_CHANGE

Yet, I haven’t been able to get the device to be recognized by the OS.

Any ideas?

What’s the hardware setup like on this Tiny84 you’re using? Which pins are connected to D- and D+?

It looks like the config should work, assuming D+ is on PA1 and D- is on another port A pin…

Did you also set the “Hardware Config” lines in usbconfig.h? Things like USB_CFG_IOPORTNAME, DMINUS_BIT, DPLUS_BIT, and so on? The interrupt section tells V-USB how to listen for changes on the USB lines - “Hardware Config” tells it how to effect changes on the USB lines…