clocking my usb pulls

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

clocking my usb pulls

Post by ulao » Wed Jun 12, 2013 6:16 pm

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?

horo
Rank 2
Rank 2
Posts: 63
Joined: Tue Mar 04, 2008 2:26 pm
Location: Berlin & Lindau, Germany

Re: clocking my usb pulls

Post by horo » Thu Jun 13, 2013 10:19 am

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

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

Re: clocking my usb pulls

Post by ulao » Thu Jun 13, 2013 1:45 pm

I was looking for a software solution using a watchdog or something.

Post Reply