I m currently working on a hi-bandwidth CMOS camera sensor application and I m having trouble getting the USB module to work properly. IN-transfers work fine but if I send something to my OUT EP it works once and then stalls the XUS/USB module. Neither read or write request are then answered by the xmos controller.
This is my simple tester for the OUT endpoint:
Code: Select all
void usb_control_out(chanend chan_ep1){ //chanend c_usb_control
XUD_ep c_ep1 = XUD_Init_Ep(chan_ep1);
char mybuffer[518];
timer t;
unsigned s;
int len;
printf("DATA OUT listening \n");
t :> s;
while(1) {
t when timerafter(s+100000) :> s;
printf("trying to recieve now! \n");
len = XUD_GetBuffer(c_ep1, mybuffer);
if (len < 0) {
XUD_ResetEndpoint(c_ep1, null);
}
printf("something came through\n");
printf("len %i, Buffer : %02x %02x %02x %02x \n",len, mybuffer[0],mybuffer[1],mybuffer[2],mybuffer[3]);
}
return;
}
This endpoint has the address 0x01 and is configured as bulk with a max packet size of 512byte.
Im am using lib usb to communicate and all IN/transfers work just fine. Only when I send something to the device. It come through but then stalls the device.
Interestingly, when I disconnect and reconnect the usb cable (this does not de-power or reset the device). I can do IN transfers and 1 out transfer again.
any suggestions or experience with a similar problem?
thank you very much in advance!
best,
Moritz