STM32F4 Timer Internal Trigger Connection



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).物化视图站 ...
 
随机推荐
- mongoDB - 日常操作四
			
python 使用 mongodb easy_install pymongo # 安装(python2.+) import pymongo connection=pymongo.Connection( ...
 - java线程池的初探
			
问题来源 发现学习很多技术都提到了线程池的技术,自己的线程池方面没有仔细研究过,现在看了点东西来这里总结下,最近发现写博客是一个很好的锻炼自己并且将学到的东西更加理解的一个方式. 问题探究 java的 ...
 - HTTP协议之响应头Date与Age
			
HTTP没有为用户提供一种手段来区分响应是缓存命中的,还是访问原始服务器得到的.客户端有一种方法能判断响应是否来自缓存,就是使用Date首部.将响应中Date首部的值与当前时间进行比较,如果响应中的日 ...
 - springboot自定义SpringApplication启动类
			
如果默认的SpringApplication不符合你的口味,你可以创建一个本地的实例并自定义它.例如,关闭banner你可以这样写: public static void main(String[] ...
 - centos7系统下安装配置jdk、tomcat教程
			
JDK安装与配置 1.下载linux版本的jdk,我下的版本是jdk6.0,下载rpm版本的. 可通过百度搜索文件名:jdk-6u45-linux-x64-rpm.bin下载 也可通过oracle官网 ...
 - ScheduledThreadExecutor定时任务线程池
			
ScheduledThreadPoolExecutor 继承自ThreadPoolExecutor实现了ScheduledExecutorService接口.主要完成定时或者周期的执行线程任务. 代码 ...
 - Java基础92 MySQL插入当前系统时间
			
1.时间格式 用yyyy表示年份(year). -- y 表示年的最后一位,yy 表示年的最后2位,yyy 表示年的最后3位,yyyy 用4位数表示年用MM表示月份(month).-- mm 用2位 ...
 - UFLDL 教程学习笔记(一)
			
ufdl的新教程,从基础学起.第一节讲的是线性回归.主要目的是熟悉目标函数,计算梯度和优化. 按着教程写完代码后,总是编译出错,一查是mex的原因,实在不想整了. 这位博主用的是向量,比较简洁:htt ...
 - ConvertUtils.register的作用
			
BeanUtils的populate方法或者getProperty,setProperty方法其实都会调用convert进行转换 但Converter只支持一些基本的类型,甚至连Java.util.D ...
 - javaweb笔记七
			
过滤器:是一个web中间组件,用于拦截从客户端发送给服务器的请求和响应.当客户端向服务器发出请求时,服务器会查看是否有过滤器和该请求匹配,如果有,则交给过滤器执行,业务操作后,可以将请求继续向目标资源 ...