timer polling

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
amx
Posts: 6
Joined: Fri Jan 04, 2013 2:00 pm

timer polling

Post by amx » Fri Feb 22, 2013 2:16 am

Hello,

as I am having some trouble by (probably) not calling usbPoll often enough (50ms max) I arrived at the following question:
Why is it not possible to call "usbPoll" from within a timer interrupt?

As christian said elsewhere:
"You can't call usbPoll() from a timer interrupt. You must call it from the main code."

Is this because they share some data they both use or are there other reasons?

Thanks!

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

Re: timer polling

Post by ulao » Tue Jun 25, 2013 3:38 pm

I think v-usb just uses the interrupts for timing and the poll depends strictly on the function usbInterruptIsReady.

Code: Select all

while (   !usbInterruptIsReady() ) //when not ready you must poll
{
   usbPoll();
}
//pulling has stopped tiuem to send
usbSetInterrupt( reportBuffer, 8);

Post Reply