STM32-IWDG independent watchdog use

Publisher:星空行者Latest update time:2013-04-10 Source: 21icKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

STM32---Use of IWDG independent watchdog

The independent watchdog (IWDG) is driven by a dedicated 40kHz low-speed clock.

It still works even if the master clock fails.

The window watchdog is driven by the clock obtained by dividing the APB1 clock.

Detect unusually late or early operation of an application through a configurable time window.

IWDG is best suited for applications that require a watchdog as a

Able to work completely independently and in situations where low time accuracy requirements are required.

WWDG is best suited for applications that require the watchdog to function within a precise timing window.

IWDG main performance

●Free running down counter

● Clock provided by independent RC oscillator (can work in stop and standby modes)

●After the watchdog is activated, a reset occurs when the counter counts to 0x000

Write 0xCCCC in the key register (IWDG_KR) to start enabling the independent watchdog;

At this point the counter starts counting down from its reset value 0xFFF.

When the counter counts to the end 0x000, a reset signal (IWDG_RESET) is generated.

Whenever 0xAAAA is written to the key register IWDG_KR,

The value in IWDG_RLR will be reloaded into the counter to avoid a watchdog reset.

If the user enables the "Hardware Watchdog" function in the option byte,

After the system is powered on and reset, the watchdog will automatically start running;

If the software does not write the corresponding value to the key register before the counter ends,

The system will reset the register access protection

The IWDG_PR and IWDG_RLR registers have a write protection function.

To modify the values ​​of these two registers, you must first write 0x5555 to the IWDG_KR register.

Writing to this register with a different value will disrupt the order of operations and the register will be protected again.

A reload operation (ie writing 0xAAAA) will also activate the write protection function.

The status register indicates whether the prescaler value and the down counter are being updated.

//Start independent watchdog

IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); //Enable register write before access

IWDG_SetPrescaler(IWDG_Prescaler_64); //64 division, one cycle 1.6ms

IWDG_SetReload(800); //Longest 12 bits [0,4096] 800*1.6=1.28S

/* Reload IWDG counter */

IWDG_ReloadCounter();

IWDG_Enable();// Enable IWDG (the LSI oscillator will be enabled by hardware)

Because the independent watchdog uses LSI, it is best to make the clock source stable when the program starts:

/* Start LSI */

RCC_LSICmd(ENABLE); //Open LSI

while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY)==RESET);//Wait until LSI is stable

Keywords:STM32 Reference address:STM32-IWDG independent watchdog use

Previous article:How much do you know about ARM microcontrollers?
Next article:STM32 serial port configuration (interrupt mode)

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号