今天调试以前所写的工程文件,在一个任务中需要进行死锁操作,但是发现当死锁当前任务时,系统会复位,这是由于在另一个任务中调用了看门狗定组建造成的。为了不使复位发生,在当前任务中进行喂狗操作,发现系统仍然复位。仔细阅读英文文档才发现,MQX中的看门狗定时器是针对于一个任务的,和我们平时所使用的硬件看门狗是不同的,所以在当前一个任务中喂狗,并不能阻值另一个使用看门狗定时器任务的复位操作。
在这里顺便指出,复位操作是在 expiry function溢出函数中完成的,如果不希望系统复位,也可在函数中写入其它的程序逻辑就可以了。
最后,把英文原文和翻译附后,以供参考。
Most embedded systems have a hardware watchdog timer.If the application does not reset the timer within a certain time (perhaps because to deadlock or some other error condition), the hardware generates a reset operation. As such, a hardware watchdog timer monitors the entire application on a processor; it does no monitor individual tasks.大部分嵌入式系统都有一个硬件看门狗定时器。假如应用程序不能在指定的时间内复位这个定时器(或许是死锁或许是其它错误导致),这个硬件将产生一个复位操作。如此,一个硬件看门狗定时器可以监视一个处理器上运行的整个程序,但是它不能监视独立的任务。
The MQX RTOS watchdog component provides a software watchdog for each task. If a single task starves or runs beyond cetrain timing constraints, the watchdog provides a way to detect the problem, and if the task fails to stop or restart the watchdog before that time expires, MQX RTOS calls a processor-unique, application-supplied expiry function that can initiate error recovery.MQX RTOS看门狗组件提供一个针对于单独任务的软件看门狗。假如一个单一任务在超出了指定的时间限制,还没有得到运行,这个看门狗提供一个方法可以发现这个问题。初始时,任务按照指定时间启动一个看门狗,如果这个任务不能在指定的时间内停止或重新开始这个看门狗, MQX RTOS将调用一个针对于当前处理器唯一的,由应用程序提供的失效函数用于恢复故障。
Before a task can use the watchdog component, the application must explicitly create it by calling _watchdog_create_component() with the interrupt vectof of the periodic timer device and a pointer to the function that MQX RTOS calls if a watchdog expires.在一个任务使用看门狗组件之前,应用程序必须通过调用 _watchdog_create_component()函数 的建立这个组件,以用于启动定时器的中断向量,并告知看门狗定时器溢出时间到达后,处理函数的指针。
原创性文章,转载请注明出处 http://user.qzone.qq.com/2756567163 。
CSDN:http://blog.csdn.net/qingwufeiyang12346 。
在这里顺便指出,复位操作是在 expiry function溢出函数中完成的,如果不希望系统复位,也可在函数中写入其它的程序逻辑就可以了。
最后,把英文原文和翻译附后,以供参考。
Most embedded systems have a hardware watchdog timer.If the application does not reset the timer within a certain time (perhaps because to deadlock or some other error condition), the hardware generates a reset operation. As such, a hardware watchdog timer monitors the entire application on a processor; it does no monitor individual tasks.大部分嵌入式系统都有一个硬件看门狗定时器。假如应用程序不能在指定的时间内复位这个定时器(或许是死锁或许是其它错误导致),这个硬件将产生一个复位操作。如此,一个硬件看门狗定时器可以监视一个处理器上运行的整个程序,但是它不能监视独立的任务。
The MQX RTOS watchdog component provides a software watchdog for each task. If a single task starves or runs beyond cetrain timing constraints, the watchdog provides a way to detect the problem, and if the task fails to stop or restart the watchdog before that time expires, MQX RTOS calls a processor-unique, application-supplied expiry function that can initiate error recovery.MQX RTOS看门狗组件提供一个针对于单独任务的软件看门狗。假如一个单一任务在超出了指定的时间限制,还没有得到运行,这个看门狗提供一个方法可以发现这个问题。初始时,任务按照指定时间启动一个看门狗,如果这个任务不能在指定的时间内停止或重新开始这个看门狗, MQX RTOS将调用一个针对于当前处理器唯一的,由应用程序提供的失效函数用于恢复故障。
Before a task can use the watchdog component, the application must explicitly create it by calling _watchdog_create_component() with the interrupt vectof of the periodic timer device and a pointer to the function that MQX RTOS calls if a watchdog expires.在一个任务使用看门狗组件之前,应用程序必须通过调用 _watchdog_create_component()函数 的建立这个组件,以用于启动定时器的中断向量,并告知看门狗定时器溢出时间到达后,处理函数的指针。
原创性文章,转载请注明出处 http://user.qzone.qq.com/2756567163 。
CSDN:http://blog.csdn.net/qingwufeiyang12346 。