刚开始学stm32的usb,代码基本上都是对网上找到的修改的,也只是因为硬件方面修改了一些,主要的像描述符什么的都没有修改,win7系统已经检测到了stm的usb,usb hound已经可以看到设备的信息,我设置的功能是用stm32的中断触发usb发送4个字节的数据,但是usb hound上面没有检测到,我在主函数中用while循环发送该4字节的信息时也是如此,usb也是什么反应都没有,求高手指导,万分感谢!ps:stm32 usb和usb hound 都是刚接触的!
------解决方案--------------------
似乎是usb hound设置不对,选择设备时,勾选STM32 USB设备向上到根结点路径上所有节点设备
------解决方案--------------------
你设置的缓冲总大小和单条缓冲的大小都太小了,另外你没有把缓冲满自动停止的选项勾掉(默认是勾选的),所以每次缓冲满了就停下了,需要再次run.
那个进度条就是显示缓冲用了多少了。如果那个缓冲满自动停止使能的话,满了就停掉了。
单个缓冲的默认大小也很小,你上面每个最多才只能收8个字节,这个要放大点。
另外你下面的图明显是设置过虑了,只收IN和OUT消息。
------解决方案--------------------
你上面的IN数据似乎是PID设备的数据,是否是你把和STM32 USB处于同一根集线器上的鼠标或键盘选上了
------解决方案--------------------
建议你花点时间仔细看一下STM32给的USB源码,要对照USB协议看,再调试一下。
STM32下的USB的例子算是比较完备的,基本上改改就能用,但需要你对USB协议有个基本的了解。
------解决方案--------------------
buffer overrun是USB从设备的IN端点或OUT端点的缓冲溢出了,
此时USB主机发起操作的时候,设备会给主机会USTS告诉主机缓冲溢出了
------解决方案--------------------
我可不是大神啊,只是做过
如果经常出现no response,除程序原因外,也可能和硬件有关系,比如说和PCB板有关系,和USB连接线有关系(线不好,USB上出现数据错误),和你使用的是电脑前面的USB口还是后面的USB口也可能有关系(前面的USB一般不是根集线器)
另外你这里多出24个字节,应该和你的程序有关系。
------解决方案--------------------
键值对应关系不对,HID的说明文档里有的,数字键1应该是1e,你也可以用bushound抓一下标准键盘的看一下
0 00 Reserved (no event indicated)9 N/A √ √ √ 4/101/104
1 01 Keyboard ErrorRollOver9 N/A √ √ √ 4/101/104
2 02 Keyboard POSTFail9 N/A √ √ √ 4/101/104
3 03 Keyboard ErrorUndefined9 N/A √ √ √ 4/101/104
4 04 Keyboard a and A4 31 √ √ √ 4/101/104
5 05 Keyboard b and B 50 √ √ √ 4/101/104
6 06 Keyboard c and C4 48 √ √ √ 4/101/104
7 07 Keyboard d and D 33 √ √ √ 4/101/104
8 08 Keyboard e and E 19 √ √ √ 4/101/104
9 09 Keyboard f and F 34 √ √ √ 4/101/104
10 0A Keyboard g and G 35 √ √ √ 4/101/104
11 0B Keyboard h and H 36 √ √ √ 4/101/104
12 0C Keyboard i and I 24 √ √ √ 4/101/104
13 0D Keyboard j and J 37 √ √ √ 4/101/104
14 0E Keyboard k and K 38 √ √ √ 4/101/104
15 0F Keyboard l and L 39 √ √ √ 4/101/104
16 10 Keyboard m and M4 52 √ √ √ 4/101/104
17 11 Keyboard n and N 51 √ √ √ 4/101/104
18 12 Keyboard o and O4 25 √ √ √ 4/101/104
19 13 Keyboard p and P4 26 √ √ √ 4/101/104
20 14 Keyboard q and Q4 17 √ √ √ 4/101/104
21 15 Keyboard r and R 20 √ √ √ 4/101/104
22 16 Keyboard s and S4 32 √ √ √ 4/101/104
23 17 Keyboard t and T 21 √ √ √ 4/101/104
24 18 Keyboard u and U 23 √ √ √ 4/101/104
25 19 Keyboard v and V 49 √ √ √ 4/101/104
26 1A Keyboard w and W4 18 √ √ √ 4/101/104
27 1B Keyboard x and X4 47 √ √ √ 4/101/104
28 1C Keyboard y and Y4 22 √ √ √ 4/101/104
29 1D Keyboard z and Z4 46 √ √ √ 4/101/104
30 1E Keyboard 1 and !4 2 √ √ √ 4/101/104
31 1F Keyboard 2 and @4 3 √ √ √ 4/101/104
32 20 Keyboard 3 and #4 4 √ √ √ 4/101/104
33 21 Keyboard 4 and $4 5 √ √ √ 4/101/104
34 22 Keyboard 5 and %4 6 √ √ √ 4/101/104
35 23 Keyboard 6 and ^4 7 √ √ √ 4/101/104
36 24 Keyboard 7 and &4 8 √ √ √ 4/101/104
37 25 Keyboard 8 and *4 9 √ √ √ 4/101/104
38 26 Keyboard 9 and (4 10 √ √ √ 4/101/104
39 27 Keyboard 0 and )4 11 √ √ √ 4/101/104
40 28 Keyboard Return (ENTER)5 43 √ √ √ 4/101/104
41 29 Keyboard ESCAPE 110 √ √ √ 4/101/104
42 2A Keyboard DELETE (Backspace)13 15 √ √ √ 4/101/104
43 2B Keyboard Tab 16 √ √ √ 4/101/104