We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I need to write a custom USB controller to communicate with a PC. Over the USB we will perform firmware upgrades, upload new operating parameters, download device performance data, etc. The PC side will use WinUSB mechanism to manage the USB device. I need to implement the USB control using a single interface with 2 bulf transfer endpoints, input and output. Have experimented with the USB CDC device example that came with the Keil toolset. I was thinking of taking that example and modify the descriptors and remove any unneeded logic that implemeted the CDC device and add what I need for my project.
Does this seem like a reasonebly place to start? For example, are the handling of the control endpoint esentially the same regardless of device class type?
So this was the problem on the device side. The host side (being devleoped by a third party and using WinUSB) is having some problems with the 0 length packet. The device appropriately sends this 0 length packet after the 64 byte packet, but the host thinks it got some data associated with the 0 length packet. No data sent is confirmed by a USB sniffer. I beleive the host is just attempting to read whatever next information might aynchronously be sent by the device, and somehow it is interpretting this 0 packet as having data.
"The host side (being devleoped by a third party and using WinUSB) is having some problems with the 0 length packet. The device appropriately sends this 0 length packet after the 64 byte packet, but the host thinks it got some data associated with the 0 length packet."
When the device sends just the size host requested, device doesn't attach zero-length packet (ZLP), even when the size is just the multiple of 64 bytes.
ZLP is attached when, - the host requests more than the size device to send - the device sends just the multiple of 64 bytes.
For WinUsb_ReadPipe, its BufferLength parameter is the size host requests.
I explained it more in details in this post. Termination of transfer www.cygnal.org/.../001627.html
Tsuneo
Thanks for all the valuable information over time.
If I may, I do have a related, more generic question. If a new USB device is being developed what sort of analysis would you suggest as to determine if it should support a standard or custom device class?
In general the types of devices I would deal with would: (1) Generally perform some osrt of control or measurement (1) not clearly fall into a standard device (2) Not data intensive, that is they would not be required to send out large volumes of data with critical timing constraints (3) Need to be able to update the device firmware over USB (4) Need to work with a variety of Window OS's
It sounds like HID can be streteched to fit a wide variety of devices, with the advantage if existing HID drivers for the PC end of things.