The Timers can be cascaded to make more complex timing relationships, or longer periods.
Internally only some timers can trigger others.
This is a Master/Slave relationship and is handled by the SMS register.
For example, you can see below that TIM8 can be triggerd by TIM1.
- Uses TRGI to map.
- One Timer can be used as the prescaler for another.
- The first timer update_event, or output_compare signal is used as clock for the second.
- The counter mode sets whether the update_event occurs on overflow and/or underflow of the Timer
- Counter mode is set using the TIMx_CR1 reg and CMS bits as indicated in the example below.
Example for internal trigger
Internal trigger clock mode 1 (ITRx)
TIM_CLK is replaced by ITRx_CLK which is the internal trigger freq mapped to timer Trigger input TRGI.
The counter mode indicates if the update_event is generated:
- on overflow - if mode = up counting, the DIR bit is reset in TIMx_CR1
- on underlfow - if mode = down counting, the DIR bit is set in TIMx_CR1
- both - if mode is center aligned, the CMS bits are non zero
The update_event is also generated by:
- software if the UG bit (Update Generation) is set in TIM_EGR reg.
- update generation through the slave mode controller
refer to Timer app note: DM00042534.pdf
Timer synchronisation
A Master can control a slave Timer using a Trigger TRGO.
A Timer is slaved if its ITRx is connected to a Slave and the Master is set to use TRGO
Trigger outputs from the Master can be selected from:
- Reset:
- UG bit from EGR reg is used as TRGO
- Enable:
- Counter enable is used as TRGO.
- Used to start several timers at the same time or control window for Slave start
- Update:
- the update_event is TRGO.
- e.g. a master timer can act as a prescaler for a slave timer.
- Compare pulse:
- as soon as a capure or match occurs TRGO goes high when CC1IF flag is to be set
- OC1REF: use OC1REF as TRGO
- OC2REF: use OC2REF as TRGO
- OC3REF: use OC3REF as TRGO
- OC4REF: use OC4REF as TRGO
Master mode:
- Configure the Timer
- Select Trigger output to be used
- in CR2 reg - set MSM bits
- Enable Master/slave mode
- in SMCR reg - enable MSM bit
/*
* Trigger select mapping for slave timer from master timer. This is
* unfortunately not very straightforward; there's no tidy way to do this
* algorithmically. To avoid burning memory for a lookup table, use macros to
* compute the offset. This also has the benefit that compilation will fail if
* an unsupported master/slave pairing is used.
*
* Slave Master
* 1 15 2 3 4 (STM32F100 only)
* 2 9 10 3 4
* 3 9 2 11 4
* 4 10 2 3 9
* 9 2 3 10 11 (STM32L15x only)
* --------------------
* ts = 0 1 2 3
*/
#define STM32_TIM_TS_SLAVE_1_MASTER_15 0
#define STM32_TIM_TS_SLAVE_1_MASTER_2 1
#define STM32_TIM_TS_SLAVE_1_MASTER_3 2
#define STM32_TIM_TS_SLAVE_1_MASTER_4 3
#define STM32_TIM_TS_SLAVE_2_MASTER_9 0
#define STM32_TIM_TS_SLAVE_2_MASTER_10 1
#define STM32_TIM_TS_SLAVE_2_MASTER_3 2
#define STM32_TIM_TS_SLAVE_2_MASTER_4 3
#define STM32_TIM_TS_SLAVE_3_MASTER_9 0
#define STM32_TIM_TS_SLAVE_3_MASTER_2 1
#define STM32_TIM_TS_SLAVE_3_MASTER_11 2
#define STM32_TIM_TS_SLAVE_3_MASTER_4 3
#define STM32_TIM_TS_SLAVE_4_MASTER_10 0
#define STM32_TIM_TS_SLAVE_4_MASTER_2 1
#define STM32_TIM_TS_SLAVE_4_MASTER_3 2
#define STM32_TIM_TS_SLAVE_4_MASTER_9 3
#define STM32_TIM_TS_SLAVE_9_MASTER_2 0
#define STM32_TIM_TS_SLAVE_9_MASTER_3 1
#define STM32_TIM_TS_SLAVE_9_MASTER_10 2
#define STM32_TIM_TS_SLAVE_9_MASTER_11 3
STM32F4 Timer Internal Trigger Connection的更多相关文章
-
Stop logging ";internal dummy connection"; in Apache
Apache 2.x keeps child processes alive by creating internal connections which appear in the log file ...
-
解决Apache日志";internal dummy connection";方法
最近查看服务器中apache日志,发现有大量的 OPTIONS * HTTP/1.0" 200 - "-" "Apache (internal dummy co ...
-
STM32F4 Timer simplified block diagram
Timers TIM1 and TIM8 use 16-bit counters and are the most complex timers of all timers included in t ...
-
(STM32F4) Timer Compare mode 操作
Timer 比較模式(compare) 具體會用在哪種狀況目前還沒有這種經驗,但Compare有配置功能pin想必有應用會用到這個模式 從Function Block來看比較模式比基本Timer多了比 ...
-
(STM32F4) Timer 基本操作
Timer (計時器) 就是慢慢數時間,在timer內部有一個計數器. 而計數器會數到Register的value當數值數到設定值Timer就會發起IRQ 而程式就會轉跳到中斷向量裡頭去執行想要做的事 ...
-
STM32F4 Timer External Clock TI2 Both Edges Demo
#define CLK_FREQ ( 10000 ) #define CORE_FREQ ( 168000000 ) static void TIM_GPIO_Config( void ) { GPI ...
-
STM32 System and Timer Clock Configurations
STM32 System and Timer Clock Configurations I've started writing some software to drive a series of ...
-
STM32 Timer Clock sources -- External Clock Both Edge
Timers get their clock source from External pins or Internal timer sources. External External = pins ...
-
Advanced Replication同步复制实验(基于Trigger&;基于Materialized View)
1. 高级复制和流复制介绍 1.1 高级复制(Advanced Replication) 高级复制也称为对称复制,分为多主体站点复制(Multiple Master Rplication).物化视图站 ...
随机推荐
-
centos 后台执行C#控制台程序
1. nohup nohup 无疑是我们首先想到的办法.顾名思义,nohup 的用途就是让提交的命令忽略 hangup 信号.让我们先来看一下 nohup 的帮助信息: NOHUP() User Co ...
-
PHP访问MSSQL数据库(实例代码)
本例子只作为简单的引导,实现一个简单的查询: <!DOCTYPE HTML> <html lang="en-US"> <head> <t ...
-
java中sesion
Session *Cookie基于客户端,不安全,并且大小和个数的限制. *Session域对象,范围一次会话范围,存个人相关的数据. *setAttribute(String ...
-
apache下ab.exe使用方法。。
自己在cmd中写了半天的路径也没有写对..最后网上的一个哥们告诉我说没有共同语言了...毛线啊 差距确实很大!大能猫死panda早晚干掉你,叫你丫整天嘲讽我! 比如我的ab.exe在D盘的wamp文件 ...
-
开发者必读jQuery Mobile入门教程
你每天都会对着它讲话,和它玩游戏,用它看新闻——没错,它就是你裤兜里的智能手机.android,黑莓还是iphone?为了让你清楚意识到究竟哪些才算是智能手机,我在下面总结了一个智能手机系统/设备的列 ...
-
linux—粘滞位的设置
粘滞位(Stickybit),或粘着位,是Unix文件系统权限的一个旗标.最常见的用法在目录上设置粘滞位,如此以来,只有目录内文件的所有者或者root才可以删除或移动该文件.如果不为目录设置粘滞位,任 ...
-
模块简介:(logging)(re)(subprocess)
''' logging模块: logging的日志可以分为 debug():Detailed information, typically of interest only when diagnosi ...
-
使用Groovy+Spock轻松写出更简洁的单测
当无法避免做一件事时,那就让它变得更简单. 概述 单测是规范的软件开发流程中的必不可少的环节之一.再伟大的程序员也难以避免自己不犯错,不写出有BUG的程序.单测就是用来检测BUG的.Java阵营中,J ...
-
MySQL学习----explain查看一条sql 的性能
在开发的过程中,对于我们写的sql语句,我们有时候会考虑sql语句的性能,那么explain就是首选.Explain命令在解决数据库性能上是第一推荐使用命令,大部分的性能问题可以通过此命令来简单的解决 ...
-
《Entity Framework 6 Recipes》中文翻译 ---- 系列教程
为了方便大家的阅读和学习,也是响应网友的建议,在这里为这个系列做一个目录.在目录开始这前,我先来回答之前遇到的几个问题. 1.为什么要学习EF? 这个问题很简单,项目需要.这不像学校,没人强迫你学习! ...