这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 怎么让USB处在全速、高速、低速的状态上?

共3条 1/1 1 跳转至

怎么让USB处在全速、高速、低速的状态上?

菜鸟
2013-05-05 22:19:09     打赏

请问,USB有固件库,怎么才能设置USB的全速、高速、低速?

有人说,在USB的固件库的desc.c的描述表里可以设置。

但不知道该怎么设置。


下面是usb的mass storage(批量存储--USB/SD卡)的描述项:

const u8 MASS_DeviceDescriptor[MASS_SIZ_DEVICE_DESC] =
  {
    0x12,   /* bLength  */
    0x01,   /* bDescriptorType */
    0x00,   /* bcdUSB, version 2.00 */
    0x02,
    0x00,   /* bDeviceClass : each interface define the device class */
    0x00,   /* bDeviceSubClass */
    0x00,   /* bDeviceProtocol */
    0x40,   /* bMaxPacketSize0 0x40 = 64 */
    0x83,   /* idVendor     (0483) */
    0x04,
    0x20,   /* idProduct */
    0x57,
    0x00,   /* bcdDevice 2.00*/
    0x02,
    1,              /* index of string Manufacturer  */
    /**/
    2,              /* index of string descriptor of product*/
    /* */
    3,              /* */
    /* */
    /* */
    0x01    /*bNumConfigurations */
  };
const u8 MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] =
  {
 /***************配置描述符***********************/
    0x09,   /* bLength: Configuation Descriptor size */
    0x02,   /* bDescriptorType: Configuration */
   
 MASS_SIZ_CONFIG_DESC,/*本配置组数据长度,低字节*/
 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 */

 /*****************接口描述符*******************/
    /******************** Descriptor of Mass Storage interface ********************/
    /* 09 */
    0x09,   /* bLength: Interface Descriptor size */
    0x04,   /* bDescriptorType: Interface descriptor type */
    0x00,   /* bInterfaceNumber: Number of Interface */
    0x00,   /* bAlternateSetting: Alternate setting */
    0x02,   /* bNumEndpoints*/
    0x08,   /* bInterfaceClass: MASS STORAGE Class */
    0x06,   /* bInterfaceSubClass : SCSI transparent*/
    0x50,   /* nInterfaceProtocol */
    4,      /* iInterface: */

    /*************标准批量数据输入端点描述符****************/
 /* 18 */
    0x07,   /*Endpoint descriptor length = 7*/
    0x05,   /*Endpoint descriptor type */
    0x81,   /*Endpoint address (IN, address 1) */
    0x02,   /*Bulk endpoint type */
    0x40,   /*Maximum packet size (64 bytes) */
    0x00,
    0x00,   /*Polling interval in milliseconds */
   
 /*************标准批量数据输出端点描述符****************/
 /* 25 */
    0x07,   /*Endpoint descriptor length = 7 */
    0x05,   /*Endpoint descriptor type */
    0x02,   /*Endpoint address (OUT, address 2) */
    0x02,   /*Bulk endpoint type */
   
 0x40,   /*Maximum packet size (64 bytes) */
 0x00,
// 0x00,
// 0x01,   //512Byte,设置为512的时候报错了。批量传输端口的全速可以设置为512,高速模式可以设置8、16、32、64.我想设置为高速,结果USB链接不到电脑上。64却可以,请问怎么回事?
    
 0x00    /*Polling interval in milliseconds*/
    /*32*/
  };





关键词: STM32     USB     速度     设置    

高工
2013-05-05 22:26:32     打赏
2楼
没配置过这个呢,等高手指点吧

菜鸟
2013-05-05 23:11:01     打赏
3楼
我在百度知道问了一下,说是在usb_desc.c内设置,但我把红色部分改为512的时候,USB连接错误了。。。。。

共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]