tags:

views:

428

answers:

3

Hi,

I am developing CDC driver for USB device and I stumble on some problem. The driver I am using on windows side uses Clear endpoint Feature as some kind of flish mechanism or to get data right. That causes me a lot of trobule because I cant get it working. I think data toggle don't agree and I am missing some important data transfer, even not getting associated interrupt with that endpoing because of bad clear data toggle. I reset data toggle to 0 at set interface and clear feature, as pointed out in USB standard. Is there more situation when I should do this? Or is there easy way of error handling invalid data toggle.

Thanks for anwsering. I have got usb analyzer, but I dosen't do me any good now. From what I can managed to gather and I think is happening. I set datatoggle bit in hardvare after Clear feature (as it should be done) for coresponding endpoint. Send some data, It is recived on PC. I know this form USB analyzer and I traced my Vcom driver with port monitor. Then I wait for some data as everything is configured (device enumerated and so on), the initial question is anwsered but the next one is not, after clear endpoint fature the PC side is asking the question again. This should trigger UBS interrupt for coresponding endpoint but it isint happening, again after some time there is clear endpoint feature and the same package, and it's get responded this time and again there is silence on the comunication protocol. I counted the requested tranfer versus missing interrupts and the ratio is exactly 2:1 so i think data toggling is set wrong by half of the time, but how can this be happening if i set data toggle bit every time I get clear endpoint feature.

I hope I stated the problem clearly, for the harvare side I think the only rvelant thing is the bit I am setting. It states "Write a 1 to this bit to reset the endpoint data toggle to 0." Ok i think(hopefully) I solved the Clear endpoint fature, other errors were caused by other things, and cumulative problem was hard to catch.

+1  A: 

I suggest to use usb snoopy (software usb analyzer) in order to understand what are you doing wrong. If you have any budget you better got hardware usb analyzer such us Lecroy or Ellisys. Or get a commercial CDC driver there is plenty available just google for cdc driver. Your problem description is very general and can be addressed directly.

Ilya
+1  A: 

Be aware that on some versions of usbser.sys, Windows does not correctly flush the pipe after a transfer of an exact multiple of 64 bytes. I'm not exactly clear from your question whether this is the behaviour you are seeing, but a USB analyser should help you determine if this is the case. If you are using XP SP2, upgrade to SP3.

Vicky
Courious but my case was simpler, the fault was clear endpoint fature and lack of handling it, secondly I had problem with task handling inside my USB stack, so strange behavour was seen.
CrazyChris
A: 

Ok I fixed the issue some time ago, now I don't even remeber what was the cause but as ususally is - it was something else. Everyone who tied to anwser thanks.

CrazyChris