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
Previous article:How much do you know about ARM microcontrollers?
Next article:STM32 serial port configuration (interrupt mode)
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- What are the working modes of lithium battery charging management IC?
- STM32F030F4P6 multi-channel ADC DMA sampling value is 4095 problem summary
- 【GD32F310G-START】Upload to Alibaba Cloud
- Smart door lock cake
- 【Project source code】Ethernet real-time image transmission display based on FPGA
- RISC-V MCU Development (Thirteen): Embedded Development Related Tool Software
- [GD32E231C-START] Simulate I2C and OLED
- Please recommend some good books for hardware engineers.
- DDR SDRAM controller Verilog code and Chinese documentation
- When the LCD screen displays 0, I see a little bit of the horizontal line in the middle of the 0, but it is very weak, so it seems to display an 8. What should I do?