Help with jm60 and bulk transfers with USB.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with jm60 and bulk transfers with USB.

1,533 Views
davebv
Contributor III

Hello,

 

I am trying to use the winusb dirver to make use of a custom USB class I made based on the documentation provided with the Freescale USB Stack with PHDC Device 2.6.

My class has the compulsory endpoint plus 2 bulk endpoints, one in and one out.

What I did so far is make control transfer request resulting as expected.

Then, the steps I do to perform bulk transactions are first send bulk out to the out endpoint, then execute "send bulk data" from the jm60 and then get the data from the host via winusb. After that, I get the expected data.


But when I try to repeat the operation, by sending again a bulk transfer, the out endpoint does not execute the service 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... (and how do I do that)

Thank you for your help.

Labels (1)
0 Kudos
4 Replies

567 Views
Tsuneo
Contributor IV

For JM60,
After receiving a transaction on the bulk OUT endpoint (EP), the firmware has to "arm" the EP with a buffer, to receive the next transaction. Usually, the first "arming" of the bulk EP is done, when the firmware receives Set_Configuration request.

Which USB example are you starting on?
The example should have a routine to do this "arming" job.
Point the URL of the example, and I'll tell you the exact subroutine name.

Tsuneo

0 Kudos

567 Views
davebv
Contributor III

I am using the freescale usb stack with phdc support rev 2.6 from http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MEDICALUSB&fpsp=1&tab=Design_Tools_Ta...

 

The example I based my class is the msd (Freescale USB Stack with PHDC v2.6\Source\device\app\msd), but I am trying also with the CDC example (USB\Freescale USB Stack with PHDC v2.6\Source\device\app\cdc).

I am using both cases with a winusb driver.

In both cases, writing control transfers works ok.

Writing to bulk endpoint more than once, the first time works ok, the succesive attempts it returns an error (guessing it is related to what you said about arming the buffer).

 

Thanks for your  help!

0 Kudos

567 Views
davebv
Contributor III

By the way, I am using the http://cache.freescale.com/files/microcontrollers/doc/user_guide/MEDUSBUG.pdf?fpsp=1 MEDUSBUG.pdf document to build my class, following the chapter 4 and 5.

0 Kudos

567 Views
davebv
Contributor III

I found a way of "arming" the endpoind for more out transactions by calling the function

 

 

USB_Device_Recv_Data(controller_ID, BULK_OUT_ENDPOINT, NULL, 0);

When sending data from the PC to the jm60 with the winusb, the buffer can be larger than the endpoint wMaxPacketSize and the driver splits that buffer in chunks of size wMaxPacketSize.

 

I hope you find this useful, or you may correct if the way of arming the endpoint is not correct.

 

 

0 Kudos