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

【实战经验】HID与音频冲突问题

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言5 D) ?& N) H2 S0 s  Q
Demo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。
: E4 ^' T& |8 B' q9 h. r1 m6 c% X5 w* v
根本原因' h3 L3 ~6 z& Q0 Y' z/ w. E+ {+ m
6 M; J3 b/ O2 Y) S) N4 n0 g) T
基本情况:
$ R6 {3 @2 O4 _& t             1. 当增加HID 的传输频率时,这种情况更容易出现。
/ ]( a, q3 p: b2 Y/ b3 q             2. 当HID 包在帧开始时,不会出现这个问题。
% D- u; H: U( L; ?. U根本原因是相关的参考手册中描述的一个已知的问题。# p( X) }" a% _2 ~" }0 a! q
                      35.13.8 Worst case response time
& I: V2 x; w' v8 m- ^                      When the OTG_HS controller acts as a device, there is a worst case response time for any
3 q+ S/ D  J, _                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB
3 P/ y) z. q  ^9 K3 a/ v                      clock frequency.; ]& i' q7 d8 ]9 ], F
                      The core registers are in the AHB domain, and the core does not accept another token9 P$ o2 U6 X% h: U- y
                      before updating these register values. The worst case is for any token following an* }- X+ P4 F2 ~8 M: e
                      isochronous OUT, because for an isochronous transaction, there is no handshake and the
( N4 {3 z1 m- k3 Y/ x4 ^                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock
0 v- ], u$ Z0 e( k, V                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.. M( H- d) `9 u. c  M
                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK* i- u; k, l$ a+ w2 ?9 ^( t
                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition
7 N- U+ L" ~, K# v1 l                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete1 {  L9 h) c2 t4 ?4 y7 v/ z
                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer8 X7 t9 }% `! Q% w. \# }
                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were# E/ t2 h) z% e! _' `1 u2 h
                     dropped." ]* i/ ]  U6 Y6 {. a0 O
因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。
0 I# F1 l: |  ?; n1 [. j4 i* b' J* Q, L) T: n2 X

7 Y. C) b1 Q; e( c$ G解决方案:
3 a0 H% F( K( ~- n  E* p              1. 在帧开始的时候发送数据。
' j# h8 |9 N5 w; B" }) i              2. 在帧80%,85%,90%,95%时发送数据。通过设置. Y/ ]3 C% i/ T$ J
              #define DCFG_FRAME_INTERVAL_80                        0
$ _3 b8 _  h- t. v) a              #define DCFG_FRAME_INTERVAL_85                        1
; A3 @+ b0 T; K$ @              #define DCFG_FRAME_INTERVAL_90                        2
8 l, Q; m9 @7 W3 L. V- D9 ]* u              #define DCFG_FRAME_INTERVAL_95                        3  
7 X- K4 O$ g8 n2 k+ x+ h
0 n5 |8 ?% b# y7 [+ ~              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;( E, G" P( N1 E
8 q* q5 o0 Y" U% u
7 Z8 i6 W7 K% g+ e
             RM0090; U6 t. R% T/ i( s! G
              34.16.4 Device-mode registers
1 @& Y& y( g( p7 l; K6 I9 n' D              OTG_FS device configuration register (OTG_FS_DCFG)
3 m, D$ n' i: W) i$ N
/ `; Q6 e7 U  F) L                     Bits 12:11 PFIVL: Periodic frame interval1 K, f* D: ?; Q% v$ u/ O
                     Indicates the time within a frame at which the application must be notified using2 z* `+ o3 w1 H. Q0 ~
                     the end of
7 |- j' q/ z/ t$ [                     periodic frame interrupt. This can be used to determine if all the isochronous
1 u. X4 ]6 |4 n0 u) c7 B                     traffic for that
6 y: V( H+ J1 u' w2 [# p                     frame is complete.4 v/ L' C/ e) d1 g
                     00: 80% of the frame interval$ O1 e3 j- ]  {) F6 m0 ^3 s' B
                     01: 85% of the frame interval2 Y6 R, \+ ]3 X  s' j
                     10: 90% of the frame interval) H: [; b- I9 n2 ^2 M( n2 u
                     11: 95% of the frame interval

! H; M" S# Z! ?/ r; J+ t8 N; ^. `  S( Z) K; ]
2 t8 z. U: P: a) E. o" @
HID与音频冲突问题.pdf (74.99 KB, 下载次数: 18)
赞 1 收藏 1 评论2 发布时间:2016-11-18 16:30

举报

2个回答
feixiang20 回答时间:2017-7-1 21:45:03
这些实验的视频介绍比较重要
小白小灰 回答时间:2025-1-15 08:11:56
我也出现这个问题,文章里的处理方法是有 otg 设备的,我的是 stm32f103c8t6,没有 otg,有什么其他解决方法吗?
" O! v. ]5 p' s& ]1 y

所属标签

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版