Event Handler for incoming data from USB chip CY7C68001

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

cross mob
Anonymous
Not applicable

 I'm using the cyusb.dll to build a user interface for my project. I need an "event" o "event handler" for my incoming data from the device, but I cannot figure out in the library. Actually, I search new incoming data with a timer in a thread. There is another way to accomplish it?

   

 

   

Thanks in advance,

   

Carlos

0 Likes
1 Solution
Anonymous
Not applicable

USB protocol is host-centric so even if the device has the response it cannot send it unless you request for it (i.e. host sends a packet requesting data and the device will respond to that).

   

Please let me know your exact application and the need for this.

   

Regards,

   

Anand

View solution in original post

0 Likes
7 Replies
Anonymous
Not applicable

Hi,

   

   From your post it seems you need to be notified whenever device sends data (Please confirm). Event handlers are not available for such functions since USB is a Host centric protocol. Please provide more information about your project or requirements(like transfer type) so that we can help you more.

0 Likes
Anonymous
Not applicable

Hi:

   

Yes, you right. When the device (fpga in NB3000) has new data it sends to host (PC). I use "bulk transfer" for to send information from device to host and the "interrupt transfer" for to send commands to device (from the host).

   

My question is if there is an event which notifies me when new data is available from the device. I found in this post (http://www.cypress.com/?app=forum&rID=42104) from "aasi" which he says "...use the event of device returning processed data...", but I do not know if it's the type of event that I want. Anyway I cannot found such event in the library cyusb.dll.

   

If no "event", how I do to know if new data is available?. In the host, I search new data periodically using a thread (start a thread every 200 ms) and if no data, the thread goes to sleep. I don't like it this way, so: there is another way?

   

 

   

Kind regards,

   

Carlos

0 Likes
Anonymous
Not applicable

Carlos,

   

It is waiting for a signalled state rather than a event. WaitForSingleObject can be used to achieve this. Our document would have code snippets which would demonstrate this.

   

Regards,

   

Anand

0 Likes
Anonymous
Not applicable

Hi Anand:

   

 

   

Thanks for your quick response but this is not what I want. Forget for now the threads. My question is: How would you do to know if the device sent information without having to wait a while?

   

 

   

Regards,

   

Carlos

0 Likes
Anonymous
Not applicable

Hi Anand:

   

 

   

To clarify, I do not know when the device sends information. That is, when I send a command to the device, it processes it and after a while the device sends a response. After that, I send another command and so on. So what I want is that when the device sends a response (new information) it notifies me. What I do not want is to look for such information because I do not know when the device sent the information to me.

   

 

   

Regards,

   

Carlos

0 Likes
Anonymous
Not applicable

USB protocol is host-centric so even if the device has the response it cannot send it unless you request for it (i.e. host sends a packet requesting data and the device will respond to that).

   

Please let me know your exact application and the need for this.

   

Regards,

   

Anand

0 Likes
Anonymous
Not applicable

 Hi Anand:

   


You right, now I understand the host-centric concept. I have to modify the code to that works correctly. Thanks

   
        
   
    Regards,   
   
    Carlos   
0 Likes