STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_iwdg.c File Reference

IWDG HAL module driver. This file provides firmware functions to manage the following functionalities of the Independent Watchdog (IWDG) peripheral: More...

Go to the source code of this file.

Functions

HAL_StatusTypeDef HAL_IWDG_Init (IWDG_HandleTypeDef *hiwdg)
 Initialize the IWDG according to the specified parameters in the IWDG_InitTypeDef and start watchdog. Before exiting function, watchdog is refreshed in order to have correct time base. More...
 
HAL_StatusTypeDef HAL_IWDG_Refresh (IWDG_HandleTypeDef *hiwdg)
 Refresh the IWDG. More...
 

Detailed Description

IWDG HAL module driver. This file provides firmware functions to manage the following functionalities of the Independent Watchdog (IWDG) peripheral:

Author
MCD Application Team
  • Initialization and Start functions
  • IO operation functions
==============================================================================
                  ##### IWDG Generic features #####
==============================================================================
[..]
  (+) The IWDG can be started by either software or hardware (configurable
      through option byte).

  (+) The IWDG is clocked by Low-Speed clock (LSI) and thus stays active even
      if the main clock fails.

  (+) Once the IWDG is started, the LSI is forced ON and both can not be
      disabled. The counter starts counting down from the reset value (0xFFF).
      When it reaches the end of count value (0x000) a reset signal is
      generated (IWDG reset).

  (+) Whenever the key value 0x0000 AAAA is written in the IWDG_KR register,
      the IWDG_RLR value is reloaded in the counter and the watchdog reset is
      prevented.

  (+) The IWDG is implemented in the VDD voltage domain that is still functional
      in STOP and STANDBY mode (IWDG reset can wake-up from STANDBY).
      IWDGRST flag in RCC_CSR register can be used to inform when an IWDG
      reset occurs.

  (+) Debug mode : When the microcontroller enters debug mode (core halted),
      the IWDG counter either continues to work normally or stops, depending
      on DBG_IWDG_STOP configuration bit in DBG module, accessible through
      __HAL_DBGMCU_FREEZE_IWDG() and __HAL_DBGMCU_UNFREEZE_IWDG() macros

  [..] Min-max timeout value @32KHz (LSI): ~125us / ~32.7s
       The IWDG timeout may vary due to LSI frequency dispersion. STM32L4xx
       devices provide the capability to measure the LSI frequency (LSI clock
       connected internally to TIM16 CH1 input capture). The measured value
       can be used to have an IWDG timeout with an acceptable accuracy.

                   ##### How to use this driver #####
==============================================================================
[..]
  (#) Use IWDG using HAL_IWDG_Init() function to :
    (+) Enable instance by writing Start keyword in IWDG_KEY register. LSI
         clock is forced ON and IWDG counter starts downcounting.
    (+) Enable write access to configuration register: IWDG_PR, IWDG_RLR &
         IWDG_WINR.
    (+) Configure the IWDG prescaler and counter reload value. This reload
         value will be loaded in the IWDG counter each time the watchdog is
         reloaded, then the IWDG will start counting down from this value.
    (+) wait for status flags to be reset
    (+) Depending on window parameter:
      (++) If Window Init parameter is same as Window register value,
           nothing more is done but reload counter value in order to exit
           function withy exact time base.
      (++) Else modify Window register. This will automatically reload
           watchdog counter.

  (#) Then the application program must refresh the IWDG counter at regular
      intervals during normal operation to prevent an MCU reset, using
      HAL_IWDG_Refresh() function.

   *** IWDG HAL driver macros list ***
   ====================================
   [..]
     Below the list of most used macros in IWDG HAL driver:
    (+) __HAL_IWDG_START: Enable the IWDG peripheral
    (+) __HAL_IWDG_RELOAD_COUNTER: Reloads IWDG counter with value defined in
        the reload register
Attention

© Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Definition in file stm32l4xx_hal_iwdg.c.