找回密码
 立即注册
查看: 3187|回复: 9

STC8H8K64U_TSSOP20内置RTC

[复制链接]
  • TA的每日心情
    难过
    10 小时前
  • 签到天数: 145 天

    [LV.7]常住居民III

    133

    主题

    185

    回帖

    1581

    积分

    金牌会员

    积分
    1581
    发表于 2023-3-17 10:34:30 | 显示全部楼层 |阅读模式
    本帖最后由 STC32G12K128 于 2023-3-17 11:21 编辑

    当未对RTC任何初始化操作,上电RTC就会发生一次闹钟中断(在没有打开闹钟中断的情况下)

    当上电对RTC闹钟写入配值并打开闹钟中断时并不会发生闹钟中断(有初始化就正常,没有任何初始化就不正常)

    回复 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    2023-12-5 13:56
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    12

    主题

    245

    回帖

    1532

    积分

    超级版主

    积分
    1532
    发表于 2023-3-17 11:14:23 | 显示全部楼层
    本帖最后由 STC32G12K128 于 2023-3-17 11:41 编辑

    RTC, 年月日时分秒,必须 外部 32768的 专用晶振,也才 RMB0.15
    RTC 用外部 32768晶振; CPU 跑内部高速 HIRC时钟;
    你外部挂了 32768 高精准 RTC 时钟,就可以用内部硬件根据外部时钟自动校准内部高速 HIRC时钟,如 45MHz
    另外您可以看下手册的这个章节,看看是不是哪里设置的不对:
    1679024363127.jpg




    电话:0513-55012946 QQ:2195591714  微信:  19952583740

    该用户从未签到

    550

    主题

    9218

    回帖

    1万

    积分

    管理员

    积分
    13946
    发表于 2023-3-17 13:44:20 | 显示全部楼层
    1.png

    STC8H-20230316.pdf

    21.42 MB, 下载次数: 46

  • TA的每日心情
    奋斗
    7 小时前
  • 签到天数: 124 天

    [LV.7]常住居民III

    26

    主题

    1263

    回帖

    3937

    积分

    论坛元老

    积分
    3937
    发表于 2023-3-17 13:45:19 | 显示全部楼层
    我按照你的方法试了一下,没有遇到你说的那种现象。

    附件是我的测试程序,你可以将RTC_config配置函数屏蔽掉,试试不对RTC任何初始化操作情况下,上电会不会产生闹钟中断。
    测试例程在中断函数里面判断是闹钟中断的话,翻转一个带指示灯的IO口,并设置B_Alarm标志:
    1. if(RTCIF & 0x80)    //闹钟中断
    2.         {
    3.                 P11 = !P11;
    4.                 RTCIF &= ~0x80;
    5.                 B_Alarm = 1;
    6.         }
    复制代码
    主循环里判断B_Alarm被置位的话,通过CDC串口打印一串数据:
    1. if(B_Alarm)
    2.         {
    3.             B_Alarm = 0;
    4.             printf("RTC Alarm!\r\n");
    5.         }
    复制代码
    所以不管通过指示灯还是CDC串口都可以判断是否产生了闹钟中断。
    如果还是觉得有问题的话,请提供可以复现问题的测试例程。



    通过USB-CDC串口打印RTC时钟.zip

    43.2 KB, 下载次数: 54

    该用户从未签到

    4

    主题

    85

    回帖

    634

    积分

    高级会员

    积分
    634
    发表于 2023-5-15 14:35:12 | 显示全部楼层
    STC32G12K128 发表于 2023-3-17 11:14
    RTC, 年月日时分秒,必须 外部 32768的 专用晶振,也才 RMB0.15
    RTC 用外部 32768晶振; CPU 跑内部高速 H ...

    You say
    you have a 32768 high-precision RTC clock externally, you can use the internal hardware according to the external The clock automatically calibrates the internal high-speed HIRC clock, such as 45MHz.


    Is there any example, of how the 32768 is used to automatically calibrate the internal high-speed HIRC clock ?

    What HIRC clock MHz choices can be calibrated ?
    回复 支持 0 反对 1 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    2023-12-5 13:56
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    12

    主题

    245

    回帖

    1532

    积分

    超级版主

    积分
    1532
    发表于 2023-5-15 16:25:47 | 显示全部楼层
    本帖最后由 STC32G12K128 于 2023-5-15 16:45 编辑

    附件有测试范例,您可以测试看看:
    使用STC出厂前用专业时钟调校设备,调校的如下10种常用高精准内部HIRC频率--STC8H8K64U
    22.1184MHz,24MHz,27MHz,30MHz,33.1776MHz,35MHz,36.864MHz,40MHz,44.2368MHz,48MHz
    在用户程序区用户自己选择设置如上STC出厂前调校的这10种内部高精准的HIRC的频率--STC8H8K64U
    ===常温下STC出厂前用专业的高精准设备调校的这10个固定频率时钟误差 < + - 0.3%
    ===没有压飘,只有+-1%附近的温漂【-40度 ~ +85度】
    而如用户使用在ISP烧录时任意设置的频率,虽然范围很宽很灵活,但如用户使用第三方不专业的USB转串口来烧录,
    来校准成其他的频率,这有可能会将第三方不专业工具的时钟误差,在用户ISP下载时重新校准频率而带入芯片内部
    即使用户要设置特殊的频率,也请使用 STC的专业工具 STC-USB Link1D
    ===用STC-ISP下载时设置任意频率, 请使用STC-USB Link1D来校准内部高精准HIRC的频率,
    ===这个STC-USB Link1D 专业工具专门外挂了22.1184MHz晶振来ISP下载时校准内部时钟到任意频率
    ===STC-USB Link1D是【专业仿真器,专业在线全自动下载器/无需手工停电,专业脱机烧录器,专业时钟校准器】
    这是超级重点,不要那么强大的内部时钟不会自己在程序区自己任意设置

    1.png

    通过USB-CDC串口打印RTC时钟.zip

    43.2 KB, 下载次数: 31

    电话:0513-55012946 QQ:2195591714  微信:  19952583740
    回复 支持 0 反对 1 送花

    使用道具 举报

    该用户从未签到

    4

    主题

    85

    回帖

    634

    积分

    高级会员

    积分
    634
    发表于 2023-5-16 08:47:01 | 显示全部楼层
    Thank you.
    That reply refers to initial calibrate of the HIRC, using the stored values, or using Link1D, to calibrate to ±0.3%

    You stated before
    You have a 32768 high-precision RTC clock externally, you can use the internal hardware according to the external The clock automatically calibrates the internal high-speed HIRC clock, such as 45MHz.


    Which suggests the precision RTC crystal can calibrate (somehow?) the HIRC, as other vendors can do ?  Or do I not understand what you wrote ?

    Can you somehow auto calibrate the HIRC for run-time correction of the average MHz, to (much) better than the ±0.3% ?
    or if it is not supporting Automatic calibrate, is there some way to capture a HIRC timer reading, using the RTC crystal signal ?
    回复 支持 0 反对 1 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    2023-12-5 13:56
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    12

    主题

    245

    回帖

    1532

    积分

    超级版主

    积分
    1532
    发表于 2023-5-16 09:00:38 | 显示全部楼层
    RTC, month, day, hour, minute, second, must have an external 32768 dedicated crystal oscillator。

    电话:0513-55012946 QQ:2195591714  微信:  19952583740
    回复 支持 0 反对 1 送花

    使用道具 举报

    该用户从未签到

    4

    主题

    85

    回帖

    634

    积分

    高级会员

    积分
    634
    发表于 2023-5-16 10:18:08 | 显示全部楼层
    I am trying to understand your comment in #2
    You have a 32768 high-precision RTC clock externally , you can use the internal hardware according to the external The clock automatically calibrates the internal high-speed HIRC clock , such as 45MHz.

    To calibrate such as 45MHz against 32.768kHz crystal, as one example you would capture 45MHz divided by 1372=TC and sample TC 3 times
    samples of 001 or 000 is HIRC is too slow, 011 is 'locked' and 111 is too fast.

    I am unclear of the STC8H or any STC MCUs have that level of hardware calibrate support ?  
    回复 支持 0 反对 1 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    2023-12-5 13:56
  • 签到天数: 5 天

    [LV.2]偶尔看看I

    12

    主题

    245

    回帖

    1532

    积分

    超级版主

    积分
    1532
    发表于 2023-5-16 11:11:09 | 显示全部楼层
    Before using STC factory, use professional clock calibration equipment to adjust the following 10 commonly used high-precision internal HIRC frequencies - STC8H8K64U

    22.1184MHz,24MHz,27MHz,30MHz,33.1776MHz,35MHz,36.864MHz,40MHz,44.2368MHz,48MHz

    In the user program area, the user chooses to set the frequency of these 10 kinds of internal high-precision HIRC, STC8H8K64U, which are calibrated before the STC leaves the factory
    电话:0513-55012946 QQ:2195591714  微信:  19952583740
    回复 支持 0 反对 1 送花

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

    GMT+8, 2024-4-26 16:47 , Processed in 0.071306 second(s), 67 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

    快速回复 返回顶部 返回列表