86-0755-27838351
领先全球低功耗Renesas active crystal oscillator,已经关注了许多RA微控制器以及如何利用它们来帮助简化和自动化微控制器应用中常见的一些基本内务处理和I/O任务。
在这篇博客中,我们将看看我最喜欢的外设之一,尤其是针对低功耗设计的异步通用定时器。这个定时器在瑞萨MCU上有很长的历史,在RA家族的很多成员身上都能找到这个定时器最新版本的多个通道。
异步通用定时器(AGT)是一款16位和32位递减计数器,可用于脉冲输出、外部脉冲宽度或周期测量以及外部事件计数。定时器的异步特性在于,它能够在没有任何系统时钟的情况下进行一些基本的定时操作,并且可以在OSC晶振器件的最低功耗工作模式下工作。
AGT可以使用各种不同的时钟源,外设时钟、PCLKB或2分频或8分频的PCLKB。我们还可以选择两种低功耗选项,一种是来自32kHz子时钟有源晶体振荡器的AGTSCLK,另一种是来自片内32 kHz LOCO的AGTLCLK。AGTSCLK或AGTLCLK的选择也意味着您可以从更宽的分频比范围中进行选择,分频器范围从/1到/128。
从低速时钟中选择分频器的结果意味着您可以拥有非常宽的定时器范围,并且可以产生极长的超时,同时消耗最少的功率。
让我们更详细地了解一下使用AGT的一些方法,重点放在使用低速石英晶体振荡器选项可以创建的低功耗功能上。
在许多低功耗传感器应用中,我们经常需要定期通过无线电进行通信,同时将功耗降至最低。实现这一点的最佳方法是让传感器以及微控制器进入睡眠状态,并对其进行编程,以便在下一次传输到期时唤醒并启动无线电电路。AGT,尤其是32位计数寄存器,是满足这一要求的理想解决方案。您可以用任何32位值从重载寄存器自动重载递减计数器。因此,利用这一特性,我们可以使用子时钟的直接连接创建高达36.4小时的超时,分辨率为30秒,当使用除以128的子时钟输入时,超时时间为大约194天,分辨率为3.9毫秒。领先全球低功耗Renesas active crystal oscillator.
AGT支持许多其他有趣的应用。我发现过去有用的一个功能是在低功耗模式下计数外部事件的能力,计数由外部信号选通。
在这种情况下,我们可以配置AGT来计数外部脉冲,并使用AGTEE使能引脚来选择何时计数脉冲;当门信号为高电平时,或者当门信号为低电平时,可以对脉冲进行计数。
如果您想要监控位置传感器并计算轴的转数,这可能特别有用。如果有两个AGT通道在这种模式下工作,一个通道可以计算正向旋转,另一个可以计算反向旋转,这两种计数都取决于“方向”信号的极性。要获得总旋转数,只需将两个计数器的值相加。这种方法的最大优势在于,在这种情况下,AGT定时器可以异步工作,因此无需时钟,因此功耗非常低,甚至可以在RA微控制器的最低功耗模式下工作。
我希望这已经让您对AGT的功能有了一些了解,它有多种工作模式,定时器能够以微控制器上的最低速度时钟工作,以及更大的分频比范围,这意味着您可以在计数时以极低的电流工作。
AGT是一个非常有趣的外设,希望你能找到一些有趣的方法在你的应用中使用它。
Over the last few months, previous blogs in this series have looked at some of the more unusual peripherals available on many of the RA microcontrollers and how they can be used to help simplify and automate some basic housekeeping and I/O tasks that are common in microcontroller applications.
Mfr Part #
Mfr
Description
Series
Frequency
Output
Voltage - Supply
Frequency Stability
XLH336033.330000I
Renesas晶振
XTAL OSC XO 33.3300MHZ LVCMOS
XL
33.33 MHz
LVCMOS
3.3V
±25ppm
XLH336031.948512I
Renesas晶振
XTAL OSC XO 31.948512MHZ LVCMOS
XL
31.948512 MHz
LVCMOS
3.3V
±25ppm
XLH336019.000000I
Renesas晶振
XTAL OSC XO 19.0000MHZ LVCMOS
XL
19 MHz
LVCMOS
3.3V
±25ppm
XLH730030.875520I
Renesas晶振
XTAL OSC XO 30.87552MHZ LVCMOS
XL
30.87552 MHz
LVCMOS
3.3V
±100ppm
XLH535003.686000I
Renesas晶振
XTAL OSC XO 3.6860MHZ LVCMOS SMD
XL
3.686 MHz
LVCMOS
3.3V
±50ppm
XLH736078.125000X
Renesas晶振
XTAL OSC XO 78.1250MHZ LVCMOS
XL
78.125 MHz
LVCMOS
3.3V
±25ppm
XLH736025.750000X
Renesas晶振
XTAL OSC XO 25.7500MHZ LVCMOS
XL
25.75 MHz
LVCMOS
3.3V
±25ppm
XLH535013.330000I
Renesas晶振
XTAL OSC XO 13.3300MHZ LVCMOS
XL
13.33 MHz
LVCMOS
3.3V
±50ppm
XLH338040.953873X
Renesas晶振
XTAL OSC XO 40.953873MHZ LVCMOS
XL
40.953873 MHz
LVCMOS
3.3V
±20ppm
XLH300000.000000K
Renesas晶振
XTAL OSC XO HCMOS SMD
XL
-
HCMOS
-
±100ppm
XLH335006.005284K
Renesas晶振
XTAL OSC XO 6.005284MHZ HCMOS
XL
6.005284 MHz
HCMOS
3.3V
±50ppm
XLH528031.250000X
Renesas晶振
XTAL OSC XO 31.2500MHZ LVCMOS
XL
31.25 MHz
LVCMOS
2.5V
±20ppm
XLH526031.250000I
Renesas晶振
XTAL OSC XO 31.2500MHZ LVCMOS
XL
31.25 MHz
LVCMOS
2.5V
±25ppm
XLH53V026.000000I
Renesas晶振
XTAL OSC VCXO 26.0000MHZ LVCMOS
XL
26 MHz
LVCMOS
3.3V
-
XLH535133.333333I
Renesas晶振
XTAL OS XO 133.333333MHZ LVCMOS
XL
133.333333 MHz
LVCMOS
3.3V
±50ppm
XLH535133.330000I
Renesas晶振
XTAL OSC XO 133.3300MHZ LVCMOS
XL
133.33 MHz
LVCMOS
3.3V
±50ppm
XLH736122.906000I
Renesas晶振
OSC 122.906MHZ SMD
*
-
-
-
-
XLH335074.250000K
Renesas晶振
XTAL OSC XO 74.2500MHZ LVCMOS
XL
74.25 MHz
LVCMOS
3.3V
±50ppm
XLH335037.125000K
Renesas晶振
XTAL OSC XO 37.1250MHZ LVCMOS
XL
37.125 MHz
LVCMOS
3.3V
±50ppm
XLH330002.097152K
Renesas晶振
XTAL OSC XO 2.097152MHZ LVCMOS
XL
2.097152 MHz
LVCMOS
3.3V
±100ppm
XLH335008.000000K
Renesas晶振
XTAL OSC XO 8.0000MHZ LVCMOS SMD
XL
8 MHz
LVCMOS
3.3V
±50ppm
XLH335003.200000K
Renesas晶振
XTAL OSC XO 3.2000MHZ LVCMOS SMD
XL
3.2 MHz
LVCMOS
3.3V
±50ppm
XLH335126.488100K
Renesas晶振
XTAL OSC XO 126.4881MHZ LVCMOS
XL
126.4881 MHz
LVCMOS
3.3V
±50ppm
XLH335100.000000K
Renesas晶振
XTAL OSC XO 100.0000MHZ LVCMOS
XL
100 MHz
LVCMOS
3.3V
±50ppm
XAH335033.333000X
Renesas晶振
CLCC 3.20X2.50X0.90 MM, 2.10MM P
XA
33.333 MHz
HCMOS
3.3V
±50ppm
XAH335033.333333X
Renesas晶振
CLCC 3.20X2.50X0.90 MM, 2.10MM P
XA
33.333333 MHz
HCMOS
3.3V
±50ppm
XAH335060.000000X
Renesas晶振
CLCC 3.20X2.50X0.90 MM, 2.10MM P
XA
60 MHz
HCMOS
3.3V
±50ppm
XLH535036.000000K
Renesas晶振
XTAL OSC XO 36.0000MHZ LVCMOS
XL
36 MHz
LVCMOS
3.3V
±50ppm
XAH335080.000000K
Renesas晶振
OSC XO 80.0000MHZ LVCMOS SMD
XA
80 MHz
LVCMOS
3.3V
±50ppm
XLH3AA100.000000I
Renesas晶振
XTAL OSC XO 100.0000MHZ HCMOS
XL
100 MHz
HCMOS
-
-
XLH3AA125.000000I
Renesas晶振
XTAL OSC XO 125.0000MHZ HCMOS
XL
125 MHz
HCMOS
-
±100ppm
XLH3AA025.000000I
Renesas晶振
XTAL OSC XO 25.0000MHZ HCMOS SMD
XL
25 MHz
HCMOS
-
-
XLH536001.843200I
Renesas晶振
XTAL OSC XO 1.8432MHZ HCMOS SMD
XPRESSO FXO-HC53
1.8432 MHz
HCMOS
3.3V
±25ppm
XLH536033.000000I
Renesas晶振
XTAL OSC XO 33.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
33 MHz
HCMOS
3.3V
±25ppm
XLH536004.000000I
Renesas晶振
XTAL OSC XO 4.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
4 MHz
HCMOS
3.3V
±25ppm
XLH536062.500000I
Renesas晶振
XTAL OSC XO 62.5000MHZ HCMOS SMD
XPRESSO FXO-HC53
62.5 MHz
HCMOS
3.3V
±25ppm
XLH736060.000000I
Renesas晶振
XTAL OSC XO 60.0000MHZ HCMOS SMD
XPRESSO FXO-HC73
60 MHz
HCMOS
3.3V
±25ppm
XLH736062.500000I
Renesas晶振
XTAL OSC XO 62.5000MHZ HCMOS SMD
XPRESSO FXO-HC73
62.5 MHz
HCMOS
3.3V
±25ppm
XLH736066.000000I
Renesas晶振
XTAL OSC XO 66.0000MHZ HCMOS SMD
XPRESSO FXO-HC73
66 MHz
HCMOS
3.3V
±25ppm
XLH536016.384000I
Renesas晶振
XTAL OSC XO 16.3840MHZ HCMOS SMD
XPRESSO FXO-HC53
16.384 MHz
HCMOS
3.3V
±25ppm
XLH536066.000000I
Renesas晶振
XTAL OSC XO 66.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
66 MHz
HCMOS
3.3V
±25ppm
XLH736014.318180I
Renesas晶振
XTAL OSC XO 14.31818MHZ HCMOS
XPRESSO FXO-HC73
14.31818 MHz
HCMOS
3.3V
±25ppm
XLH736016.384000I
Renesas晶振
XTAL OSC XO 16.3840MHZ HCMOS SMD
XPRESSO FXO-HC73
16.384 MHz
HCMOS
3.3V
±25ppm
XLH736003.686400I
Renesas晶振
XTAL OSC XO 3.6864MHZ HCMOS SMD
XPRESSO FXO-HC73
3.6864 MHz
HCMOS
3.3V
±25ppm
XLH320180.000000I
Renesas晶振
XTAL OSC XO 180.0000MHZ HCMOS
XPRESSO FXO-HC32
180 MHz
HCMOS
2.5V
±100ppm
XLH335250.000000I
Renesas晶振
XTAL OSC XO 250.0000MHZ HCMOS
XPRESSO FXO-HC33
250 MHz
HCMOS
3.3V
±50ppm
XLH526100.000000I
Renesas晶振
XTAL OSC XO 100.0000MHZ HCMOS
XPRESSO FXO-HC52
100 MHz
HCMOS
2.5V
±25ppm
XLH535225.060000I
Renesas晶振
XTAL OSC XO 225.0600MHZ HCMOS
XPRESSO FXO-HC53
225.06 MHz
HCMOS
3.3V
±50ppm
XLH535156.250000I
Renesas晶振
XTAL OSC XO 156.2500MHZ HCMOS
XPRESSO FXO-HC53
156.25 MHz
HCMOS
3.3V
±50ppm
XLH536156.250000X
Renesas晶振
XTAL OSC XO 156.2500MHZ HCMOS
XPRESSO FXO-HC53
156.25 MHz
HCMOS
3.3V
±25ppm
XLH536135.000000X
Renesas晶振
XTAL OSC XO 135.0000MHZ HCMOS
XPRESSO FXO-HC53
135 MHz
HCMOS
3.3V
±25ppm
XLH536114.775489I
Renesas晶振
XTAL OSC XO 114.775489MHZ HCMOS
XPRESSO FXO-HC53
114.775489 MHz
HCMOS
3.3V
±25ppm
XLH536098.304000I
Renesas晶振
XTAL OSC XO 98.3040MHZ HCMOS SMD
XPRESSO FXO-HC53
98.304 MHz
HCMOS
3.3V
±25ppm
XLH536088.000000I
Renesas晶振
XTAL OSC XO 88.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
88 MHz
HCMOS
3.3V
±25ppm
XLH536066.666000I
Renesas晶振
XTAL OSC XO 66.6660MHZ HCMOS SMD
XPRESSO FXO-HC53
66.666 MHz
HCMOS
3.3V
±25ppm
XLH536044.545000I
Renesas晶振
XTAL OSC XO 44.5450MHZ HCMOS SMD
XPRESSO FXO-HC53
44.545 MHz
HCMOS
3.3V
±25ppm
XLH536033.330000I
Renesas晶振
XTAL OSC XO 33.3300MHZ HCMOS SMD
XPRESSO FXO-HC53
33.33 MHz
HCMOS
3.3V
±25ppm
XLH536013.300000I
Renesas晶振
XTAL OSC XO 13.3000MHZ HCMOS SMD
XPRESSO FXO-HC53
13.3 MHz
HCMOS
3.3V
±25ppm
XLH536006.000000I
Renesas晶振
XTAL OSC XO 6.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
6 MHz
HCMOS
3.3V
±25ppm
XLH536002.048000I
Renesas晶振
XTAL OSC XO 2.0480MHZ HCMOS SMD
XPRESSO FXO-HC53
2.048 MHz
HCMOS
3.3V
±25ppm
XLH538100.000000X
Renesas晶振
XTAL OSC XO 100.0000MHZ HCMOS
XPRESSO FXO-HC53
100 MHz
HCMOS
3.3V
±20ppm
XLH538074.250000X
Renesas晶振
XTAL OSC XO 74.2500MHZ HCMOS SMD
XPRESSO FXO-HC53
74.25 MHz
HCMOS
3.3V
±20ppm
XLH538050.000000X
Renesas晶振
XTAL OSC XO 50.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
50 MHz
HCMOS
3.3V
±20ppm
XLH538048.000000X
Renesas晶振
XTAL OSC XO 48.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
48 MHz
HCMOS
3.3V
±20ppm
XLH538040.000000X
Renesas晶振
XTAL OSC XO 40.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
40 MHz
HCMOS
3.3V
±20ppm
XLH538033.000000X
Renesas晶振
XTAL OSC XO 33.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
33 MHz
HCMOS
3.3V
±20ppm
XLH538030.720000X
Renesas晶振
XTAL OSC XO 30.7200MHZ HCMOS SMD
XPRESSO FXO-HC53
30.72 MHz
HCMOS
3.3V
±20ppm
XLH538025.000000X
Renesas晶振
XTAL OSC XO 25.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
25 MHz
HCMOS
3.3V
±20ppm
XLH538020.000000X
Renesas晶振
XTAL OSC XO 20.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
20 MHz
HCMOS
3.3V
±20ppm
XLH538019.200000X
Renesas晶振
XTAL OSC XO 19.2000MHZ HCMOS SMD
XPRESSO FXO-HC53
19.2 MHz
HCMOS
3.3V
±20ppm
XLH538013.500000X
Renesas晶振
XTAL OSC XO 13.5000MHZ HCMOS SMD
XPRESSO FXO-HC53
13.5 MHz
HCMOS
3.3V
±20ppm
XLH538013.000000X
Renesas晶振
XTAL OSC XO 13.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
13 MHz
HCMOS
3.3V
±20ppm
XLH538012.288000X
Renesas晶振
XTAL OSC XO 12.2880MHZ HCMOS SMD
XPRESSO FXO-HC53
12.288 MHz
HCMOS
3.3V
±20ppm
XLH538012.000000X
Renesas晶振
XTAL OSC XO 12.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
12 MHz
HCMOS
3.3V
±20ppm
XLH538010.000000X
Renesas晶振
XTAL OSC XO 10.0000MHZ HCMOS SMD
XPRESSO FXO-HC53
10 MHz
HCMOS
3.3V
±20ppm
XLH726025.002000I
Renesas晶振
XTAL OSC XO 25.0020MHZ HCMOS SMD
XPRESSO FXO-HC72
25.002 MHz
HCMOS
2.5V
±25ppm
XLH728025.000000X
Renesas晶振
XTAL OSC XO 25.0000MHZ HCMOS SMD
XPRESSO FXO-HC72
25 MHz
HCMOS
2.5V
±20ppm
XLH728020.000000X
Renesas晶振
XTAL OSC XO 20.0000MHZ HCMOS SMD
XPRESSO FXO-HC72
20 MHz
HCMOS
2.5V
±20ppm
XLH730200.000000I
Renesas晶振
XTAL OSC XO 200.0000MHZ HCMOS
XPRESSO FXO-HC73
200 MHz
HCMOS
3.3V
±100ppm
XLH735225.060000I
Renesas晶振
XTAL OSC XO 225.0600MHZ HCMOS
XPRESSO FXO-HC73
225.06 MHz
HCMOS
3.3V
±50ppm
XLH735156.250000I
Renesas晶振
XTAL OSC XO 156.2500MHZ HCMOS
XPRESSO FXO-HC73
156.25 MHz
HCMOS
3.3V
±50ppm
XLH735150.000000I
Renesas晶振
XTAL OSC XO 150.0000MHZ HCMOS
XPRESSO FXO-HC73
150 MHz
HCMOS
3.3V
±50ppm
XLH736150.000000X
Renesas晶振
XTAL OSC XO 150.0000MHZ HCMOS
XPRESSO FXO-HC73
150 MHz
HCMOS
3.3V
±25ppm
XLH736121.500000I
Renesas晶振
XTAL OSC XO 121.5000MHZ HCMOS
XPRESSO FXO-HC73
121.5 MHz
HCMOS
3.3V
±25ppm
XLH736108.000000I
Renesas晶振
XTAL OSC XO 108.0000MHZ HCMOS
XPRESSO FXO-HC73
108 MHz
HCMOS
3.3V
±25ppm
XLH736104.000000I
Renesas晶振
XTAL OSC XO 104.0000MHZ HCMOS
XPRESSO FXO-HC73
104 MHz
HCMOS
3.3V
±25ppm
XLH736102.400000I
Renesas晶振
XTAL OSC XO 102.4000MHZ HCMOS
XPRESSO FXO-HC73
102.4 MHz
HCMOS
3.3V
±25ppm
XLH736089.600000I
Renesas晶振
XTAL OSC XO 89.6000MHZ HCMOS SMD
XPRESSO FXO-HC73
89.6 MHz
HCMOS
3.3V
±25ppm
XLH736085.000000I
Renesas晶振
XTAL OSC XO 85.0000MHZ HCMOS SMD
XPRESSO FXO-HC73
85 MHz
HCMOS
3.3V
±25ppm
XLH736070.656000I
Renesas晶振
XTAL OSC XO 70.6560MHZ HCMOS SMD
XPRESSO FXO-HC73
70.656 MHz
HCMOS
3.3V
±25ppm
XLH736066.667000I
Renesas晶振
XTAL OSC XO 66.6670MHZ HCMOS SMD
XPRESSO FXO-HC73
66.667 MHz
HCMOS
3.3V
±25ppm
XLH530133.330000X
Renesas晶振
XTAL OSC XO 133.3300MHZ HCMOS
XL
133.33 MHz
HCMOS
3.3V
±100ppm
XLH536072.000000X
Renesas晶振
XTAL OSC XO 72.0000MHZ HCMOS SMD
XL
72 MHz
HCMOS
3.3V
±25ppm
XLH336033.330000X
Renesas晶振
XTAL OSC XO 33.3300MHZ HCMOS SMD
XL
33.33 MHz
HCMOS
3.3V
±25ppm
XLH325100.000000I
Renesas晶振
XTAL OSC XO 100.0000MHZ HCMOS
XL
100 MHz
HCMOS
2.5V
±50ppm
XLH335033.916000I
Renesas晶振
XTAL OSC XO 33.9160MHZ HCMOS SMD
XL
33.916 MHz
HCMOS
3.3V
±50ppm
XLH326108.000000X
Renesas晶振
XTAL OSC XO 108.0000MHZ HCMOS
XL
108 MHz
HCMOS
2.5V
±25ppm
XLH325074.250000I
Renesas晶振
XTAL OSC XO 74.2500MHZ HCMOS SMD
XL
74.25 MHz
HCMOS
2.5V
±50ppm
XLH535004.915200I
Renesas晶振
XTAL OSC XO 4.9152MHZ HCMOS SMD
XL
4.9152 MHz
HCMOS
3.3V
±50ppm
XLH736110.160000X
Renesas晶振
XTAL OSC XO 110.1600MHZ HCMOS
XL
110.16 MHz
HCMOS
3.3V
±25ppm
XLH336012.288000X
Renesas晶振
XTAL OSC XO 12.2880MHZ HCMOS SMD
XL
12.288 MHz
HCMOS
3.3V
±25ppm
XLH335077.777600I
Renesas晶振
XTAL OSC XO 77.7776MHZ HCMOS SMD
XL
77.7776 MHz
HCMOS
3.3V
±50ppm
XLH336066.666700X
Renesas晶振
XTAL OSC XO 66.6667MHZ HCMOS SMD
XL
66.6667 MHz
HCMOS
3.3V
±25ppm
XLH335076.068600I
Renesas晶振
XTAL OSC XO 76.0686MHZ HCMOS SMD
XL
76.0686 MHz
HCMOS
3.3V
±50ppm
XLH736028.322000X
Renesas晶振
XTAL OSC XO 28.3220MHZ HCMOS SMD
XL
28.322 MHz
HCMOS
3.3V
±25ppm
XLH730069.190900I
Renesas晶振
XTAL OSC XO 69.1909MHZ HCMOS SMD
XL
69.1909 MHz
HCMOS
3.3V
±100ppm
XLH730042.400000I
Renesas晶振
XTAL OSC XO 42.4000MHZ HCMOS SMD
XL
42.4 MHz
HCMOS
3.3V
±100ppm
XLH335089.000000I
Renesas晶振
XTAL OSC XO 89.0000MHZ HCMOS SMD
XL
89 MHz
HCMOS
3.3V
±50ppm
XLH336100.000000X
Renesas晶振
XTAL OSC XO 100.0000MHZ HCMOS
XL
100 MHz
HCMOS
3.3V
±25ppm
XLH735078.125000I
Renesas晶振
XTAL OSC XO 78.1250MHZ HCMOS SMD
XL
78.125 MHz
HCMOS
3.3V
±50ppm
In this blog, we’re going to look at one of my favorite peripherals, especially for low power designs, the Asynchronous General Purpose Timer. This timer has a long history on Renesas MCUs, and multiple channels of the latest versions of this timer can be found on many members of the RA family.
The Asynchronous General Purpose Timer (AGT) is a down counter available in 16- and 32-bit flavors that can be used for pulse output, external pulse width or period measurement, and counting external events. The asynchronous nature of the timer is that it is capable of some basic timing operations without any system clock and can operate in the lowest power operating modes of the device.
The AGT can use a variety of different clock sources, the peripheral clock, PCLKB, or PCLKB divided by 2 or 8. We can also select two low power options, the AGTSCLK which is derived from the 32 kHz sub clock oscillator, and the AGTLCLK which is derived from the on-chip 32 kHz LOCO. The choice of AGTSCLK or AGTLCLK also means that you can select from a much wider range of divide ratios, with dividers available from /1 to /128.
The result of this choice of the divider from the low speed clocks means that you can have a very wide timer range and can generate extremely long timeouts, all while consuming the minimum amount of power.
Let’s look in a little more detail at some ways we can use the AGT, concentrating on the low power functions we can create by using the low-speed oscillator options.
In many low power sensor applications, we often have to communicate by radio at regular intervals, while minimizing power consumption. The best way to achieve this is to put the sensor, and hence the microcontroller, to sleep, and to program it to wake up and power up the radio circuit when the next transmission is due. The AGT, especially with the 32-bit count register is an ideal solution to this requirement. You can reload the down counter automatically from a reload register with any 32-bit value. So using this feature we can create timeouts of up to 36.4 hrs with a resolution of 30 µseconds using the direct connection of the sub-clock, all the way to a time out around 194 days with a resolution of 3.9 ms when using the sub-clock input divided by 128.
The AGT supports many other interesting applications. One I’ve found useful in the past is the ability to count external events in low power mode, with the count gated by an external signal.
In this case, we can configure the AGT to count external pulses, and use the AGTEE enable pin to select when the pulses are counted; either the pulses can be counted when the gate signal is high, or when the gate signal is low.
This can be especially useful if you want to monitor a position sensor and count the number of rotations of a shaft. If you have two channels of AGT operating in this mode, one channel can count forward rotation, and the second can count reverse rotation, both counting depending on the polarity of a “direction” signal. To get the total rotation count you just add the value of the two counters. The big advantage of this method is that the AGT timer can operate asynchronously in this case, so without a clock, and therefore consumes very little current, and operates even in the lowest power modes of the RA microcontroller.
I hope this has given you some idea of what the AGT is capable of, it has a variety of operating modes and the ability of the timer to operate from the lowest speed clocks on the microcontroller, along with the larger range of divide ratios available, mean that you can operate with extremely low current operation while counting.
The AGT is a really interesting peripheral, and hopefully, you can find some interesting ways to use it in your application.