Hi,Guys:
I am using STM32L152, and want to change VirtualComPort project to a simple Bulk transfer project.
I modify the descriptor, use endpoint 0x81 and 0x03. Remove Sof_callback and some uart xfer function.
Now Windows 7 X64 can regonize the device, and driver can be loaded(WinUSB or WinDriver).
But when I perform PIPE write/read in WinDriver(easy to debug), it fail , same thing happened in WinUSB.
Use USBLyzer , it shows:
Stall PID
Here is the endp callback:
void EP1_IN_Callback (void)
{ USB_SIL_Write(ENDP1,USART_Rx_Buffer, 64);
SetEPTxValid(ENDP1);
}
void EP3_OUT_Callback(void)
{
uint16_t USB_Rx_Cnt;
/* Get the received data buffer and update the counter */
USB_Rx_Cnt = USB_SIL_Read(EP3_OUT, USB_Rx_Buffer);
/* USB data will be immediately processed, this allow next USB traffic being
NAKed till the end of the USART Xfer */
//USB_To_USART_Send_Data(USB_Rx_Buffer, USB_Rx_Cnt);
/* Enable the receive of data on EP3,stall */
SetEPRxValid(ENDP3);
}
and here is the description:
/* USB Standard Device Descriptor */
const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /* bLength=18 */
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00,
0x02, /* bcdUSB = 2.00 (USB2.0) */
0x00, /* bDeviceClass: CDC=2,HID=3,DISPLAY=4,2->0(device) */
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol*/
0x40, /* bMaxPacketSize064 */
0x16,
0x40, /* idVendor = 0x4016 ->4000 163580 */
0x80,
0x35, /* idProduct = 0x3580 */
0x00,
0x01, /* bcdDevice 1.00 */
1, /* Index of string descriptor describing manufacturerString_Descriptor[1] */
2, /* Index of string descriptor describing product */
3, /* Index of string descriptor describing the device's serial number */
0x01 /* bNumConfigurations */
};
const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
{
/*Configuration Descriptor*/
0x09, /* bLength: Configuration Descriptor size */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
VIRTUAL_COM_PORT_SIZ_CONFIG_DESC, /*wTotalLength:no of returned bytes */
0x00,
0x01, /* bNumInterfaces: 2 interface2->1 */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration */
0xC0, /* bmAttributes: self powered(b7 - buspwr, b6 - selfpwr, b5 - rwu) */
0x32, /* MaxPower 100 mA */
/* Interface Descriptor */
0x09, /* bLength: Interface Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
/* Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints: One endpoints used1->2 */
0xFF, /* bInterfaceClass: Communication Interface Class2->0xFF */
0xFF, /* bInterfaceSubClass: Abstract Control Model2->0xFF */
0xFF, /* bInterfaceProtocol: Common AT commands1->0xFF */
0x00, /* iInterface: */
/*Endpoint 3 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x03, /* bEndpointAddress: (OUT3) */
0x02, /* bmAttributes: Bulk,0=CTRL,1=ISO,3=INT */
0x40, /* wMaxPacketSize: */
0x00,
0x00, /* bInterval: ignore for Bulk transfer */
/*Endpoint 1 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x81, /* bEndpointAddress: (IN1) */
0x02, /* bmAttributes: Bulk */
0x40, /* wMaxPacketSize: */
0x00,
0x00 /* bInterval */
};
And, when I perform PIPE read/write, the CTR_LP() can not enter, it seems no transition Interrupt happen.
Any response is appreciated.