Correct practice when implementing a command protocol using bulk endpoints

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

We are in the process of upgrading the FX2 chip of our devices to FX3. We are implementing our custom command reply protocol using Bulk endpoints.

   

Bulk OUT endpoint is for command and Bulk IN endpoint is for command reply.

   

I have started implementation using BulkSrcSink example project.

   

Following is the way that I have implemented command handling.

   
        
  1. In the DMA Producer callback I am copying the DMA buffer to a global buffer.
  2.     
  3. Then I fire an event to my command handler thread
  4.     
  5. That thread takes the command from the global buffer and process it
  6.     
  7. Then it commits the reply to the BulkSource channel.
  8.    
   

Is this the correct approach? Or is there a better and an efficient approach?

   

Thank you.

0 Likes
3 Replies
Anonymous
Not applicable

By custom command are you referring to Vendor commands? For vendor commands you can use the control endpoints also. Refer to the GPIF TO USB example on how to handle vendor commands in the FX3 firmware.

0 Likes
Anonymous
Not applicable

Hello,

   

It is similar to vendor commands. But we are using a separate two Bulk endpoints for handling them. We don't use the control endpoint to send our custom commands.

   

I want to know whether the procedure I have followed when handling the packet is correct or not.

0 Likes
Anonymous
Not applicable

Pradeepa,

   

It would be easier if you use control endpoints to handle the vendor/custom command as mentioned. But, if you have already developed a method to handle them using BULK, then it is okay. You can refer to the bulksourcesink firmware if you want to implement a similar application. Yes, your approach seems correct. 

   

Nishant

0 Likes