查看: 3088|回复: 5

[已解决] K60FX512VLQ15 WDOG(已解决)

[复制链接]

该用户从未签到

11

主题

79

帖子

0

中级会员

Rank: 3Rank: 3

积分
278
最后登录
1970-1-1
发表于 2014-5-27 09:48:19 | 显示全部楼层 |阅读模式
 能帮我看一下,为什么调用后还是COP复位?
 
#define EnableInterrupts asm(" CPSIE i");
#define DisableInterrupts asm(" CPSID i");
 
       
/********************************************************************/
/*
 * Watchdog timer disable routine
 *
 * Parameters:
 * none
 */
void wdog_disable(void)
{
        /* First unlock the watchdog so that we can write to registers */
        wdog_unlock();
       
        /* Clear the WDOGEN bit to disable the watchdog */
        WDOG_STCTRLH &= ~WDOG_STCTRLH_WDOGEN_MASK;
}
void wdog_enable(void)
{
        /* First unlock the watchdog so that we can write to registers */
        wdog_unlock();
       
        WDOG_STCTRLH |= WDOG_STCTRLH_WDOGEN_MASK;
}
/********************************************************************/
/*
 * Watchdog timer unlock routine. Writing 0xC520 followed by 0xD928
 * will unlock the write once registers in the WDOG so they are writable
 * within the WCT period.
 *
 * Parameters:
 * none
 */
void wdog_unlock(void)
{
  /* NOTE: DO NOT SINGLE STEP THROUGH THIS FUNCTION!!! */
  /* There are timing requirements for the execution of the unlock. If
   * you single step through the code you will cause the CPU to reset.
   */
 
        /* This sequence must execute within 20 clock cycles, so disable
         * interrupts will keep the code atomic and ensure the timing.
         */
        DisableInterrupts;
       
        /* Write 0xC520 to the unlock register */
        WDOG_UNLOCK = 0xC520;
       
        /* Followed by 0xD928 to complete the unlock */
        WDOG_UNLOCK = 0xD928;
       
        /* Re-enable interrupts now that we are done */       
               EnableInterrupts;
}
/********************************************************************/
void wdog_init(void)
{
    // 解锁
    wdog_unlock();
    // 预分频 PRESCVAL = 4, Wdog colck = BUS/(4+1) = 15M
    WDOG_PRESC = 0x0400;
    // 2秒
    WDOG_TOVALH = 0x01C9;
    WDOG_TOVALL = 0xC380;
    // 使能总线,静止窗口模式,禁止看门口中断,开启开门狗 
    WDOG_STCTRLH = 0x01D3;
}
void wdog_feed(void)
{
    // 解锁
    wdog_unlock();   
    // PRESCVAL = 4, Wdog colck = BUS/(4+1) = 15M
    WDOG_PRESC = 0x0400; 
    WDOG_REFRESH = 0xA602;
    WDOG_REFRESH = 0xB480;
}
我知道答案 目前已有4人回答
回复

使用道具 举报

  • TA的每日心情
    开心
    2018-7-2 06:04
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    59

    主题

    2888

    帖子

    10

    金牌会员

    Rank: 6Rank: 6

    积分
    6020
    最后登录
    2020-9-28
    发表于 2014-5-27 14:25:39 | 显示全部楼层

    回复:K60FX512VLQ15 WDOG

    楼主你好
    请参考这个网友的操作方法试一下:
    (Kinetis K60)WDOG看门狗测试
     
    该会员没有填写今日想说内容.
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4

    主题

    351

    帖子

    0

    高级会员

    Rank: 4

    积分
    973
    最后登录
    1970-1-1
    发表于 2014-5-27 14:39:18 | 显示全部楼层

    回复:K60FX512VLQ15 WDOG

    楼主你有经常喂狗吗?
    你这样设置2、3秒就需要喂一次狗了。
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11

    主题

    79

    帖子

    0

    中级会员

    Rank: 3Rank: 3

    积分
    278
    最后登录
    1970-1-1
     楼主| 发表于 2014-5-27 14:58:45 | 显示全部楼层

    回复:K60FX512VLQ15 WDOG【已解决】

    回复第 2 楼 于2014-05-27 14:25:39发表:
    楼主你好
    请参考这个网友的操作方法试一下:
    (Kinetis K60)WDOG看门狗测试
     多谢!   
     
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    11

    主题

    79

    帖子

    0

    中级会员

    Rank: 3Rank: 3

    积分
    278
    最后登录
    1970-1-1
     楼主| 发表于 2014-5-27 14:59:33 | 显示全部楼层

    回复:K60FX512VLQ15 WDOG【已解决】

    回复第 3 楼 于2014-05-27 14:39:18发表:
    楼主你有经常喂狗吗?
    你这样设置2、3秒就需要喂一次狗了。
     
    多谢,已经解决。按二楼例程可用:) 我在循环判断是否喂狗,测试时基本上所有时间都在喂狗
     
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    4

    主题

    351

    帖子

    0

    高级会员

    Rank: 4

    积分
    973
    最后登录
    1970-1-1
    发表于 2014-5-27 15:42:45 | 显示全部楼层

    回复:K60FX512VLQ15 WDOG【已解决】

    回复第 5 楼 于2014-05-27 14:59:33发表:
    回复第 3 楼 于2014-05-27 14:39:18发表:
    楼主你有经常喂狗吗?
    你这样设置2、3秒就需要喂一次狗了。
     
    多谢,已经解决。按二楼例程可用:) 我在循环判断是否喂狗,测试时基本上所有时间都在喂狗
     

     

    和二楼程序区别不大嘛,问题出在哪呢? 是喂狗操作中解锁、分频步骤多余导致的?
    如果要谢我,就在我参与活动的帖子【我眼中的FTF2014】Kinetis二代K2产品里回复一下,帮我获个奖呗!
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-7-20 04:34 , Processed in 0.095779 second(s), 26 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

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