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

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

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言3 y; f* G1 d. g( w0 N5 ?4 x3 w
Demo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。" c" D9 O, l' \/ B# }! C' F8 V

0 C- ~9 z4 Q& a5 E% w根本原因
9 [5 O/ H! {* V6 j8 Q9 G
7 \8 ~& D( ^4 B7 \  E/ r基本情况:& s7 s( q+ m0 @. q- Q$ D( ~
             1. 当增加HID 的传输频率时,这种情况更容易出现。
% _& j4 h/ {1 z$ C! c             2. 当HID 包在帧开始时,不会出现这个问题。
! i( z6 t6 I0 M- r' v6 K根本原因是相关的参考手册中描述的一个已知的问题。( Z5 ^) h; _3 G
                      35.13.8 Worst case response time  \+ ^3 E! {( Q0 Q
                      When the OTG_HS controller acts as a device, there is a worst case response time for any) z  p# R7 g" S3 F- _+ h/ Q
                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB
! u; {4 H8 R2 a  _9 K1 E; K2 q0 [                      clock frequency.2 X1 b) X: h4 D6 ]
                      The core registers are in the AHB domain, and the core does not accept another token
: N0 `  {' ^9 g- s, ^+ ^                      before updating these register values. The worst case is for any token following an
- `0 F. }6 }3 }# o1 t4 H                      isochronous OUT, because for an isochronous transaction, there is no handshake and the" q: v2 t  M* c3 F  a6 r3 ?1 m
                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock
0 j  K& n! r5 O4 ^                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.
5 h. s, X/ Q4 {                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK5 t% N2 W1 z& u1 n, B7 ~
                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition+ C4 g  i% o; A
                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete- k' e* o! g9 S8 N) e! C
                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer
% _) f. |+ r6 w- W                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were. i) E1 y; V5 a1 y# G
                     dropped.
3 X2 {; E+ D, O6 n8 ?2 ]$ w因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。
3 h. ?+ ?4 F( N5 n% g$ n: P; m/ b' ?  Z- p1 ]+ ~. Z) _
: {& P" E( _! @; o& x- l1 |( h- ?4 ?! |
解决方案:/ R% s! @1 N/ ^8 h+ B
              1. 在帧开始的时候发送数据。+ I+ i+ B' U( l. a4 `; r
              2. 在帧80%,85%,90%,95%时发送数据。通过设置
- D/ l0 m- W4 d" B1 R3 {& q9 F              #define DCFG_FRAME_INTERVAL_80                        0
; i7 m5 p* g8 \              #define DCFG_FRAME_INTERVAL_85                        1& n* r2 ?  [4 I
              #define DCFG_FRAME_INTERVAL_90                        2$ ^  @& r/ Z# ?( h: a' o
              #define DCFG_FRAME_INTERVAL_95                        3  
8 E) e. \# Y1 p7 ~
! ^# @" A: X1 V% E+ k: L. u5 V* [: q& G              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;
# t2 c# [3 s4 D0 d% m/ S' C+ F
( j3 r/ ?( L5 ^# Q
% J, b6 }; g; z             RM0090
# E: L( ]" v$ o3 D0 M              34.16.4 Device-mode registers
$ Q9 n7 |# d& d5 p# K% w5 Z: h' s              OTG_FS device configuration register (OTG_FS_DCFG)
5 s- W/ T+ Q  D& R# P, ], \1 t, ?  ]& v; G/ Z
                     Bits 12:11 PFIVL: Periodic frame interval' \/ r" {0 D$ P  }' f# Q
                     Indicates the time within a frame at which the application must be notified using
6 i* T; A. i1 Z$ N) `: W2 b                     the end of9 e+ K( E, c3 H
                     periodic frame interrupt. This can be used to determine if all the isochronous9 |( A2 K, m0 t$ a/ {9 {
                     traffic for that
* E  C9 r/ T3 B* P                     frame is complete.% L6 R4 B3 `- d) }" \0 [) P0 _
                     00: 80% of the frame interval# `# A4 v9 _+ k. j* `* e0 y( Z
                     01: 85% of the frame interval' t) j$ f: O0 D  h; p: c# W
                     10: 90% of the frame interval) `' g2 n- ]9 P! A9 _* w  H3 q* ~
                     11: 95% of the frame interval
/ m3 e+ e) a) x
% A4 `8 H. z9 _/ \# J, K

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