My config descriptor and other settings:
const u8 DeviceConfigDescriptor[39] =
{
0x09, 0x02, 0x27, 0x00,
0x01, /*bNumInterfaces: 1 interface*/
0x01, /*bConfigurationValue: Configuration value*/
0x00, /*iConfiguration: Index of string descriptor describing the configuration*/
0xC0, /*bmAttributes: bus powered */
0x32, /*MaxPower 100 mA: this current is used for detecting Vbus*/
/************** Descriptor of interface ****************/
0x09,
0x04,
0x00, /*bInterfaceNumber: Number of Interface*/
0x00, /*bAlternateSetting: Alternate setting*/
0x03, /*bNumEndpoints*/
0xFF, /*bInterfaceClass: Vendor Specific*/
0xF0, /*bInterfaceSubClass ??? */
0x00, /*nInterfaceProtocol : */
0, /*iInterface: Index of string descriptor*/
/******************** Standard Endpoint Descriptor ********************/
0x07, /*bLength: Endpoint Descriptor size*/
0x05, /*bDescriptorType:*/
0x81, /*bEndpointAddress: Endpoint Address (IN)*/
0x03, /*bmAttributes: Interrupt endpoint*/
0x40, /*wMaxPacketSize: 64 Byte max */
0x00,
0x04, /*bInterval: Polling Interval (4 ms)*/
0x07, /*bLength: Endpoint Descriptor size*/
0x05, /*bDescriptorType:*/
0x82, /*bEndpointAddress: Endpoint Address (IN)*/
0x02, /*bmAttributes: Bulk endpoint*/
0x40, /*wMaxPacketSize: 64 Byte max */
0x00,
0x00, /*bInterval: Polling Interval (0 ms)*/
0x07, /*bLength: Endpoint Descriptor size*/
0x05 , /*bDescriptorType:*/
0x03, /*bEndpointAddress: Endpoint Address (OUT)*/
0x02, /*bmAttributes: Bulk endpoint*/
0x40, /*wMaxPacketSize: 64 Byte max */
0x00,
0x00, /*bInterval: Polling Interval (0 ms)*/
};
#define EP_NUM 4
#define ENDP0_RXADDR (0x0018)
#define ENDP0_TXADDR (0x0058)
/* EP1 */
/* Tx buffer base address */
#define ENDP1_TXADDR (0x0098)
/* EP2 */
/* Tx buffer base address */
#define ENDP2_TXADDR (0x00D8)
/* EP3 */
/* Rx buffer base address */
#define ENDP3_RXADDR (0x0118)
/* Initialize Endpoint 0 */
SetEPType(ENDP0, EP_CONTROL);
SetEPTxStatus(ENDP0, EP_TX_STALL);
SetEPRxAddr(ENDP0, ENDP0_RXADDR);
SetEPTxAddr(ENDP0, ENDP0_TXADDR);
Clear_Status_Out(ENDP0);
SetEPRxCount(ENDP0, 64);
SetEPRxStatus(ENDP0, EP_RX_VALID);
/* Initialize Endpoint 1 */
SetEPType(ENDP1, EP_INTERRUPT);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPTxCount(ENDP1, 64);
SetEPRxStatus(ENDP1, EP_RX_DIS);
SetEPTxStatus(ENDP1, EP_TX_NAK);
/* Initialize Endpoint 2 */
SetEPType(ENDP2, EP_BULK);
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
SetEPTxCount(ENDP2, 64);
SetEPRxStatus(ENDP2, EP_RX_DIS);
SetEPTxStatus(ENDP2, EP_TX_NAK);
/* Initialize Endpoint 3 */
SetEPType(ENDP3, EP_BULK);
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
SetEPRxCount(ENDP3, 64);
SetEPRxStatus(ENDP3, EP_RX_VALID);
SetEPTxStatus(ENDP3, EP_TX_DIS);