16Khz音频定时触发采样DMA存储过程
一、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溢出,并设置URS=0,UDIS=0=>使能UEV event (不需配置更新中断);
2、设置MMS[2:0]=010
Update - The update event is selected as trigger output (TRGO).
3、使能TIM
OK!
注:
1、相应Clk需Enable;
2、DMA的buf满了之后会触发中断,从中获取数据;
16Khz音频定时触发采样DMA存储过程的更多相关文章
- mysql 触发器和存储过程组合使用,实现定时触发操作
mysql可以实现定时触发功能,比如说定于某某时间mysql数据库做什么工作,或每隔多长时间做什么工作. 第二种情况应用还是比较广的,比如说我希望每天检查一下我的数据信息,超过一个月的无用信息清除以腾 ...
- 【STM32H7教程】第60章 STM32H7的DAC应用之定时器触发实现DMA方式双通道波形
完整教程下载地址:http://www.armbbs.cn/forum.php?mod=viewthread&tid=86980 第60章 STM32H7的DAC应用之定时器触发实 ...
- 在Salesforce中创建Schedule的Job去定时触发对应的Class
在Salesforce中也存在着Job的概念,当然了我们可以创建Schedule的Job去定时触发对应的Class,来完成我们所需要定时处理的功能,比如:定时同步数据. 具体处理步骤如下所示: 1): ...
- linux 下crontab相关定时触发的配置规则
linux 下crontab相关定时触发的配置规则: 1.基本格式 :* * * * * command(分 时 日 月 周 命令)2.取值范围:分钟1-59 每分钟用*或者 */1表示小时1-23( ...
- SQL server 定时自动执行SQL存储过程
当一个存储过程是为了生成报表,并且是周期性的,则不需要人工干预,由SQL作业定时自动执行些SQL存储过程即可. 本示例,假设已需要定时执行的存储过程为:Pr_test 工具/原料 SQL Server ...
- mysql视图、触发事务、存储过程
视图 视图是一个虚拟表(非真实存在的),其本质就是根据SQL语言获取动态的数据集,并为其命名,用户使用时只需要使用名称即可获得结果集,可以将结果集当做表来使用. 视图是存在数据库中的,如果我们程序中使 ...
- 在pgsql库用触发器自动触发PostgreSQL的存储过程,实现插入。
需求:在对表A 执行 insert操作时,筛选符合条件的数据 insert到表B中,编写为存储过程(postgreSQL数据库) [筛选条件]:1. dd !="A" 或是 dd为 ...
- 如何减轻ajax定时触发对服务器造成的压力和带宽的压力?ajax-长轮训
AJAX长轮询的方法来解决频繁对后台的请求,进一步减小压力 在实现过程发现AJAX的多次请求会出现多线程并发的问题又使用线程同步来解决该问题 个人对ajax长轮询的一点愚见 ajax请示后台时,后台程 ...
- Django 框架中定时触发脚本
方法一: Django搭建的服务器一般都用作WEB网站进行访问,通常的形式是用户访问网站或点击按钮发送请求,Django检测到请求后进行相应的试图函数处理后返回页面给用户. 但是,我们有时会需要有一些 ...
随机推荐
- linux 安装httpd(验证通过)
一.安装apache(http服务) 1. 从apache.org下载源码安装包 2. 解压缩 # tar zxf httpd-2.2.4.tar.gz # cd httpd-2.2.4 3. 安装a ...
- 从源代码上分析ListView的addHeaderView和setAdapter的调用顺序
ListView想要加入headerview的话,就要通过addHeaderView这种方法,然后想要为ListView设置数据的话,就要调用setAdapter方法了.可是,在调用addHeader ...
- phpstorm安装laravel-ide-helper实现自动完成、代码提示和跟踪
本文讲述laravel-ide-helper的安装方法.phpstorm安装了laravel-ide-helper后可以实现代码提示.跟踪和自动补全,减少查看API文档的次数,提高开发效率. lara ...
- AutoCAD 2012安装错误,与.net framework (1603错误)以及ms2005vc++的问题。
首先,这是AutoCAD2012的问题.因为,如果一台计算机已经安装了这些软件,AutoCAD是无法识别出来,因此AutoCAD就只能报错.正确的做法是:如果检测到这些软件已经被安装,则需要忽略这些问 ...
- 使用UDL文件来测试SQL Server数据库连接
原文 来自http://www.2cto.com/database/201308/234427.html 使用UDL测试SQL Server连接问题 做数据库经常会遇到SQL Server连接的问 ...
- Moon.Orm 5.0 (MQL版)
Moon.Orm 5.0 (MQL版) 实战实例Moon.Orm 5.0 革命性的设计 打造最便捷的异步分页技术(提供下载) 摘要: 一.建一个项目(以WebForm为例)配置文件配置(注意您自己的路 ...
- 代码审查 (Google牛人谈Code Review)
代码审查 (Google牛人谈Code Review) 在上一篇博客里我暗示自己将不在为Google工作. 我还没有决定好去哪儿-有几个非常不错的工作机会让我选择.鉴于这段时间内我不受雇于任何公司,我 ...
- TDD中的单元测试
TDD中的单元测试写多少才够? 测试驱动开发(TDD)已经是耳熟能详的名词,既然是测试驱动,那么测试用例代码就要写在开发代码的前面.但是如何写测试用例?写多少测试用例才够?我想大家在实际的操作过程 ...
- 安装dynamics CRM 2013提示“实例名称必须与计算机名称相同”
在安装CRM 2013的时候,最后一步一直提示“实例名称必须与计算机名称相同”. 原因是在安装数据库之后,我更改了计算机名称.因此就导致了可这个错. 在安装数据库的时候,数据库会记住计算机的名称,用 ...
- silverlight中datagrid数据到处excel
首先新建一个DataGrdiExtensions类,代码为: public static class DataGridExtensions { /// <summary> /// 导出dg ...