STM8L watchdog:
(1) Use the internal low-speed clock (LSI): 38K, and set the frequency division of 4-256, so the time can be set to 0.1ms-1724.63ms;
(2) IWDG_KR = 0XCC to enable, IWDG_KR = 0XAA to feed the watchdog, IWDG_KR = 0X55 to allow access to IWDG_PR (prescaler) and IWDG_RLR (watchdog initial value)
void IWDG_Init(void)
{
CLK_LSICmd(ENABLE);
while (CLK_GetFlagStatus(CLK_FLAG_LSIRDY) == RESET);
CLK_BEEPClockConfig(CLK_BEEPCLKSource_LSI);
CLK_PeripheralClockConfig(CLK_Peripheral_BEEP, ENABLE);
IWDG_Enable(); //Remember to enable first
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_256);
IWDG_SetReload((uint8_t)RELOAD_VALUE); //RELOAD_VALUE = 254 1.724s
IWDG_ReloadCounter();
}
The programs in the firmware library are:
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_256);
IWDG_SetReload((uint8_t)RELOAD_VALUE);
IWDG_ReloadCounter();
IWDG_Enable(); //Enable is placed at the end
I tried it this way, and the parameters given previously were useless. As long as it was enabled for about 27ms, it would bite people. There was a timer
Also, please note that many seniors said that dogs cannot be fed during interruptions, but must be fed during the normal program. If the program runs away, it is possible to run into an interruption. . . .
Previous article:stm8 debugging hardware I2C experience
Next article:STM8L independent watchdog IWDG
Recommended ReadingLatest update time:2024-11-16 12:43
- 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
- EEWORLD University Hall----Live Replay: Microchip Trust&GO for any cloud service
- PCB Layout /PCB design part-time OEM
- 【Distributed temperature and humidity acquisition system】+MFC software
- Use of EEPROM inside STC microcontroller - Recording power-on times
- Regarding the number of bits of the microcontroller, the number of bits of the ADC, and the number of bits of the PWM, ADC and PWM are both indicators that reflect the resolution...
- Please teach me an op amp circuit - RMS to DC circuit
- 【Silicon Labs Development Kit Review】+ PWM Example Test
- Porter-3: Will this topology work?
- Problem with the abs function
- Xunwei i.MX6ULL development board-Transplant OpenCv2.4.9-QT program compilation