OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 6392|回复: 5

STM32F207 HID 设备PC 识别不到,大家帮忙看看什么地方有问题

[复制链接]

13

主题

22

帖子

0

精华

初级会员

Rank: 2

积分
159
金钱
159
注册时间
2015-3-9
在线时间
22 小时
发表于 2015-3-12 17:26:45 | 显示全部楼层 |阅读模式
5金钱
ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END =
{
  0x09, /* bLength: Configuration Descriptor size */
  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
  USB_HID_CONFIG_DESC_SIZ,
  /* wTotalLength: Bytes returned */
  0x00,
  0x01,         /*bNumInterfaces: 1 interface*/
  0x01,         /*bConfigurationValue: Configuration value*/
  0x00,         /*iConfiguration: Index of string descriptor describing
  the configuration*/
  0xE0,//  0x80,           //0xE0,         /*bmAttributes: bus powered and Support Remote Wake-up */ //201503,change
  0x32,         /*MaxPower 100 mA: this current is used for detecting Vbus*/
  
  /************** Descriptor of Joystick Mouse interface ****************/
  /* 09 */
  0x09,         /*bLength: Interface Descriptor size*/
  USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/
  0x00,         /*bInterfaceNumber: Number of Interface*/
  0x00,         /*bAlternateSetting: Alternate setting*/
  0x02,         //0x01,         /*bNumEndpoints*/ 201503,change
  0x03,         /*bInterfaceClass: HID*/
  0x00,         //0x01,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/ 201503,change
  0x00,         //0x02,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/ 201503,change
  0,            /*iInterface: Index of string descriptor*/
  /******************** Descriptor of Joystick Mouse HID ********************/
  /* 18 */
  0x09,         /*bLength: HID Descriptor size*/
  HID_DESCRIPTOR_TYPE, /*bDescriptorType: HID*/
  0x11,         /*bcdHID: HID Class Spec release number*/
  0x01,
  0x00,         /*bCountryCode: Hardware target country*/
  0x01,         /*bNumDescriptors: Number of HID class descriptors to follow*/
  0x22,         /*bDescriptorType*/
  HID_MOUSE_REPORT_DESC_SIZE,/*wItemLength: Total length of Report descriptor*/
  0x00,
  /******************** Descriptor of Mouse endpoint ********************/
  /* 27 */
  0x07,          /*bLength: Endpoint Descriptor size*/
  USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/
  
  HID_IN_EP,     /*bEndpointAddress: Endpoint Address (IN)*/
  0x03,          /*bmAttributes: Interrupt endpoint*/
  HID_IN_PACKET, /*wMaxPacketSize: 4 Byte max */
  0x00,
  0x0A,          /*bInterval: Polling Interval (10 ms)*/
/******************** Descriptor of Mouse endpoint ********************///201503,add,begin
  /* 34 */
0x07,          /*bLength: Endpoint Descriptor size*/
  USB_ENDPOINT_DESCRIPTOR_TYPE, /*bDescriptorType:*/
  
  HID_OUT_EP,     /*bEndpointAddress: Endpoint Address (IN)*/
  0x03,          /*bmAttributes: Interrupt endpoint*/
  HID_OUT_PACKET, /*wMaxPacketSize: 4 Byte max */
  0x00,
  0x0A,          /*bInterval: Polling Interval (10 ms)*/
} ;
__ALIGN_BEGIN static uint8_t HID_MOUSE_ReportDesc[HID_MOUSE_REPORT_DESC_SIZE] __ALIGN_END =
{
 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
 
 0x09, 0x00, // USAGE (0)
 
 0xa1, 0x01, // COLLECTION (Application)

 0x15, 0x00, //     LOGICAL_MINIMUM (0)
 
 0x25, 0xff, //     LOGICAL_MAXIMUM (255)
 
 0x19, 0x01, //     USAGE_MINIMUM (1)
 
 0x29, 0x08, //     USAGE_MAXIMUM (8) 
 
 0x95, 0x08, //     REPORT_COUNT (8)
 
 0x75, 0x08, //     REPORT_SIZE (8)
 
 0x81, 0x02, //     INPUT (Data,Var,Abs)
 
 0x19, 0x01, //     USAGE_MINIMUM (1)
 
 0x29, 0x08, //     USAGE_MAXIMUM (8) 
 
 0x91, 0x02, //   OUTPUT (Data,Var,Abs)
 
 0xc0        // END_COLLECTION
};

我从官网下载了固件库,把其中的HID例程修改成自定义的HID 设备,PC 识别不到,USB连接电路如图:

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2015-3-12 22:38:36 | 显示全部楼层
回复

使用道具 举报

13

主题

22

帖子

0

精华

初级会员

Rank: 2

积分
159
金钱
159
注册时间
2015-3-9
在线时间
22 小时
 楼主| 发表于 2015-3-13 09:18:09 | 显示全部楼层
有没有大神啊,帮小弟看下那里出问题了啊
回复

使用道具 举报

13

主题

22

帖子

0

精华

初级会员

Rank: 2

积分
159
金钱
159
注册时间
2015-3-9
在线时间
22 小时
 楼主| 发表于 2015-3-13 15:20:25 | 显示全部楼层
回复【2楼】正点原子:
---------------------------------
原子哥,HID 设备的时候,STM32F207必须要使用外部晶振吗?如果没有外部晶振怎么办?我的外部没有接晶振
回复

使用道具 举报

13

主题

22

帖子

0

精华

初级会员

Rank: 2

积分
159
金钱
159
注册时间
2015-3-9
在线时间
22 小时
 楼主| 发表于 2015-3-13 15:46:15 | 显示全部楼层
回复【4楼】cassie:
---------------------------------
调试程序发现,一直停留在USB_OTG_BSP_mDelay(20);这个地方,这是什么原因啊?
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2015-3-13 22:54:36 | 显示全部楼层
回复【4楼】cassie:
---------------------------------
不一定吧,内部倍频后,给USB的频率稳定就可以了。要48Mhz
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-24 20:54

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表