hi to all,
i am developing a device based on cc2540, i want to create something like bridge that wll forward all received packets from bluetooth to usb, but i have a problem with cc2540 usb. during data transfer some packets get lost and when i sniff to usb analeyzer it give me below log :
35.2 IN 00 00 00 01 00 08 39 00 00 00 00 00 00 00 00 00 ......6......... 4663.1.0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4663.1.16
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4663.1.32
35.2 USTS c0000004 stall pid 4664.1.0
35 RESET 4665.1.0
34 RESET 4666.1.0
34 ok 4666.2.0
35 ok 4665.2.0
35.2 RESET 4667.1.0
35.2 IN 00 00 00 01 00 08 36 00 00 00 00 00 00 00 00 00 ......6......... 4668.1.0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4668.1.16
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 4668.1.32
as you can see in this log every thing is ok untill the endpoint that i sending data from that return packet with stall pid and after that host try to reset the endpoint, and during these process i lost some packets.
here is part of my code that write data to endpoint:
uint8 usbfwVancFOBWrite(uint8 * data) { uint32 stopPoint = 100; uint8 oldEndpoint; // Save the old index setting, then select endpoint 0 and fetch the control register oldEndpoint = USBFW_GET_SELECTED_ENDPOINT(); USBFW_SELECT_ENDPOINT(USB_HID_VFOB_EP); if(USBCSOL & USBCSOL_OUTPKT_RDY) /* buffer is full */ { // Read FIFO if(usbReadBlocked==0) { usbfwReadFifo(&USBF2, USBCNTL, _data); USBCSOL &= ~USBCSOL_OUTPKT_RDY; } USBFW_SELECT_ENDPOINT(oldEndpoint); //return 0; } USBFW_SELECT_ENDPOINT(USB_HID_VFOB_EP_WRITE); // Send IN packets while((USBCSIL & USBCSIL_INPKT_RDY) && stopPoint>0) stopPoint--; if(stopPoint!=0) /* check timeout event */ { usbfwWriteFifo(&USBF2, 64, data); USBCSIL = USBCSIL_INPKT_RDY; USBCSIL = USBCSIL_SEND_STALL; while ((USBCSIL & USBCSIL_SENT_STALL) && stopPoint>0) stopPoint--; } USBCSIL = 0; USBFW_SELECT_ENDPOINT(oldEndpoint); if(stopPoint==0) return 0; /* timeout event */ else return 1; /* success send */ }
know can any one give me a advice to solve this problem???
thanks.