你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32F407VE使用USB_HOST接上HID设备不能接收数据?

[复制链接]
anyonezhang 发布时间:2020-7-2 11:05
请教FAE,使用CUbeMX建立USB_HOST工程,已经能够识别鼠标和键盘,也能收到数据。但是接上电磁屏(HID设备,类似鼠标),不能接收数据是什么原因?5 ?9 Y0 f3 M8 a! s; e
设备已经连接成功了如下:
) V2 V" K8 x. PUSB Device Connected" b. y" A! Y" J+ ^  D* ~1 l
USB Device Reset Completed
: T' ?5 y+ i( o! _' xPID: 6dh7 ]+ o- V6 ?# I/ |
VID: 256ch
' Z  }1 F! Z! I# H: BAddress (#1) assigned.
1 V. G+ X! g8 l  O9 K' y0 S6 i/ TManufacturer : GAOMON
% z  U- k: z( o2 B5 t- `5 R- AProduct : Gaomon Tablet
3 W5 V5 W5 ]7 n* oSerial Number :
8 X" g/ y1 B0 HEnumeration done.
+ h; N( e* z2 R+ j2 k" nThis device has only 1 configuration.
7 Z! f' T( [5 ^' L  h( FDefault configuration set.3 W( I* L2 F. C. D- u8 x
Device remote wakeup enabled
) g1 D8 Z2 J7 h7 h4 HSwitching to Interface (#0)5 B; |9 T) Z' A/ o
Class    : 3h
0 d5 E% r* r5 C$ lSubClass : 1h
. T' L7 Q* J3 \! eProtocol : 2h" ^, U' V8 [) ^- g4 y& w( \
Mouse device found!
& A2 Z* C- r7 N; R2 s0 pHID class started.
收藏 评论3 发布时间:2020-7-2 11:05

举报

3个回答
天臆弄人 回答时间:2020-7-2 13:55:06
改下端口就是了
anyonezhang 回答时间:2020-7-2 14:49:43
天臆弄人 发表于 2020-7-2 13:55
& g0 e) b% u% J! E# d改下端口就是了

0 w2 a- k5 X6 w! B十分感谢  能具体一点吗?在usbh_ioreq.c usbh_core.c usbh_ctlreq.c usbh_pipes.c usbh_hid.c的哪个文件里面改?
anyonezhang 回答时间:2020-7-4 13:37:45
获取的报告描述符如下: / ?! J' T6 f$ R0 ^4 P
bLength: 12h# u' \# {* E: W
bDescriptorType: 1h
2 J6 k% M( @3 O# l" t7 T1 IbcdUSB: 200h" E% v; k7 q' l; M2 {! G
bDeviceClass: 0h2 x9 B6 ^& j9 G- o
bDeviceSubClass: 0h7 {' }5 d, d6 \, Z) z9 k0 {
bDeviceProtocol: 0h
( T" y9 |. m! H1 c, Z* \bMaxPacketSize: 8h
% B! Y( Z0 w9 a9 W0 x, abDeviceClass: 0h9 k" p9 l# t- Z' L1 B+ y8 ?
PID: 6dh
4 x' e4 R8 }: w/ p5 L0 XVID: 256ch
. z7 u) Q! @( b' f' [$ lbcdDevice: 100h
$ N3 c4 Z" Y6 s  riManufacturer: 1h
% v' q0 o" m; KiProduct: 2h
- z8 X% k6 ^3 [- siSerialNumber: 3h) w# J/ M; l  x( I, i/ z) b8 k$ c
bNumConfigurations: 1h
) B& N3 C- N6 H& `Address (#1) assigned.9 \3 p* o6 W% G+ I4 A' \6 m! J
bLength: 9h1 e  g, I; Q: J# l5 P
bDescriptorType: 2h
# X5 v% G" W. \2 |wTotalLength: 3bh
/ I! W) [; J1 O% Q4 l; QbDescriptorType: 2h
) f/ H6 v. M7 l8 L" |* nbNumInterfaces: 2h( ^1 e- }9 k; r/ c
bConfigurationValue: 1h
8 ]: F, R8 x* diConfiguration: 0h
# `4 }+ {, [+ {6 a* g& h# B$ BbmAttributes: a0h
( e& i- ~# i9 p8 c; {9 sbMaxPower: f0h5 `$ h+ t: W  B8 s; ~4 J7 ]* S
Itf_Desc[0].bLength: 9h
6 U3 F8 n8 d) Q  C% dItf_Desc[0].bDescriptorType: 4h6 S& K) s& z: w2 s9 a3 {  d% Q
Itf_Desc[0].bInterfaceNumber: 0h
5 Y  N* a" p7 U  }2 RItf_Desc[0].bAlternateSetting: 0h
* X% b8 t' c0 s( `' m' }Itf_Desc[0].bNumEndpoints: 1h
. y( v3 p+ _, \: {2 xItf_Desc[0].bInterfaceClass: 3h/ K. d$ l$ U/ T, |+ h0 x
Itf_Desc[0].bInterfaceSubClass: 1h
2 P% R8 Q* X* {: L, UItf_Desc[0].bInterfaceProtocol: 2h
* w+ c3 T, r6 d' ]0 j( r5 f4 w$ v# wItf_Desc[0].iInterface: 0h3 L/ q9 [' ~& f# @- p0 G
Itf_Desc[0].Ep_Desc.bLength: 7h8 |; b) @% x( E( K( w+ T
Itf_Desc[0].Ep_Desc.bDescriptorType: 5h5 S6 u: N* q5 n; [4 f0 ~; }% t
Itf_Desc[0].Ep_Desc.bEndpointAddress: 81h+ o* i5 h5 a% d" h. ]! Z% I$ j7 m
Itf_Desc[0].Ep_Desc.bmAttributes: 3h1 L  n1 L' i2 E. k3 I, z& i
Itf_Desc[0].Ep_Desc.wMaxPacketSize: 40h4 {. u0 V' Y5 f: b9 ]/ E
Itf_Desc[0].Ep_Desc.bInterval: 2h" n, c" B  `# |1 W  G

! E: |# V* S+ V1 k3 |8 E7 B3 LItf_Desc[1].bLength: 9h
; |1 A$ Z* g, zItf_Desc[1].bDescriptorType: 4h; b/ [9 P( U* Z4 K
Itf_Desc[1].bInterfaceNumber: 1h8 H2 k; b7 S2 n
Itf_Desc[1].bAlternateSetting: 0h% J: F: ^. C, x+ A& t
Itf_Desc[1].bNumEndpoints: 1h# @: g7 ?# G7 U& K
Itf_Desc[1].bInterfaceClass: 3h
3 F! n. p0 L8 K5 fItf_Desc[1].bInterfaceSubClass: 1h
; g" z* b3 ?4 p+ X/ a% e6 ~Itf_Desc[1].bInterfaceProtocol: 2h
% `% s3 h  V: ?) E! d4 y# tItf_Desc[1].iInterface: 0h, h2 m+ D0 C. o
Itf_Desc[1].Ep_Desc.bLength: 7h
" _; g& G+ J6 i( ?# j) S0 Z/ QItf_Desc[1].Ep_Desc.bDescriptorType: 5h
; G) V9 j' M) ~' V& HItf_Desc[1].Ep_Desc.bEndpointAddress: 82h
3 ?+ \) ^6 w+ N1 m4 ]! k0 LItf_Desc[1].Ep_Desc.bmAttributes: 3h! t+ {4 i+ o  S! \% n# O
Itf_Desc[1].Ep_Desc.wMaxPacketSize: 10h; g8 E5 `" X1 l+ h/ l
Itf_Desc[1].Ep_Desc.bInterval: 2h5 S' d! I9 n; x- X' c
Manufacturer : GAOMON
' Z7 ]& N$ ^( j- uProduct : Gaomon Tablet" _/ m8 L6 I9 R. e
Serial Number : 6 J. |2 Q* i% p2 m/ n. f% @
Enumeration done.' ^7 e7 D5 c& S
This device has only 1 configuration.5 b. O$ @+ q9 F5 o; B6 k) V
Default configuration set.! ^4 G! K8 ?! e( {" E( M" {8 s
Device remote wakeup enabled" `4 V' o9 W! l* ]/ K
interface;0( I# t0 \& V0 U& ]
Switching to Interface (#0)
& Q( ^5 n. \0 ~  y6 mClass    : 3h' I( M6 E0 F! v2 I
SubClass : 1h
$ \4 |2 t; c* @" Z4 R* QProtocol : 2h  K; L; z) O5 f$ m8 b
Mouse device found!
9 r1 ?* K$ S' _1 }. s* b+ h4 jHID class started.
4 t. S3 s0 V% j! ^* S, m% f  ^, ^# MHID_Handle->HID_Desc.bLength:9h
8 H3 C1 X4 A) j9 d/ j4 c& b0 G( P  UHID_Handle->HID_Desc.bDescriptorType:21h
. p' e, N5 V0 s; n; kHID_Handle->HID_Desc.bcdHID:111h$ N+ J7 M4 ~1 I0 G
HID_Handle->HID_Desc.bCountryCode:0h
/ O0 T4 [6 P: m( |9 [* PHID_Handle->HID_Desc.bNumDescriptors:1h
# y+ q4 O& i. M9 X! \' U0 `HID_Handle->HID_Desc.bReportDescriptorType:22h" h$ p+ P4 C/ n% F5 C* A
HID_Handle->HID_Desc.wItemLength:12h1 F6 p0 R1 g' _. X% ?8 c7 f
报告描述符如下:/ j4 G6 y: L$ b& @+ O9 x2 g2 r
0x06 0x00 0xff
5 N4 W; q8 D# E4 z: `0 N0x09 0x01 1 {4 p3 E. E" @/ @, ^# Q* I
0xa1 0x01 5 e2 `- g1 I, a  n9 v$ K; z- Y6 ?
0x85 0x08
1 Z9 h+ w! r) U# y- J0x75 0x58
4 J7 q1 Y  ~0 ?- w0x95 0x01 ' a, d& K2 k- a  n4 G: n
0x09 0x01 8 S4 X$ G+ N5 S( m% X
0x81 0x02 3 E4 O$ I+ d( n2 W+ k
0xc0 0xff
. r) x- X% b9 [: U" k# S9 U# ?0 h( P; N; q  C1 ?  `0 g0 v

, }" F( [" t7 _8 C2、函数  status = USBH_HID_GetReport(phost, 0x01U, 0U, HID_Handle->pData, (uint8_t)HID_Handle->length);  返回的一直是USBH_BUSY
# \& _$ c6 d, V3 _& o7 J9 a- ~3 L8 P+ h: I
3、设备有两个接口描述符,STM32的USB_LIb不支持两个接口的设备?
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版