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

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

[复制链接]
zero99 发布时间:2016-11-18 16:30
前言! M% o0 u6 K: c- L9 v# d* O
Demo 程序中,HID 和 Audio 单独运行都不会有问题,把 HID 和 Audio 整合在一起,同进传送数据时,会出现Audio 不能传送数据的情况。9 {3 y4 w# H4 ^# A: @

$ M, q, K$ y, x0 M  U# f  b- D根本原因
4 E: s$ r4 b. [$ W1 k/ ^4 E0 U; c+ U$ Q/ j/ ^8 @) X8 w7 h, n" r% X
基本情况:
/ s% M# s2 u1 L' ?& p! c: N             1. 当增加HID 的传输频率时,这种情况更容易出现。
: y3 i% k5 F9 V             2. 当HID 包在帧开始时,不会出现这个问题。& B% w: O- V7 f4 \4 y
根本原因是相关的参考手册中描述的一个已知的问题。. C/ s2 D+ Y& ?2 E$ h
                      35.13.8 Worst case response time2 `5 Q/ E7 Y& m
                      When the OTG_HS controller acts as a device, there is a worst case response time for any
5 L2 N* K! h' g' h6 B" U6 W2 I                      tokens that follow an isochronous OUT. This worst case response time depends on the AHB
) {; t* b: R2 {& j/ D                      clock frequency.  f( g4 T1 \' l1 j/ t* l& @
                      The core registers are in the AHB domain, and the core does not accept another token
9 R# C( Y2 p1 K9 U4 s; [" w                      before updating these register values. The worst case is for any token following an
7 z) Y7 n2 L7 N                      isochronous OUT, because for an isochronous transaction, there is no handshake and the
# q$ L# W4 @7 \! B9 T                      next token could come sooner. This worst case value is 7 PHY clocks when the AHB clock
2 n/ t9 j+ p7 a                      is the same as the PHY clock. When the AHB clock is faster, this value is smaller.7 T" _) l, r7 C2 J7 R6 {  r) v( S2 G0 H
                      If this worst case condition occurs, the core responds to bulk/interrupt tokens with a NAK
0 m. }9 x( H  s' n                      and drops isochronous and SETUP tokens. The host interprets this as a timeout condition
, s/ K: x8 x. i' B$ M                      for SETUP and retries the SETUP packet. For isochronous transfers, the Incomplete
) i" H0 l; X$ c! r                      isochronous IN transfer interrupt (IISOIXFR) and Incomplete isochronous OUT transfer
+ {. g3 b1 N1 r% d$ K  T% H) H1 \                     interrupt (IISOOXFR) inform the application that isochronous IN/OUT packets were1 G$ J  p# u$ R  U
                     dropped.9 `/ H* ]1 }) N5 b) p
因此,建议在帧开始的时候或帧结束前开始发送HID 数据包。* t  B# g' M! i4 a# n
8 i! K+ \5 |( u& ?6 t

. Y( k' r3 i) }6 |2 R解决方案:
: ~/ S+ V3 ~6 d- `" x" X2 s& g7 n7 q              1. 在帧开始的时候发送数据。8 m1 H5 p6 b6 |8 I7 v6 I
              2. 在帧80%,85%,90%,95%时发送数据。通过设置
2 D+ q+ i  O4 G1 \              #define DCFG_FRAME_INTERVAL_80                        0  j4 M5 k: _3 J1 j3 U# M' ?: J
              #define DCFG_FRAME_INTERVAL_85                        1
* [# |  d1 h) X1 I. f# [              #define DCFG_FRAME_INTERVAL_90                        2
4 f& ~7 G4 z: J' E6 f+ p, N              #define DCFG_FRAME_INTERVAL_95                        3  ( h* u# Q# |4 |3 P

8 R. Y1 [( P1 \              USBx_DEVICE->DCFG |= DCFG_FRAME_INTERVAL_80;
3 M& e& Q% L8 q) a! A1 h
9 o3 R0 a7 J1 N: G% n1 ~  w) i
& D, i4 G( Z, C             RM0090& K; s: X: G, l3 O6 O2 M8 E
              34.16.4 Device-mode registers
" U$ s) U4 E8 I% Y" g# h              OTG_FS device configuration register (OTG_FS_DCFG)
$ X: A" g/ l3 V4 Z/ [6 ]8 a
% Z' X6 Z# ~- J                     Bits 12:11 PFIVL: Periodic frame interval
8 s' ]4 D9 b% X8 `4 `$ z                     Indicates the time within a frame at which the application must be notified using0 g# S3 }! V# v) E& L8 }9 f
                     the end of( V' g1 K6 ]" U) q3 g  F4 l  w
                     periodic frame interrupt. This can be used to determine if all the isochronous- U* h( O# z/ Q( o, H! l
                     traffic for that
* v; w8 Q! \# m8 O- _8 N! K                     frame is complete.
4 j& z7 T6 F( R# B& t; Z                     00: 80% of the frame interval) K5 f3 G8 m& H, v3 o, {
                     01: 85% of the frame interval/ p, c* k+ X1 N7 K2 B$ C  a
                     10: 90% of the frame interval4 j! B+ w2 K& r* G) A
                     11: 95% of the frame interval

3 v. P& j& S: t4 x2 a* h9 w0 w3 t" R

9 t/ X1 @. d( C# t' c+ s, p7 K. Y 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,有什么其他解决方法吗?
# U6 X& |' L6 F2 @3 d) ?

所属标签

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