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

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

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言
: m+ b- G' r9 C2 }: b# pDemo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。
$ r  t, x6 L# K# M& m& O+ u) M( A9 n, ^$ g; p  W, a  n
根本原因
  s$ m$ Z4 b# p* u3 n3 u& E, R& h) m4 j
基本情况:
2 x; T* D" m3 v* P, |             1. 当增加HID 的传输频率时,这种情况更容易出现。( y' T/ `6 O9 l/ X- T# T9 G
             2. 当HID 包在帧开始时,不会出现这个问题。0 c: I5 l1 {7 T% ^1 \
根本原因是相关的参考手册中描述的一个已知的问题。" Y8 q+ v& E( s  F1 |
                      35.13.8 Worst case response time
6 f5 P& ]. ?% L: Q1 _                      When the OTG_HS controller acts as a device, there is a worst case response time for any" m- X# _5 a$ x. b, p* _
                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB+ h; n; r* |- _1 f
                      clock frequency.
% i" _% Z4 D1 W) }2 V: {5 C                      The core registers are in the AHB domain, and the core does not accept another token+ P" g9 q- v- F
                      before updating these register values. The worst case is for any token following an5 R# H* e# F- @- k$ o$ E
                      isochronous OUT, because for an isochronous transaction, there is no handshake and the4 K' O# }# P% X. B) b1 b
                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock8 N& m  ?3 Q" d  u4 {5 M! K$ Z1 k' M  X
                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.3 J) ?( O3 W7 ^9 x0 R
                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK1 p0 b+ L  x% C, f! l5 S; b5 z  p8 u
                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition9 D5 {) d8 L: s- s" L% r
                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete- ?5 o& l- d9 n4 _/ E1 P" i
                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer, |! }# Z# n2 ^" ~+ S9 `
                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were/ u, g, e! @% V$ o
                     dropped.
  Y$ A# M" v  j, r因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。; _" x- p7 e1 E% b4 Y
% P. f% V" g5 r/ i- G# p2 [7 J

/ ~) G; B& L% g, @8 ]解决方案:1 U. B! G& T" ^* _
              1. 在帧开始的时候发送数据。# W' {  _4 R, k# C5 W! R
              2. 在帧80%,85%,90%,95%时发送数据。通过设置
1 z, h7 \1 ]7 H" h              #define DCFG_FRAME_INTERVAL_80                        0
$ A+ }3 `+ G8 b1 P- ?& A, S, B1 ^              #define DCFG_FRAME_INTERVAL_85                        1
. N) w( M/ U+ o, h; W& ^              #define DCFG_FRAME_INTERVAL_90                        2& z1 ~% w. V# C' C
              #define DCFG_FRAME_INTERVAL_95                        3  3 R4 q$ h2 [% g2 B3 T) R1 F

* e) Y; z, k; S2 [1 e  E. k% g              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;
) x# |8 y# x2 u$ B/ F6 v
* u: Z  ^/ J1 k9 r% l* M' G
6 E2 q: M0 p1 S; Q0 _* l4 q             RM0090
1 c8 ]. |0 U9 j1 d# B& X& C              34.16.4 Device-mode registers
( u! P0 B( l7 u: m              OTG_FS device configuration register (OTG_FS_DCFG)/ k. A: p2 c7 P4 ]6 _0 G9 t0 k

5 i* g$ l) ]0 W0 ^, a6 @) Y1 z( Y6 f                     Bits 12:11 PFIVL: Periodic frame interval* G; G5 V4 Z- S7 \2 G4 @$ M
                     Indicates the time within a frame at which the application must be notified using! j: ]: I" Z7 T" |. r
                     the end of
, z# e9 y" l1 g3 H                     periodic frame interrupt. This can be used to determine if all the isochronous
% A; ^2 B9 T2 U                     traffic for that9 p7 \, {: j6 D, ^/ s
                     frame is complete.
5 B2 \7 h4 q% s5 w5 K3 R/ i5 s7 }                     00: 80% of the frame interval
" V- _' o* U2 V1 l$ L& F                     01: 85% of the frame interval
; j) E1 V; I6 j5 q$ }) p" O" e+ J                     10: 90% of the frame interval
% a( x5 f' c) Z" H/ t                     11: 95% of the frame interval
' ~: Y0 l; S( w  I9 D
7 q) @: T. D! n7 M1 {( x8 [  H) ]

2 D, ^, |% u& B; X 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 `4 \" o" M; Z" E3 M- P. W

所属标签

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版