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

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

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言/ S* e1 t) w7 ], e5 M6 D/ a6 O* s
Demo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。, [; E: ?! r& c* r9 S9 t9 c

5 r0 k# E( w- C; y7 O  @/ F根本原因
- a/ x3 y! B3 W/ q
. _& p# e; q5 `$ b' H基本情况:
7 H6 e1 e. U+ d& Q( c  @% F! u: U* o( ^             1. 当增加HID 的传输频率时,这种情况更容易出现。
6 N3 u3 |7 z! ^- o  f             2. 当HID 包在帧开始时,不会出现这个问题。
7 t5 J; P! m0 I" P3 R- s根本原因是相关的参考手册中描述的一个已知的问题。
; U8 B2 _) E7 c) n5 c2 M  I                      35.13.8 Worst case response time
  @8 G4 b' `6 z# Q                      When the OTG_HS controller acts as a device, there is a worst case response time for any- z' r7 @4 s/ X" E5 T7 I
                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB
2 I# t- z% a# L3 o                      clock frequency.
' ?4 M# D$ w% B) _9 v& e                      The core registers are in the AHB domain, and the core does not accept another token5 [3 d. q& [$ r
                      before updating these register values. The worst case is for any token following an
( Y' V6 g  P; W/ i                      isochronous OUT, because for an isochronous transaction, there is no handshake and the
1 t5 m4 K: S+ a" t: K3 h                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock# I1 K* F0 _* v; u
                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.
- Y) O2 R/ u+ _" l4 p  V# O                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK* ?+ C6 s+ L( \, P/ \
                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition" P3 R- U* O' g6 }+ {# l3 r) ?
                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete
9 u. Z: B5 G2 _; Q% i: s                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer3 E+ X. p) u  N& Z+ w$ |/ |/ P
                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were
* L' s" x' A" k, W1 b8 @                     dropped.) ?% t  r2 G/ G& q4 I+ o) R
因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。
. |+ u3 ~+ Y) u' n& o: d( K2 V/ s! S
8 A; k6 z3 e1 r1 S3 o' n+ p# Q) Z
解决方案:3 Y. }3 k9 U  ?* y) T8 T
              1. 在帧开始的时候发送数据。$ _3 \1 B* l  A. m0 D
              2. 在帧80%,85%,90%,95%时发送数据。通过设置$ O1 c' @# O" R) ^3 P) d
              #define DCFG_FRAME_INTERVAL_80                        0- n; q& a; [* {5 c* N0 e
              #define DCFG_FRAME_INTERVAL_85                        13 k* W* m# Z: K
              #define DCFG_FRAME_INTERVAL_90                        2+ j' I: v5 s- d2 P
              #define DCFG_FRAME_INTERVAL_95                        3  
6 \6 O4 V$ G' X" I1 }
3 k1 @+ k: d, Y8 v              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;
8 [1 D/ ?3 [/ k, k. [( X* E0 G7 F9 G9 y8 v4 E' n  R

6 y3 _/ S) t: M! o             RM0090+ ~0 T% b# O5 m" g" i5 t
              34.16.4 Device-mode registers
+ ?/ g0 D! j; D9 J              OTG_FS device configuration register (OTG_FS_DCFG)
" z# X; S+ S6 Z: N2 i* q4 M6 A& d! q% x, \2 I2 x2 X/ L! U' M
                     Bits 12:11 PFIVL: Periodic frame interval1 [3 Y; @& D. k+ Z0 ~: ^
                     Indicates the time within a frame at which the application must be notified using  I& c$ `* B! i7 \+ H
                     the end of
# b. @+ W) U! Q4 E& T7 |                     periodic frame interrupt. This can be used to determine if all the isochronous
9 H, w8 H& m: y" W# Q                     traffic for that
; g: S' W4 B' m1 ]2 h; Y! @                     frame is complete.
& ]5 I2 m: ]" Y/ U9 }                     00: 80% of the frame interval
) ?) t3 b* f7 Z  E                     01: 85% of the frame interval
- T! X# z  O8 w1 _: e& X; ~                     10: 90% of the frame interval0 {# k. W- N' M5 `. _& _. ]
                     11: 95% of the frame interval
2 j' W  H. S8 R6 o
* s! r+ Q4 X) O4 ^+ B5 f" F# {$ Y

" \' U  a3 z" z6 m' `! _' s 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,有什么其他解决方法吗?
3 m4 A" e6 h* W. e8 R
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版