This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430F5529:如何在器件崩溃时使用看门狗复位 TI-RTOS 上的器件?

Guru**** 2595805 points
Other Parts Discussed in Thread: MSP430F5529

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1127349/msp430f5529-how-to-use-watchdog-to-reset-device-on-ti-rtos-when-device-crash

主题中讨论的其他器件:MSP430F5529

尊敬的所有人:

我使用 MSP430F5529并在 RTOS 上运行并启用看门狗。

但是、如何验证器件何时崩溃、看门狗可以复位器件?

我按照如下所示的看门狗示例进行操作。

bool flag = false;

Task_Struct task0Struct;
Char task0Stack[TASKSTACKSIZE];
Watchdog_Handle watchdogHandle;

/*
* ======== watchdogCallback ========
* Watchdog interrupt callback function. It toggles and LED, and if a button
* has not been pressed, clears the watchdog interrupt flag.
*/
Void watchdogCallback(UArg unused)
{
GPIO_toggle(Board_LED0);
}

/*
* ======== gpioButtonFxn ========
* Callback function for the GPIO interrupt on Board_BUTTON0.
*/
void gpioButtonFxn(unsigned int index)
{
flag ^= true;
GPIO_write(Board_LED0, Board_LED_ON);
}

/*
* ======== taskFxn ========
* Sets a flag and clears the watchdog timer if the button has been pressed.
*/
Void taskFxn(UArg arg0, UArg arg1)
{
while (true) {
/* Prevent Watchdog ISR trigger if button was pushed */
if (flag) {
Watchdog_clear(watchdogHandle);
}
}
}

/*
* ======== main ========
*/
int main(void)
{
Task_Params taskParams;
Watchdog_Params params;

/* Call board init functions */
Board_initGeneral();
Board_initGPIO();
Board_initWatchdog();

/* Construct BIOS objects */
Task_Params_init(&taskParams);
taskParams.stackSize = TASKSTACKSIZE;
taskParams.stack = &task0Stack;
Task_construct(&task0Struct, taskFxn, &taskParams, NULL);

/* Turn on user LED */
GPIO_write(Board_LED0, Board_LED_ON);

/* Install Button callback */
GPIO_setCallback(Board_BUTTON0, gpioButtonFxn);

/* Enable interrupts */
GPIO_enableInt(Board_BUTTON0);

System_printf("Starting the Watchdog example\nSystem provider is set to "
"SysMin. Halt the target to view any SysMin contents in"
" ROV.\n");

/* SysMin will only print to the console when you call flush or exit */
System_flush();

/* Create and enable a Watchdog with resets disabled */
Watchdog_Params_init(&params);
params.resetMode = Watchdog_RESET_OFF;

watchdogHandle = Watchdog_open(Board_WATCHDOG0, &params);
if (watchdogHandle == NULL) {
System_abort("Error opening Watchdog!\n");
}

/* Start BIOS */
BIOS_start();

return (0);
}

谢谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Zheng Wei Huang、

    我已经修改了您的帖子、以便使用我们的代码格式工具、使其更易于阅读。

    如果要使用看门狗定时器的复位功能、应查看《MSP43x TI-RTOS 用户指南》中的第5.16节。 您可以在找到它 /tirtos_msp43x_ /docs。

    从第5.16.4条

    这意味着、如果您将 resetMode 设置为  Watchdog_reset_on、则看门狗将触发复位、而不是像中断那样简单地运行。  

    此致、
    Brandon Fisher