v-usb + interrupts?
v-usb + interrupts?
Is there a way to use interrupts when using v-usb? For example if I wanted a 1KHz timer. Because right now as soon as I enable some interrupt other than v-usb, USB will stop working.
Re: v-usb + interrupts?
This is possible, however, you need to make sure the USB interrupt is the highest you use. And you need to make sure your other interrupt doesn't take too long (or enable interrupts inside the interrupt routine)
Re: v-usb + interrupts?
Can you give more details on how to achieve this?
My ISR is pretty short, but I would rather let the V-USB ISR interrupt my ISR, just in case. If you can list the most important things/flags/functions to use, I would appreaciate it!
Btw have you used this kind of approach and did it work reliably (i.e. no USB connection interruptions).
Thanks.
My ISR is pretty short, but I would rather let the V-USB ISR interrupt my ISR, just in case. If you can list the most important things/flags/functions to use, I would appreaciate it!
Btw have you used this kind of approach and did it work reliably (i.e. no USB connection interruptions).
Thanks.
Re: v-usb + interrupts?
I've used timer interrupts to control step motors without an issue for the V-USB connection. Without enabling interrupts in the timer.
If you want to enable interrupts inside the interrupt you need to do an "sei();" call inside the interrupt.
If you want to enable interrupts inside the interrupt you need to do an "sei();" call inside the interrupt.
Re: v-usb + interrupts?
"sei();" is simply to enable global interrupt, right? It is already enabled in V-USB. Why do we need to do it again inside interrupt? Thanks.
-Xiangrui
-Xiangrui
Daid wrote:I've used timer interrupts to control step motors without an issue for the V-USB connection. Without enabling interrupts in the timer.
If you want to enable interrupts inside the interrupt you need to do an "sei();" call inside the interrupt.
Re: v-usb + interrupts?
Because entering an interrupt routine disables global interrupts, and exiting the interrupt routine enables them again.