Other Parts Discussed in Thread: CC2531
I am using CC2531 USB Dongle for product development and USB Sample example source code (swrc088) to develop vendor specific class and protocol, below is my descriptor config
Configuration Descriptor: wTotalLength: 0x0019 bNumInterfaces: 0x01 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0x80 (Bus Powered ) MaxPower: 0x19 (50 Ma) Interface Descriptor: bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x01 bInterfaceClass: 0xFF bInterfaceSubClass: 0xFF bInterfaceProtocol: 0xFF iInterface: 0x00 Endpoint Descriptor: bEndpointAddress: 0x83 IN Transfer Type: Bulk wMaxPacketSize: 0x0040 (64) bInterval: 0x05
and below is wireshark dump of my packet, as per usb_framework.c I should receive data in usbSetupData.pBuffer (usbfwSetupHandler() ) but when I debug I always see some garbage data.
void usbfwSetupHandler(void)
{
uint8 controlReg;
uint8 bytesNow;
uint8 oldEndpoint;
// Save the old index setting, then select endpoint 0 and fetch the control register
oldEndpoint = USBFW_GET_SELECTED_ENDPOINT();
USBFW_SELECT_ENDPOINT(0);
controlReg = USBCS0;
// Receive OUT packets
if (usbfwData.ep0Status == EP_RX) {
// Read FIFO
bytesNow = USBCNT0;
usbfwReadFifo(&USBF0, bytesNow, usbSetupData.pBuffer);
usbSetupData.bytesLeft -= bytesNow;
usbSetupData.pBuffer += bytesNow;
// Arm the endpoint
USBCS0 = usbSetupData.bytesLeft ? USBCS0_CLR_OUTPKT_RDY : (USBCS0_CLR_OUTPKT_RDY | USBCS0_DATA_END);
// Make a call to the appropriate request handler when done
if (usbSetupData.bytesLeft == 0) {
if (ProcessFunc) ProcessFunc();
usbfwData.ep0Status = EP_IDLE;
}
// Return here since nothing more will happen until the next interrupt
USBFW_SELECT_ENDPOINT(oldEndpoint);
return;
// Let the application handle the reception
} else if (usbfwData.ep0Status == EP_MANUAL_RX) {
ProcessFunc();
}
please advice what I am missing here