I'm trying to trouble shoot a USB protocol at signal level and I'm pretty new to how that works for USB. I have more then my head full of docs about the software implementation. I really need to bounce a few question at the hardware level.
Found this very helpful, would like anything more on this point.
I'm working with a firmware only (bit banging) USB driver (vusb). I'm not sure if my issue is bug related or normal. Either way I hope to improve it.
This comical screen cap is from my analyzer (see first attached image). It seems to me it is having issues syncing. I know in the case of USB 1.1 a keep alive signal needs to run at least 1 ms apart. Also the host fires off polls every 8 ms (as measured). In my USB driver I can tie to this poll for synchronization if needed. In c#, forget about it.... You will not be able to get any precise timing out of that.
What I'm trying to do here is send a control transfer (feature report) from my device to my host (get) every 16 ms or less. So I try to time it just after the host received the USB poll. Well that is about as loose as a dunk h00ker. To make things worse my controller transfers are taking very long. As you can see by the first image it is trying to sync to something?
So my first question is, what is it syncing to? What do I need to do to help it sync.
My second question is what is it the control transfer doing to my device? See my second image.
The second image shows the two conditions I have. I have some ASM code that is very sensitive. I used to just block the USB interrupt and let it do its thing and start the interrupt back up. Well this was upsetting my control transfers causing no ACK in my status stage. So I removed that trick and tied it to a USB poll so that I had 1ms of play. This worked great, but now the control transfer is some how stepping on it. When it does the ASM is some how disturbed. Why would the control transfer interfere with my ASM code? The ASM code is very sensitive, if Is off 100ns its going to fail on my 12mhz crystal. Timing is very tight. I'm thinking of setting a flag in my usbSetupFunction to inform the sensitive ASM code that a control transfer ran. In this case reject the results. This just seem very patch-like, I'd prefer to understand what is going on. If the control transfer succeeded to the data stage I could almost get what that woudl be a problem. Because at that point it sends data to the device and the ASM certainly can not run during that. Though, I see this syncing non-sense cause my issue. If the control transfer would just get the job done, things would be a lot better.