Sunday, August 20th 2017, 6:07am UTC+2

You are not logged in.

  • Login
  • Register



Date of registration: Jul 19th 2017

Posts: 1


Wednesday, July 19th 2017, 3:16pm

OS_WD_Config(): How to configure pfTriggerFunc?


I don't understand how to configure the new watchdog feature in embOS 4.34. From the docu:

Source code

void OS_WD_Config (voidRoutine* pfTriggerFunc,voidRoutine* pfResetFunc);

pfTriggerFunc Function pointer to hardware watchdog trigger callback function.

In the example, it's declared like this:

Source code

static void _TriggerWatchDog(void) {
WD_REG = TRIGGER_WD; // Trigger the hardware watchdog

Why/How should I trigger that "hardware watchdog"? If I have to trigger some watchdog here, /that/ one will reset the μC and pfResetFunc is meaningless...
Or what is meant by "trigger"? Is it to refresh another watchdog? But still, if that watchdog resets the μC, the embOS watchdog is surplus.

Could you help me out of my confusion, please?
I'd need it for an stm32f303...


Super Moderator

Date of registration: Nov 14th 2007

Posts: 252


Wednesday, July 19th 2017, 3:50pm


from the embOS manual:


pfResetFunc may be used to perform additional operations inside a callback function
prior to the reset of the microcontroller.

The reset function is optional and gives the chance to react on such a situation.
You could e.g. write a message in a log file or set a piece of hardware in safe state before resetting the μC.

The basic idea is that one hardware watchdog is not enough for an RTOS with multiple tasks.
If you would trigger the hardware watchdog in one task only all other tasks are not checked and you don't know if they are still running.
Therefore we have the unlimited software watchdogs which you can use with the OS_WD_*() API.
In the end a hardware watchdog is used, of course.

I hope that makes it more clear.

Best regards,