Page 1 of 1

clocking my usb pulls

Posted: Wed Jun 12, 2013 6:16 pm
by ulao
I gather pulls are 10ms apart. Some say they clocked it at 8 on a windows box, and some say 2 on a linux box. What I want to do is see how long my code takes and determine if I'm skipping pulls.

I would like to do one of the following.
a)
pull once ever 10ms ( lets say it take 10 ms )
do code ( how long did this take? )
pull

B)
pull once ever 10ms ( lets say it take 10 ms )
do code
pull ( was data ready? if not run debug code )

I need to ensure my code has completed before a pull. I'm guessing this is the only way to check that. Anyone have some advice on how to do this. I use avr studio maybe there is a built in simulator to clock this?

Re: clocking my usb pulls

Posted: Thu Jun 13, 2013 10:19 am
by horo
Hi ulao,

My typical solution is to use an normally unused port pin that will be set on start of code and reset after completion. With an oscilloscope you can watch this port and e.g. the usb ports.
-> http://forums.obdev.at/viewtopic.php?f=8&t=1352&start=15#p9040

Ciao, Martin

Re: clocking my usb pulls

Posted: Thu Jun 13, 2013 1:45 pm
by ulao
I was looking for a software solution using a watchdog or something.