Never hits the interrupt
Posted: Fri Dec 27, 2013 1:16 am
Hi,
I'm running the code on an AT90USB1287 ... *not* using the hardware USB, running v-usb to see how it works out. Everything looks right level wise, other code on the system runs fine, my i2c buss is doing its thing, lights lighting etc etc. I can see the 1.5K get pulled high when I call usbConnect(); and I can see my Linux box try and talk to the system, but never enumerates ... and setting a breakpoint on usbProcessRx(){...} never hits. I thought it might just be a funny with the JTAG debugger, so it set it to light an LED if the routine ever gets called ... it never does. So, it looks like the ISR is never calling home for some reason.
I thought it might be becuase I am using non-standard pins and interrupts.
Because im using i2c, port D pins 0,1 are in already in use, so INT0 and INT1 are not available either.
I'm running USB into PORTD 2 and 3, D+ on 2, D- on 3, PORTD 2 is INT2. Im unsing PORTC 0 as my pullup via 1.5K
Maybe I missed somethign obvious in the config? I can see the global interrupt get enabled, so im wonderign if maybe INT0 got hardwired somewhere in the assy?? Maybe someone can spot somethign obvious I missed?
Any clues gratefully received.
My usb config includes:
#define USB_CFG_CLOCK_KHZ 12000
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 3
#define USB_CFG_DPLUS_BIT 2
#define USB_CFG_PULLUP_IOPORTNAME C
#define USB_CFG_PULLUP_BIT 0
// #define USB_INTR_CFG MCUCR
// #define USB_INTR_CFG_SET ((1 << ISC01) | (1 << ISC01))
// #define USB_INTR_CFG_CLR 0
/* #define USB_INTR_ENABLE GIMSK */
#define USB_INTR_ENABLE_BIT INT2
/* #define USB_INTR_PENDING GIFR */
#define USB_INTR_PENDING_BIT INTF2
#define USB_INTR_VECTOR INT2_vect
my hardware init is :
static void initHardware(void)
{
DDRC = 1;
PORTC = 0x00;
/*
unsure why this isn't handled in usbInit(), but anyway, set it up here
*/
DDRD = 0xF0; /* 1111 0000 bin */
PORTD = 0x00; /* 0000 0000 bin */
}
and ... in main.c
initHardware();
usbDeviceDisconnect();
_delay_ms(250.0);
usbDeviceConnect();
usbInit();
sei();
for(;;){ /* main event loop */
wdt_reset();
usbPoll();
}
I'm running the code on an AT90USB1287 ... *not* using the hardware USB, running v-usb to see how it works out. Everything looks right level wise, other code on the system runs fine, my i2c buss is doing its thing, lights lighting etc etc. I can see the 1.5K get pulled high when I call usbConnect(); and I can see my Linux box try and talk to the system, but never enumerates ... and setting a breakpoint on usbProcessRx(){...} never hits. I thought it might just be a funny with the JTAG debugger, so it set it to light an LED if the routine ever gets called ... it never does. So, it looks like the ISR is never calling home for some reason.
I thought it might be becuase I am using non-standard pins and interrupts.
Because im using i2c, port D pins 0,1 are in already in use, so INT0 and INT1 are not available either.
I'm running USB into PORTD 2 and 3, D+ on 2, D- on 3, PORTD 2 is INT2. Im unsing PORTC 0 as my pullup via 1.5K
Maybe I missed somethign obvious in the config? I can see the global interrupt get enabled, so im wonderign if maybe INT0 got hardwired somewhere in the assy?? Maybe someone can spot somethign obvious I missed?
Any clues gratefully received.
My usb config includes:
#define USB_CFG_CLOCK_KHZ 12000
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 3
#define USB_CFG_DPLUS_BIT 2
#define USB_CFG_PULLUP_IOPORTNAME C
#define USB_CFG_PULLUP_BIT 0
// #define USB_INTR_CFG MCUCR
// #define USB_INTR_CFG_SET ((1 << ISC01) | (1 << ISC01))
// #define USB_INTR_CFG_CLR 0
/* #define USB_INTR_ENABLE GIMSK */
#define USB_INTR_ENABLE_BIT INT2
/* #define USB_INTR_PENDING GIFR */
#define USB_INTR_PENDING_BIT INTF2
#define USB_INTR_VECTOR INT2_vect
my hardware init is :
static void initHardware(void)
{
DDRC = 1;
PORTC = 0x00;
/*
unsure why this isn't handled in usbInit(), but anyway, set it up here
*/
DDRD = 0xF0; /* 1111 0000 bin */
PORTD = 0x00; /* 0000 0000 bin */
}
and ... in main.c
initHardware();
usbDeviceDisconnect();
_delay_ms(250.0);
usbDeviceConnect();
usbInit();
sei();
for(;;){ /* main event loop */
wdt_reset();
usbPoll();
}