Does usbPoll() get executed before entry to the ISR?
Posted: Tue Jan 14, 2014 2:12 pm
Hi: This is part of the main module running on the device (GNU C):
At device insertion (attachment), after a certain time the device rail voltage stabilizes. Then, two things happen: the device microcontroller is reset and the host (or hub) sends an SE0 to reset the device. The microcontroller, an ATtiny85 from Atmel, uses the ~RESET pin as an output. So, the reset mechanism is internal to the micro. Also, the device is not self-powered, so it uses the USB 5V and a low threshold 3.3V regulator to power the micro. Measuring time from when the USB supply reaches, say, 4.1V, there are two intervals: delta_t1, when the micro exits reset, and delta_t2, when an SE0 occurs on D-, D+ and the micro's INT0 pin is asserted. The interrupt service routine (ISR) in usbdrvasm.S begins execution as soon as sei() (above, code block) is executed. From the USB specification, revision 1.1, September 23, 1998, Figure 7-19, section 7.1.7.1:
My question is: is there enough time for usbPoll() to complete execution for the first time before control goes to the ISR?
Code: Select all
int main(void)
{
DDRB = 0x22; // 0010 0010 PB1=SDA and PB5=SCL are output
PORTB = 0x22; //SDA=SCL=1
usbInit();
sei();
for(;;){ // main event loop
usbPoll();
}
return 0;
}
At device insertion (attachment), after a certain time the device rail voltage stabilizes. Then, two things happen: the device microcontroller is reset and the host (or hub) sends an SE0 to reset the device. The microcontroller, an ATtiny85 from Atmel, uses the ~RESET pin as an output. So, the reset mechanism is internal to the micro. Also, the device is not self-powered, so it uses the USB 5V and a low threshold 3.3V regulator to power the micro. Measuring time from when the USB supply reaches, say, 4.1V, there are two intervals: delta_t1, when the micro exits reset, and delta_t2, when an SE0 occurs on D-, D+ and the micro's INT0 pin is asserted. The interrupt service routine (ISR) in usbdrvasm.S begins execution as soon as sei() (above, code block) is executed. From the USB specification, revision 1.1, September 23, 1998, Figure 7-19, section 7.1.7.1:
My question is: is there enough time for usbPoll() to complete execution for the first time before control goes to the ISR?