PORTS Forum

Ports and Interfaces => USB => Topic started by: davebv on April 13, 2011, 09:19:05 am

Title: Bulk data transfers with WinUSB and winusb_cs example
Post by: davebv on April 13, 2011, 09:19:05 am
Hello to everybody,
This is my first post and I just starting to learn about USB.
What I am trying to do is using the winusb example with http://www.lvr.com/winusb.htm with my own firmware with a freescale jm60 microcontroller.
I have made a custom class with 3 endpoints (enpnt0 +  2 bulk endpoints, one in and the other out)
So far, the control transfer read and write works as expected (or so I think). I see the sent and received data in my callbacks.

The problem comes when I use the bulk test. First time I press the "Send" button in the Bulk transfer box, it sends the text I write in the textbox, then my microcontroller sends it back the same text so I can read it in the log box of the winusb_cs application. So far so good.

But when I try to repeat the operation, some kind of error happens (I do not know if it is due to time out, the misconfiguration of the endpoints...) but it throws an exception, somewhere around GetReceivedBulkData.
I notice in this case, the microcontroller does not even executes the bulk transfer received callback.

May you give me some hints about what I am missing?
Is it necessary to perform some action on the endpoint after receiving the bulk transfer? such us setting it up to stalled or idle...

Thank you for your help.
Title: Re: Bulk data transfers with WinUSB and winusb_cs example
Post by: Jan Axelson on April 14, 2011, 10:39:25 am
How to manage endpoints varies with the hardware. After retrieving received data, the endpoint needs to be set to ACK the next received packet. Check the data sheet to find out what firmware needs to do. Look at your code for control transfers.

Jan
Title: Re: Bulk data transfers with WinUSB and winusb_cs example
Post by: davebv on April 20, 2011, 02:52:33 am
Thank you for your answer.
I finally managed to set to ack the endpoint and the winusb example works ok for bulk transfers. It was, as you suggested, a matter of the firmware of the mcu.
Thanks for your guidelines.