Offline V-USB data processing

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
cpldcpu
Rank 2
Rank 2
Posts: 44
Joined: Sun Nov 10, 2013 11:26 am

Offline V-USB data processing

Post by cpldcpu » Wed Jan 29, 2014 9:39 am

A lot of the complexity of V-USB comes from the requirement to do de-stuffing and xoring of the USB datalines in real time. I have been wondering - is this really necessary?
V-USB does not process most of the packet contents in realtime, so why not move some more processing off-line? Basically only the PID, address and endpoint number is used in the interrupt routine.

- The PID is never bit-stuffed due to it's encoding
- The address may see one stuffed bit, but it is 7 bit only, so it will only expand to 8 bits in the worst case. The correct addressee can still be identified by a simple byte comparison.
- The endpoint number may be shifted by one bit.

That means, that if we are limiting ourselves to a single endpoint, it is easily possible to perform all the necessary "link-layer" data processing on xored and bitstuffed data.
This would allow reducing the receiver routine to a simple loop and would also enable 8 MHz V-USB.

Any thoughts?

Post Reply