STM8L15x Standard Peripherals Drivers: stm8l15x_wwdg.c File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_wwdg.c File Reference

This file provides firmware functions to manage the following functionalities of the Window watchdog (WWDG) peripheral:

  • Refresh window and Counter configuration
  • WWDG activation
  • Couter and software reset management.
More...
#include "stm8l15x_wwdg.h"

Go to the source code of this file.

Defines

#define BIT_MASK   ((uint8_t)0x7F)

Functions

void WWDG_Enable (uint8_t Counter)
 Enables WWDG and load the counter value.
uint8_t WWDG_GetCounter (void)
 Gets the WWDG Counter Value.
void WWDG_Init (uint8_t Counter, uint8_t WindowValue)
 Initializes the WWDG peripheral.
void WWDG_SetCounter (uint8_t Counter)
 Sets the WWDG counter value.
void WWDG_SetWindowValue (uint8_t WindowValue)
 Sets the WWDG window value.
void WWDG_SWReset (void)
 Generates immediate WWDG RESET.

Detailed Description

This file provides firmware functions to manage the following functionalities of the Window watchdog (WWDG) peripheral:

  • Refresh window and Counter configuration
  • WWDG activation
  • Couter and software reset management.
Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
  *    
  *          ===================================================================
  *                                     WWDG features
  *          ===================================================================
  *                                        
  *          Once enabled the WWDG generates a system reset on expiry of a programmed
  *          time period, unless the program refreshes the counter (downcounter) 
  *          before to reach 0x3F value (i.e. a reset is generated when the counter
  *          value rolls over from 0x40 to 0x3F). 
  *          An MCU reset is also generated if the counter value is refreshed
  *          before the counter has reached the refresh window value. This 
  *          implies that the counter must be refreshed in a limited window.
  *            
  *          Once enabled the WWDG cannot be disabled except by a system reset.
  *          
  *          If the WWDG is activated and the watchdog reset on halt option is 
  *          selected (Option byte), then the HALT instruction will generate a reset.                               
  *          
  *          WWDGF flag in RST_SR register can be used to inform when a WWDG
  *          reset occurs.
  *            
  *          WWDG timeout = (WWDG counter clock) * 12288 * (T[5:0] + 1)
  *                      
  *          Min-max timeout value @16 MHz(PCLK1): ~0.768 ms / ~49.152 ms
  *                            
  *          ===================================================================
  *                                 How to use this driver
  *          =================================================================== 
  *          1. Configure the WWDG refresh window using WWDG_SetWindowValue() function
  *            
  *          2. Set the WWDG counter value and start it using WWDG_Enable() function.
  *             When the WWDG is enabled the counter value should be configured to 
  *             a value greater than 0x40 to prevent generating an immediate reset.     
  *            
  *          3. Then the application program must refresh the WWDG counter at regular
  *             intervals during normal operation to prevent an MCU reset, using
  *             WWDG_SetCounter() function. This operation must occur only when
  *             the counter value is lower than the refresh window value, 
  *             programmed using WWDG_SetWindowValue().         
  *
  *  
Attention:

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2011 STMicroelectronics

Definition in file stm8l15x_wwdg.c.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com