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

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

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言- G+ t# u+ f1 @  j2 k6 S& m
Demo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。5 E+ W0 W1 \1 j' D
; G$ n" g6 R) \' X" `. T
根本原因
0 d7 O& L) V9 b) T
+ i5 A, x: D0 j2 \2 L6 L基本情况:
: Q* ~! J6 ^/ m0 a+ W6 r! k% ?, B7 b             1. 当增加HID 的传输频率时,这种情况更容易出现。8 v( x0 j8 c- S- _, I( |/ {
             2. 当HID 包在帧开始时,不会出现这个问题。+ Q( {/ x/ ~: `. m: t
根本原因是相关的参考手册中描述的一个已知的问题。6 k+ P% g/ M8 Y7 d/ B& V, A5 X
                      35.13.8 Worst case response time7 }% Z2 {( {% v3 c( e! g% d" y
                      When the OTG_HS controller acts as a device, there is a worst case response time for any
% J) O9 F/ {* @                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB5 @0 u$ [' y3 }: T- a
                      clock frequency.
5 z: Y8 Z* R5 U1 G! \" t                      The core registers are in the AHB domain, and the core does not accept another token
# @3 `- H  h4 n8 s                      before updating these register values. The worst case is for any token following an
: V) \+ Q' X* n! s' h                      isochronous OUT, because for an isochronous transaction, there is no handshake and the
5 a2 u9 x* b4 Z5 V6 F6 m                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock
$ [2 ~- I4 Q1 J; V1 D* }2 k: d                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.0 U4 W9 m7 w3 n1 |# M7 Y
                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK; s/ U- d# K& o' y3 m/ A
                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition
& F5 w2 S. @% C5 u, w- {                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete
7 [% H8 ~+ U, x4 G/ r6 `8 ~                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer5 d/ B  h( G1 {4 L
                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were0 l. J  A2 q  Z/ l" u, b
                     dropped.2 k" W$ V; I* k9 L8 M3 X- M' ^
因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。
" ^: s% ]/ p8 g3 T! W$ R' k$ x. \' J* w2 y8 U/ w
) z. P. ?7 H3 U$ o# B- U! A9 l
解决方案:- a5 q2 S& Y3 E9 n7 S6 N0 X7 x7 x* U
              1. 在帧开始的时候发送数据。+ m- F& A% L2 K0 m2 @
              2. 在帧80%,85%,90%,95%时发送数据。通过设置# [0 K" E8 @% R5 r- H( [$ e, e
              #define DCFG_FRAME_INTERVAL_80                        0
8 J# R' n* |- g5 c              #define DCFG_FRAME_INTERVAL_85                        1
$ U: A: i, C3 @9 q              #define DCFG_FRAME_INTERVAL_90                        2
. w+ |% w2 q; ?0 A$ g              #define DCFG_FRAME_INTERVAL_95                        3  9 K2 K$ U- w# `: l( s8 M% f
- N% G- P) R0 g+ n$ ?- ]: @5 L
              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;$ {# x5 W. I5 b' x  R) U2 C% R

: d  W, b* [* u6 |. f" p2 p9 M
/ f- x  x0 M- R  J, a             RM0090
; m. ~" K# D" H9 e              34.16.4 Device-mode registers
5 `$ |3 c1 e: ^6 P              OTG_FS device configuration register (OTG_FS_DCFG)) [: ~% x6 z% O" A
4 n% R4 t1 f' t, F. x1 K" a
                     Bits 12:11 PFIVL: Periodic frame interval
' M: M0 n2 ?1 F& C1 D, W: _                     Indicates the time within a frame at which the application must be notified using
; G9 J1 z2 _! P8 z6 I; H                     the end of6 q  N8 R3 P% S, a: M
                     periodic frame interrupt. This can be used to determine if all the isochronous- l& U! t3 e% N7 A* t8 R/ x
                     traffic for that% W' X  t- [4 L" `3 G' g
                     frame is complete.
6 Y: U# a# ]/ m- N3 b+ v2 u# E                     00: 80% of the frame interval
$ w) v0 F9 z( g. n2 a                     01: 85% of the frame interval
1 L& k, z# @8 ~9 V  C: ^5 k                     10: 90% of the frame interval
" ]/ G9 R0 v5 E& j                     11: 95% of the frame interval

) t! v4 Q+ {* Z( s! F
  e; U& M: x+ O
1 t! ~2 o" G: D- {
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,有什么其他解决方法吗?
5 j7 v/ e3 W$ g: l' G, w( G; A3 h

所属标签

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