Stm32f0xx_ watchdog (standalone + window) configuration Detailed procedure

Source: Internet
Author: User

, overview

For the watchdog, I think it is not unfamiliar to do single-chip or embedded development personnel, today summarizes the function of stm32f0 watchdog,F0 watchdog has two kinds: independent and window watchdog.

Today we offer two kinds of watchdog software engineering examples for everyone to download.

Two kinds of watchdog each have their own characteristics, applied in different situations, the following will be a simple summary of the independent and window watchdog function.

based on the principle of free sharing, convenient for everyone to learn knowledge on mobile phones, sharing technical knowledge every day. If you feel that the content you share is useful to you and you want to learn more about it, please use the search "embedddeveloper" or scan the QR code below, Attention, there will be more exciting content waiting for you.

Ⅱ, download

The article provides the "Software engineering" are on the hardware board to conduct multiple tests, and ensure that no problem before uploading to 360 cloud disk, please feel free to download the test, if there is a problem, please check your board if there is a problem.

St Standard Peripheral Library and reference manuals, data sheets, etc. can be downloaded from the St official website , you can also go to my 360 cloud disk download. There are several versions of the reference manual for the F0 series of chips (for F0 different chips), but there is a generic version, which is "stm32f0x128 reference manual V8 (English) 2015-07" recommended reference to this manual, later if you switch to a type of chip is also easy to understand.

Today's Software engineering (360 cloud disk):

IWDG independent watchdog:

Https://yunpan.cn/cRfa8Qhi9g48Y access password 2c3e

WWDG window Watchdog:

https://yunpan.cn/cRfa5DvT9syUm access password 7bf1

STM32F0XX information can be downloaded from my 360 cloud disk:

https://yunpan.cn/cS2PVuHn6X2Bj access password 8c37

Ⅲ, preparatory work

For the watchdog programming, it is recommended that you prepare F0 Reference manuals and data sheets for easy access to relevant knowledge, do not go to St official website or to my cloud disk download.

Today's summary of software engineering is based on the "TIM Basic Delay configuration Detailed process" modified, so you need to prepare the software engineering download. I always provide a good software engineering for everyone to download, but if you are a learner, it is recommended that you step-by-step operation.

Ⅳ, watchdog principle

①IWDG independent watchdog

Independent watchdog by internal low-speed clock LSI provides counting clock,8 poorly transposition frequency,the number of digits, need to feed the dog regularly (heavy value Reloadcounter), if the count value is reduced to 0 , the value is not overloaded and the reset event is responded to.

②WWDG window watchdog

Window watchdog by APB1 (RCC_APB1PERIPH_WWDG) provides counting clock,2 poorly transposition frequency,7 bit count, need to feed dog regularly (update count value) , if the count value is reduced to 0x40 and the count value has not been updated, the reset event is responded to.

Ⅴ, code description

Today provides two kinds of watchdog software engineering, the following are summed up, the main explanation of the configuration of the function interface.

①IWDG independent watchdog

The function is located above the main. c file;

The calculation of the overloaded numerical value should be combined with the above structure block diagram with the function source code, from the function can be seen, as long as 0.5s.

Operating effect:

Feed the dog maximum time 500ms (theoretical value), but the internal low-speed clock LSI has errors, it is recommended to modify the test time: less than 450, greater than 550;

Less than 450ms: Normal feed dog, serial port interval print "Running ..." led changes;

Greater than 550ms: Feed dog Timeout, system reset, serial print "System reset ..."

②WWDG window watchdog

The function is located above the main. c file;

The clock here is different from the IWDG clock above, and the combined block diagram also shows that the value counted after the excessive frequency is calculated.

Operating effect:

Feed the dog maximum time 43ms (theoretical value), but the serial printing needs one or two milliseconds, it is recommended to modify the test time: less than 41, greater than 43;

Less than 41ms: Normal feed dog, serial port interval print "Running ..." led changes;

Greater than 43ms: Feed dog Timeout, system reset, serial print "System reset ..."

③ summarize the difference between the two

1), IWDG use the system clock LSI,WWDG using the internal low-speed clock apb1enr

2), IWDG no interruption, WWDG interrupt

3), IWDG is 12-bit descending. The WWDG is a 7-bit descending

4), IWDG only lower limit, WWDG with lower and upper limit

5), IWDG most suitable for those who need the watchdog as a outside of the main program, able to work completely independently, and the time accuracy of the low requirements of the occasion. The WWDG is best suited for applications that require a watchdog to function in a precise timing window.

Watchdog in the long-term work of the product used more, the role is very simple, to prevent the crash. The watchdog function can also be used for timing counting and so on.

Ⅵ, description

Perhaps your hardware chip is not to provide the chip inside the project, but stm32f0 chip software compatibility is very good, can be applied to F0 many other models of chips, even F2, F4 and other chips (see the manual, or personally test).

The software engineering provided in this article is based on the St standard Peripheral Library, rather than using STM32CUBEMX to establish the project. Personally feel that using ST's standard Peripheral library suitable for learners, STM32CUBEMX building engineering structure complex, for learners, especially beginners are estimated to be headache.

Today's project is based on the project "stm32f0xx_tim Basic Delay configuration Detailed process" modified, the above examples are summarized for reference only, if there is wrong, please understand.

Ⅶ, last

Attention, reply to "more content", will get more content (such as:UCOS instances, etc., constantly updated in ...) )。

If you like what I share, and you want to know more about it, please follow the public number at the beginning of the article, the new content continues to be updated, and more exciting content will appear later.

Read the original

Stm32f0xx_ watchdog (standalone + window) configuration Detailed procedure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.