Description

Background

One of the simplest and most common fault tolerance mechanisms is the watchdog timer. A watchdog timer is a piece of hardware usually found as a peripheral unit built into a microcontroller unit (MCU). It consists of a timer that counts towards a fixed, predetermined value. The system’s software needs to reset the timer to its original value before it times out. If a time-out occurs, it means the system has become too unresponsive to continue functioning and a system reset is asserted. The choice of the counter’s value needs to strike a balance between being small enough to respond to errors quickly, but big enough to avoid unnecessary resets due to execution variation. Although the basic way to handle a watchdog time-out is to reset the system, other actions can also be taken before the reset such as recording system information for debugging or ensuring the system boots up in a safe mode or state.

Further readings:

Tasks

Khalil Notes (March 29, 2023)

Looks great! Can you try and implement the following:

void StartCommandHandler(void *argument)
{
  /* USER CODE BEGIN 5 */
	uint16_t command;
  /* Infinite loop */
	bool init_WD = False;
  while(1)
  {
  	if(osMessageQueueGet(CommandQueueHandle, (void*) &command, NULL, osWaitForever) == osOK)
  	{
			if(!init_WD)
			{
				MX_IWDG1_Init();
				init_WD = True;
			}

  		command = command - 48; //From ASCII to int

That way the timer only starts counting once the first task has been sent (This is just for debugging purposes).

Notes