一、AD Setting
1、Calibration (ADCAL)
2、设定ADC Chennel与SCANDIR等,在低功耗应用方案,选择PCLK/4,并设置SMP(tCONV = Sampling time + 12.5 x ADC clock cycles)
3、AD设置为Single conversion mode (CONT=0)
In Single conversion mode, the ADC performs a single sequence of conversions, converting
all the channels once. This mode is selected when CONT=0 in the ADC_CFGR1 register.
Conversion is started by either:
● Setting the ADSTART bit in the ADC_CR register
● Hardware trigger event
Inside the sequence, after each conversion is complete:
● The converted data are stored in the 16-bit ADC_DR register
● The EOC (end of conversion) flag is set
● An interrupt is generated if the EOCIE bit is set
After the sequence of conversions is complete:
● The EOSEQ (end of sequence) flag is set
● An interrupt is generated if the EOSEQIE bit is set
Then the ADC stops until a new external trigger event occurs or the ADSTART bit is set
again.
4、Starting conversions (ADSTART)
Software starts ADC conversions by setting ADSTART=1.
When ADSTART is set, the conversion:
● Starts immediately if EXTEN = 0x0 (software trigger)
● At the next active edge of the selected hardware trigger if EXTEN 0x0
The ADSTART bit is also used to indicate whether an ADC operation is currently ongoing. It
is possible to re-configure the ADC while ADSTART=0, indicating that the ADC is idle.
The ADSTART bit is cleared by hardware:
● In single mode with software trigger (CONT=0, EXTSEL=0x0)
– At any end of conversion sequence (EOSEQ=1)
● In all cases (CONT=x, EXTSEL=x)
– After execution of the ADSTP procedure invoked by software (see
Section 12.4.11: Stopping an ongoing conversion (ADSTP) on page 179.
Note: 1 In continuous mode (CONT=1), the ADSTART bit is not cleared by hardware when the
EOSEQ flag is set because the sequence is automatically relaunched.
2 When hardware trigger is selected in single mode (CONT=0 and EXTSEL 0x00),
ADSTART is not cleared by hardware when the EOSEQ flag is set. This avoids the need for
software having to set the ADSTART bit again and ensures the next trigger event is not
missed.
5、Conversion on external trigger and trigger polarity (EXTSEL,EXTEN)
EXTEN[1:0] =
01 -> rising edge
EXTSEL[2:0] =
100 ->TIM15_TRGO
6、RES设置解析度12bit与数据右对齐方式
7、Managing converted data using the DMA
==> DMAEN=1,DMA circular mode (DMACFG=1)
Since all converted channel values are stored in a single data register, it is efficient to use
DMA when converting more than one channel. This avoids losing the conversion data
results stored in the ADC_DR register.
When DMA mode is enabled (DMAEN bit set to 1 in the ADC_CFGR1 register), a DMA
request is generated after the conversion of each channel. This allows the transfer of the
converted data from the ADC_DR register to the destination location selected by the
software.
二、DMA Setting
The following sequence should be followed to configure a DMA channelx (where x is the
channel number).
1. Set the peripheral register address in the DMA_CPARx register. The data will be
moved from/ to this address to/ from the memory after the peripheral event.
2. Set the memory address in the DMA_CMARx register. The data will be written to or
read from this memory after the peripheral event.
3. Configure the total number of data to be transferred in the DMA_CNDTRx register.
After each peripheral event, this value will be decremented.
4. Configure the channel priority using the PL[1:0] bits in the DMA_CCRx register
5. Configure data transfer direction, circular mode, peripheral & memory incremented
mode, peripheral & memory data size, and interrupt after half and/or full transfer in the
DMA_CCRx register
6. Activate the channel by setting the ENABLE bit in the DMA_CCRx register.
As soon as the channel is enabled, it can serve any DMA request from the peripheral
connected on the channel.
三、TIM SETTING
1、设置TIM15为16Khz触发update中断;
2、设置MMS[2:0]=010
Update - The update event is selected as trigger output (TRGO).
3、使能中断
注:
1、相应Clk需Enable;
2、DMA的buf满了之后会触发中断,从中获取数据;
分享到:
相关推荐
最新单片机仿真 用定时器T1查询方式控制单片机发出1KHz音频最新单片机仿真 用定时器T1查询方式控制单片机发出1KHz音频最新单片机仿真 用定时器T1查询方式控制单片机发出1KHz音频最新单片机仿真 用定时器T1查询方式...
最新单片机仿真 用计数器T1的中断控制蜂鸣器发出1KHz音频最新单片机仿真 用计数器T1的中断控制蜂鸣器发出1KHz音频最新单片机仿真 用计数器T1的中断控制蜂鸣器发出1KHz音频最新单片机仿真 用计数器T1的中断控制蜂鸣器...
16kHz, 16bit, 双通道立体声wav音频文件,用于调试声卡时使用。
音频1KHz测试音源 音频1KHz测试音源 音频1KHz测试音源 音频1KHz测试音源
该资源使用ffmpeg对pcm音频进行重采样(频率变换),目前这个demo能够实现32Khz、44.1khz和48khz之间互相转换正常,对于其他频率还没有测试。如果需要学习参考重采样方面的可以查看我的关于重采样方面的博客
标准20KHz 音频测试文件 人耳听不到哦 要用专业软件观察
调整音频采样率,一般可以将wav格式的各种采样率音频转换成8k采样的^_^-.rar
数字示波器,实现ADC采样,波形显示,fft处理数据,频率计作用
usage: encoder mode PCM_file AMR_file mode : MR475, MR515, MR59, MR67, MR74, MR795, MR102, MR122 :就用MR122 会使用命令行的人都会用,竟然有的人不会用。悲哀
16KHz 17KHz 18KHz 19KHz 20Khz 32bit波形 For objective listening test, with fade-in and fade-out to eliminate cheating. Good for ABX testing high performance audio gears and estimating human ear cut-...
总共包含32个PCM文件,采样位宽为16bit,采样频率为16Khz,声道数为单声道。(都是歌曲,如再见青春,凉凉等)
用MATLAB对 22.05 KHz WAV音频文件进行重采样,采样频率为8KHz,以适应语音通信系统。
44K-1Khz和48K-1Khz音频测试文件,用于测试设备降噪效果
资源包包含单声道、立体声频谱为1KHZ的音频,有MP3和PCM格式,如果需要其他格式的音频可以在mp3的基础上用ffmpeg或其他工具转换,适用于测试喇叭的功率
314-用计数器T1的中断控制蜂鸣器发出1KHz音频(51单片机C语言实例Proteus仿真和代码)314-用计数器T1的中断控制蜂鸣器发出1KHz音频(51单片机C语言实例Proteus仿真和代码)314-用计数器T1的中断控制蜂鸣器发出1KHz音频...
1KHz 10KHz 20Hz 音频0dB测试文件,WAV格式 无损音源测试
音频测试资源,从100Hz到15KHz的都有,做音频相关的必备
CODEC声卡、PA功放,音频输入参数调整用测试音源。有助于对电路问题的分析及测量。本资源为网络下载资源,找了很久才找到便宜的,转发上来,给需要的你。
这个是1KHZ正弦波音频测试文件,方便Debug音频问题。
此文件为c++代码,使用Speex对音频进行重采样,demo中做了48kHz到44.1kHz的转换。