/**
@page USBD_AUDIO USB Device Audio device example
@verbatim
******************** (C) COPYRIGHT 2012 STMicroelectronics *******************
* @file readme.txt
* @author MCD Application Team
* @version V1.1.0
* @date 19-March-2012
* @brief Description of the USB Device Audio device example
******************************************************************************
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the Licens
*
******************************************************************************
@endverbatim
@par Example Description
The Audio device example allows device to communicate with host (PC) as USB Speaker
using isochronous pipe for audio data transfer along with some control commands (i.e.
Mute).
It follows the "Universal Serial Bus Device Class Definition for Audio Devices
Release 1.0 March 18, 1998" defined by the USB Implementers Forum for reprogramming
an application through USB-FS-Device.
Following this specification, it is possible to manage only Full Speed USB mode
(High Speed is not supported).
This class is natively supported by most Operating Systems (no need for specific
driver setup).
This example uses the I2S interface to stream audio data from USB Host to the audio
codec implemented on the evaluation board. Then audio stream is output to the
Headphone or on-board Speaker depending on the user selection:
- On STM322xG-EVAL or STM324xG-EVAL, the Headphone is selected as output by default.
When pushing Key button the output is switched to Speaker (or to Headphone if the
current output is the Speaker).
- On STM3210C-EVAL, the default state is Automatic detection; when the Headphone
is plugged on it is used as output, and when it is unplugged, output automatically
switches to Speaker. When pushing Key button, the automatic detection is disabled
and only the output set by the Key command is configured (Headphone or Speaker).
For this board, it possible to use one of the two quartz belwo:
- 14.7456MHz which provides best audio quality
- Standard 25MHz which provides lesser quality. When this quartz is used:
- If audio frequency is set to 16Khz (define "USBD_AUDIO_FREQ" in usbd_conf.h)
then the quality on the headphone is better than the quality on the speaker.
- If audio frequency is set to 48KHz then the quality on the speaker is better
but quality on headphone is degraded.
This is due to limited range of input frequencies on the CS43L22 codec combined
with lack of precision when 25MHz quartz is used to generate audio frequency.
The device supports one audio frequency (the host driver manages the sampling rate
conversion from original audio file sampling rate to the sampling rate supported
by the device). It is possible to configure this audio frequency by modifying the
usbd_conf.h file (define USBD_AUDIO_FREQ). It is advised to set high frequencies
to guarantee a high audio quality.
It is also possible to modify the default volume through define DEFAULT_VOLUME in file
usbd_conf.h.
@note The Key push button allows to switch (on the fly) between Headphone and Speaker
outputs.
@note The audio frequencies leading to non integer number of data (44.1KHz, 22.05KHz,
11.025KHz...) will not allow an optimum audio quality since one data will be lost
every two/more frames.
This example works
- in full speed (FS) when the STM322xG-EVAL or the STM324xG-EVAL board and the
USB OTG FS peripheral are used, or when using the STM3210C-EVAL board.
@par Hardware and Software environment
- This example runs on STM32F105/7 Connectivity line, STM32F2xx and STM32F4xx devices.
- This example has been tested with STM3210C-EVAL RevB (STM32F105/7 devices),
STM322xG-EVAL RevB (STM32F2xx) and STM324xG-EVAL RevB (STM32F4xx)
- STM3210C-EVAL Set-up
- Use CN2 connector to connect the board to a PC host
- STM322xG-EVAL Set-up
- Use CN8 connector to connect the board to a PC host when using USB OTG FS peripheral
- STM324xG-EVAL Set-up
- Use CN8 connector to connect the board to a PC host when using USB OTG FS peripheral
@par How to use it ?
+ EWARM
- Open the usbd_audio.eww workspace.
- In the workspace toolbar select the project config:
- STM322xG-EVAL_USBD-FS: to configure the project for STM32F2xx devices and use USB OTG FS peripheral
- STM324xG-EVAL_USBD-FS: to configure the project for STM32F4xx devices and use USB OTG FS peripheral
- STM3210C-EVAL_USBD-FS_25MHz: to configure the project for STM32F105/7 devices with 25 MHz external quartz
- STM3210C-EVAL_USBD-FS_14745600Hz: to configure the project for STM32F105/7 devices with 14.7456 MHz external quartz
- Rebuild all files: Project->Rebuild all
- Load project image: Project->Debug
- Run program: Debug->Go(F5)
+ MDK-ARM
- Open the usbd_audio.uvproj project
- In the build toolbar select the project config:
- STM322xG-EVAL_USBD-FS: to configure the project for STM32F2xx devices and use USB OTG FS peripheral
- STM324xG-EVAL_USBD-FS: to configure the project for STM32F4xx devices and use USB OTG FS peripheral
- STM3210C-EVAL_USBD-FS_25MHz: to configure the project for STM32F105/7 devices with 25 MHz external quartz
- STM3210C-EVAL_USBD-FS_14745600Hz: to configure the project for STM32F105/7 devices with 14.7456 MHz external quartz
- Rebuild all files: Project->Rebuild all target files
- Load project image: Debug->Start/Stop Debug Session
- Run program: Debug->Run (F5)
+ RIDE
- Open the usbd_audio.rprj project.
- In the configuration toolbar(Project->properties) select the project config:
- STM322xG-EVAL_USBD-FS: to configure the project for STM32F2xx devices and use USB OTG FS peripheral
- STM324xG-EVAL_USBD-FS: to configure the project for STM32F4xx devices and use USB OTG FS peripheral
- STM3210C-EVAL_USBD-FS_25MHz: to configure the project for STM32F105/7 devices with 25 MHz external quartz
- STM3210C-EVAL_USBD-FS_14745600Hz: to configure the project for STM32F105/7 devices with 14.7456 MHz external quartz
- Rebuild all files: Project->build project
- Load project image: Debug->start(ctrl+D)
- Run program: Debug->Run(ctrl+F9)
+ TASKING
- Open TASKING toolchain.
- Click on File->Import, select General->'Existing Projects into Workspace'
and then click "Next".
- Browse to TASKING workspace directory and select the project:
- STM322xG-EVAL_USBD-FS: to configure the project for STM32F2xx devices and use USB OTG FS peripheral
- STM324xG-EVAL_USBD-FS: to configure the project for STM32F4xx devices and use USB OTG FS peripheral
- STM3210C-EVAL_USBD-FS_25MHz: to configure the project for STM32F105/7 devices with 25 MHz external quartz
- STM3210C-EVAL_USBD-FS_14745600Hz: to configure the project for STM32F105/7 devices with 14.7456 MHz external quartz
- Rebuild all project files: Select the project in the "Project explorer"
window then click on Project->build project menu.
- Run program: Select the project in the "Project explorer" window then click
Run->Debug (F11)
+ TrueSTUDIO
- Open the TrueSTUDIO toolchain.
- Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace
directory.
- Click on File->Import, select General->'Existing Projects into W
hakesashou
- 粉丝: 7235
- 资源: 1725
最新资源
- 资源名称不得少于十一字
- PXI 429总线卡 航空总线卡 底板板+功能子卡结构 底板原理图+PCB 子卡原理图+PCB FPGA源代码(EP3C40F484) 如需要,详谈
- JDWT01 220 台,高精度称重模块,rs485通讯,支持多种通讯格式,采用g24位ad7190转模块,内码高达1000w,精度可达2w分之一 提供海为pLc标定程序 JDWT01-A 160
- 重庆大学Python课程试题解析与核心知识点汇总
- MATLAB代码:基于两阶段鲁棒优化算法的微网电源容量优化配置 关键词:容量优化配置 微网 两阶段鲁棒规划 仿真平台:MATLAB YALMIP+CPLEX 主要内容:代码主要做的是一个微网中电源
- jmeter学习笔记,基础知识,实用
- 正弦余弦指引的乌鸦搜索算法Matlab代码 1肖子雅,刘升,韩斐斐于建芳正弦余弦指引的乌鸦搜索算法研究J.计算机工程与应用,2019,55(21):52-59. 乌鸦搜索算法模拟乌鸦觅食行为对
- SVPWM算法的simulink实现 有两种,分别是只simulink的和基于s-fun函数的,附代码 默认matlab2018b
- 西门子PLC程序大型项目,siemens博途V16 V17版,配方处理程序,多个昆仑通态触摸屏配方,ScL语言,485通讯控制变频器,模拟量压力处理,多个1200cpu处理,称重数据读取
- electron rtmp桌面推流客户端
- 一个使用 JavaScript 结合 HTML 和 CSS 创建一个出租车计价器界面及实现计价功能的源码
- 串口调试助手软件,socket通信调试助手软件 很好用的两个助手软件功能强大,侦测,拦截,逆向分析串口通汛协议,是RS232 422 485串行端口的专业工貝软件
- dfajkfghdjk s12m code
- 微电网 孤岛 孤岛并网切 并网 三种模式 考虑风光储 储能环节可以根据孤岛并网模式在PQ 和VF模式两环节切 考虑蓄电池和超级电容混合储能 超级电容提供高频分量 附各个环节讲解说明 模型可塑
- 两级式光伏并网逆变器,DCDC环节采用boost电路,通过增量电导法实现光伏最大功率跟踪MPPT 逆变器采用二电平逆变器,通过双闭环控制,实现并网单位功率因数,并网电流与电网电压同相位,并网电流TH
- MATLAB simiulink永磁直驱风力发电系统, 机侧网侧均使用为SVPWM矢量控制算法,参数调节均已完成,直接运行即可,可供初学者学习 (1)采用 SVPWM 矢量控制; (2)采用转速、电
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈