X
RSS YouTube LinkedIn Twitter XCore IRC

Search




Post new topic Reply to topic   [ 2 posts ] 
Author Message
PostPosted: Fri Apr 13, 2012 5:10 pm 
Joined: Mon Feb 13, 2012 10:54 pm
Posts: 12
Dear Forum,


actually, two questions:

1: using the non-interrupt usb lib, can I probe a xud_ep if new data is available before calling XUS_Get_Buffer?
- Im guessing not... thats why there is the interrupt based lib.


2. I wrote this small echo thread:

Code:
void usb_echo(chanend chan_ep1_out,chanend chan_ep1_in){
     XUD_ep c_ep_out = XUD_Init_Ep(chan_ep1_out);
     XUD_ep c_ep_in  = XUD_Init_Ep(chan_ep1_in);
       char mybuffer[518];
       int len;
       while(1) {
           len = XUD_GetBuffer(c_ep_out, mybuffer);
           if (len < 0) {
               XUD_ResetEndpoint(c_ep_out, null);
           }
           len = XUD_SetBuffer(c_ep_in, mybuffer,32);
           if (len < 0) {
                 XUD_ResetEndpoint(c_ep_in, null);
            }


       }
   return;
}


Using libusb:
- I open the device, set the configuration, claim the interface
for x times:
- I write 32 byte
- I read 32 byte
finally I release the interface and close the device.



If x is even I can do this repeatedly.
If x is odd the first write fails (timeout) every second time I run the program.

I don't quite understand why this is. I f I just sink data without echo on the xmos, the number of transfers can be even or odd.

I know that this could have nothing to do this the xmos usb lib and just be me failing to understand a subtlety of usb in general...

help is greatly appreciated!

best,

moritz


Top
Offline Profile View all posts by this user  
 
PostPosted: Wed Apr 18, 2012 2:48 pm 
User avatar
XMOS Employee
Joined: Thu Dec 10, 2009 9:20 pm
Posts: 324
Sounds a bit odd..

What happens if you removed the reset checking code?


Top
Offline Profile View all posts by this user  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic   [ 2 posts ] 


Who is online

Users browsing this forum: sethu and 1 guest



Search for:
Jump to: