USB Bulk Reads via Cypress EZ-USB FX2

Hi Guys,

I have attempted to perform a USB Bulk read transfer over an EZ-USB FX2 development board. Vendor requests work fine, but using the usb_bulk_read() functions returns the following error message:

"usb_submit_async: submitting request failed, win error: The parameter is incorrect"

So far, we have established that the problem is on the peripheral (8051 FX2) side, and *not* on the host side.

Could anyone give me some advice as how to modify my firmware code, or at least help me find out what is going on?

Thank you, Gavin Brewer

Reply to
Gavin Brewer
Loading thread data ...

How have you established that?

What parameters do you use to call the driver function?

Reply to

We tested a different device with it's own firmware. The program used to load the .HEX file into the device memory, (r)enumerate USB devices and issue vendor requests etc was still the same.

This setup worked fine and so therefore the problem was not with the host end of things.

Well, here's the function call:

r = usb_bulk_read(hCurrent_reader, 0x86, buffer, USB2_BUFFER_SIZE, 1000); if (r != USB2_BUFFER_SIZE){ printf("Bulk Read failed (%d).\n",r); printf("%s\n",usb_strerror()); } else { printf("Bulk read success\n"); }

You may almost certainly require more specific information; if this is so then please ask.

Thank you, Gavin Brewer.

Reply to
Gavin Brewer

I use IOCTL_EZUSB_BULK_READ instead of usb_bulk_read(), but I suppose the functionality is similar. There are two ways the read can fail:

A) If you supply a buffer that is smaller than the amount of data that is in the active FX2 FIFO, the read will fail with an error. I don't know the usb_bulk_read() function, but maybe it returns a negative value in this case. Check the docs.

B) If the FX2 has less data in the active FIFO than the size of your buffer, the read will complete but return only the number of bytes actually read. In this case the read has not completely failed, but your code will claim so.

Hope this helps, Marc

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.