本帖最后由 xiaoergao 于 2015-9-9 20:07 编辑
看USB协议说全速通讯BULK最大包是64Byte,但是突然心血来潮试了一下128byte的设定。居然通讯成功。
先上图。
可以确定不是驱动导致的抓了2次数据包合并的。
在ENDPOINT1 回调函数中是这样定义的。
void EP1_IN_Callback (void)
{
int i=0;
for(i=0;i<1024;i++) buf[i] = flag;
UserToPMABufferCopy(buf, ENDP1_TXADDR, 128);
SetEPTxCount(ENDP1, 128);
SetEPTxValid(ENDP1);
printf("%d\r\n",flag);
flag++;
}
描述符是这样:(只修改了ENDPOINT1 IN的最大包数)
/* USB Standard Device Descriptor */
const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /* bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType 01*/
0x10,
0x01, /* bcdUSB = 2.00 /
0xd0, /* 测试设备/
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0 */
0x83,
0x04, /* idVendor = 0x0483 */
0x40,
0x57, /* idProduct = 0x5740 */
0x00,
0x01, /* bcdDevice = 2.00 */
0, /* Index of string descriptor describing manufacturer */
0, /* Index of string descriptor describing product */
0, /* 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 interface */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing the configuration */
0x60, /* bmAttributes: self powered */
0x32, /* MaxPower 0 mA */
/*Interface Descriptor*/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: Interface */
/* Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints: One endpoints used *///¶ËµãÊý
0xdc, /* bInterfaceClass: Communication Interface Class²âÊÔÉ豸ÀàÐÍ */
0xa0, /* bInterfaceSubClass: Abstract Control Model */
0xb0, /* bInterfaceProtocol: Common AT commands */
0x00, /* iInterface: */
/*Endpoint 1 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
0x05, /* bDescriptorType: Endpoint */
0x81, /* bEndpointAddress: (IN1) */
0x02, /* bmAttributes: Bulk */
0x80, /* wMaxPacketSize: */
0x00,
0x00, /* bInterval */
/*Endpoint 3 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
0x05, /* bDescriptorType: Endpoint */
0x02, /* bEndpointAddress: (OUT2) */
0x02, /* bmAttributes: Bulk */
0x40, /* wMaxPacketSize: */
0x00,
0x00 /* bInterval: ignore for Bulk transfer */
};
到底是怎么回事,望高手答疑。
|
|