|
查看: 1077|回复: 1

[Timer] Clock overflow handling

[复制链接]

1

主题

0

回帖

17

积分

英勇黄铜

积分
17
发表于 2025-11-13 21:14:03 | 显示全部楼层 |阅读模式 来自 美国
Information
说明:   建议参照本版块置顶帖内容输入必要信息
芯片型号: tlsr8251
驱动SDK版本: V3.4.2.1_Patch_0005
Hello,

I'm implementing a millisecond counter using reg_system_tick on the TLSR8251.
The timer overflows every ~268 seconds (268000ms) due to its limited range.

Currently, I detect overflow in software by comparing consecutive readings:
- If (current_value < previous_value) → overflow occurred

However, I'm wondering if there's a more efficient approach using hardware
interrupts. Specifically:

1. Can I configure a timer (TIMER0?) to generate an interrupt just before
   reg_system_tick overflows?

2. What's the recommended approach for maintaining a long-running millisecond
   counter on TLSR8251?

3. Are there any SDK examples for handling system tick overflow?

My current implementation works but has overhead on every millis_get() call.
I'd prefer an interrupt-driven approach if the hardware supports it.

Thank you!

1

主题

36

回帖

123

积分

版主

积分
123
发表于 2026-8-7 14:47:46 | 显示全部楼层 来自 上海
You can refer to the following code to implement a timer interrupt, thereby achieving long-term timing.
https://gitee.com/telink-semi/tc ... or/TIMER_Demo/app.c

本版积分规则

关注公众号
隐私政策|Telink forum

相关侵权、举报、投诉及建议等,请发 E-mail:forum@telink-semi.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|沪ICP备17008231号-1 |沪公网安备31011502403548号

在本版发帖返回顶部
公告×