/**
@page IWDG_Reset IWDG Reset example
@verbatim
******************** (C) COPYRIGHT 2012 STMicroelectronics *******************
* @file IWDG_Reset/readme.txt
* @author MCD Application Team
* @version V1.0.0
* @date 23-March-2012
* @brief Description of the IWDG Reset example.
******************************************************************************
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
@endverbatim
@par Example Description
This example shows how to update at regular period the IWDG reload counter and
how to simulate a software fault generating an MCU IWDG reset on expiry of a
programmed time period.
The IWDG timeout is set to 250 ms (the timeout may varies due to LSI frequency
dispersion).
First, the TIM14 timer is configured to measure the LSI frequency as the LSI is
internally connected to TIM14 CH1, in order to adjust the IWDG clock.
The LSI measurement using the TIM14 is described below:
- Configure the TIM14 to remap internally the TIM14 Channel 1 Input Capture to
the LSI clock output.
- Enable the TIM14 Input Capture interrupt: after one cycle of LSI clock, the
period value is stored in a variable and compared to the HCLK clock to get
its real value.
@note The LSI is internally connected to TIM14 IC1 on STM32F0xx Devices.
When using other devices, you should comment the "#define LSI_TIM_MEASURE"
in main.c file and in this case the LSI frequency is set by default to 40KHz.
Then, the IWDG reload counter is configured to obtain 240ms according to the
measured LSI frequency.
The IWDG reload counter is refreshed each 240ms in the main program infinite loop
to prevent a IWDG reset.
LED4 is also toggled each 240ms indicating that the program is running.
An EXTI Line is connected to a GPIO pin, and configured to generate an interrupt
on the rising edge of the signal.
The EXTI Line is used to simulate a software failure: once the EXTI Line event
occurs, by pressing the User-button, the corresponding interrupt is served.
In the ISR, a write to invalid address generates a Hardfault exception containing
an infinite loop and preventing to return to main program (the IWDG reload counter
is not refreshed).
As a result, when the IWDG counter reaches 00h, the IWDG reset occurs.
If the IWDG reset is generated, after the system resumes from reset, LED3 turns on.
If the EXTI Line event does not occur, the IWDG counter is indefinitely refreshed
in the main program infinite loop, and there is no IWDG reset.
In this example the system clock is set to 48 MHz.
@note The IWDG Counter can be only written when the RVU flag is reset.
In this example, as the SysTick period is too higher than the IWDG Counter
Update timing (5 Cycles 40KHz RC), the Reload Value Update "RVU" flag is
not checked before reloading the counter.
@par Directory contents
- IWDG_Reset/stm32f10x_conf.h Library Configuration file
- IWDG_Reset/stm32f10x_it.c Interrupt handlers
- IWDG_Reset/stm32f10x_it.h Header for stm32f0xx_it.c
- IWDG_Reset/main.c Main program
- IWDG_Reset/system_stm32f10x.c STM32F0xx system source file
@note The "system_stm32f0xx.c" file contains the system clock configuration for
STM32F0xx devices, and is customized for use with STM32F0-Discovery Kit.
The STM32F0xx is configured to run at 48 MHz, following the three
configuration below:
+ PLL_SOURCE_HSI
- HSI (~8 MHz) used to clock the PLL, and the PLL is used as system
clock source.
+ PLL_SOURCE_HSE
- HSE (8 MHz) used to clock the PLL, and the PLL is used as system
clock source.
- The HSE crystal is not provided with the Discovery Kit, some
hardware modification are needed in manner to connect this crystal.
For more details, refer to section "4.7 OSC clock" in "STM32F0 discovery kit User manual (UM1525)"
+ PLL_SOURCE_HSE_BYPASS
- HSE bypassed with an external clock (fixed at 8 MHz, coming from
ST-Link circuit) used to clock the PLL, and the PLL is used as
system clock source.
- Some hardware modification are needed in manner to bypass the HSE
with clock coming from the ST-Link circuit.
For more details, refer to section "4.7 OSC clock" in "STM32F0 discovery kit User manual (UM1525)"
User can select one of the three configuration in system_stm32f0xx.c file
(default configuration is PLL_SOURCE_HSI).
@par Hardware and Software environment
- This example runs on STM32F0xx Devices.
- This example has been tested with STMicroelectronics STM32F0-Discovery (MB1034)
RevB and can be easily tailored to any other supported device and development board.
- STM32F0-Discovery Set-up
- Use LD3 and LD4 leds connected respectively to PC.08 and PC.09 pins
- Use the USER button connected to PA.00 pin (EXTI Line0).
@par How to use it ?
In order to make the program work, you must do the following :
+ EWARM
- Open the IWDG_Reset.eww workspace
- Rebuild all files: Project->Rebuild all
- Load project image: Project->Debug
- Run program: Debug->Go(F5)
+ MDK-ARM
- Open the IWDG_Reset.uvproj project
- Rebuild all files: Project->Rebuild all target files
- Load project image: Debug->Start/Stop Debug Session
- Run program: Debug->Run (F5)
+ TASKING
- Open TASKING toolchain.
- Click on File->Import, select General->'Existing Projects into Workspace'
and then click "Next".
- Browse to TASKING workspace directory and select the project "IWDG_Reset"
- Rebuild all project files: Select the project in the "Project explorer"
window then click on Project->build project menu.
- Run program: Select the project in the "Project explorer" window then click
Run->Debug (F11)
+ TrueSTUDIO for ARM
- Open the TrueSTUDIO for ARM toolchain.
- Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace
directory.
- Click on File->Import, select General->'Existing Projects into Workspace'
and then click "Next".
- Browse to the TrueSTUDIO workspace directory and select the project "IWDG_Reset"
- Rebuild all project files: Select the project in the "Project explorer"
window then click on Project->build project menu.
- Run program: Select the project in the "Project explorer" window then click
Run->Debug (F11)
* <h3><center>© COPYRIGHT STMicroelectronics</center></h3>
*/
没有合适的资源?快使用搜索试试~ 我知道了~
STM32F0探索套件固件包
共524个文件
c:87个
h:78个
project:42个
4星 · 超过85%的资源 需积分: 9 42 下载量 95 浏览量
2013-09-13
15:01:48
上传
评论
收藏 1.6MB ZIP 举报
温馨提示
STM32F0探索套件固件包,包括21个例程和为4个不同IDE配置的项目
资源推荐
资源详情
资源评论
收起资源包目录
STM32F0探索套件固件包 (524个子文件)
logo.bmp 7KB
stm32f0xx_tim.c 121KB
stm32f0xx_rtc.c 87KB
stm32f0xx_usart.c 79KB
stm32f0xx_rcc.c 58KB
stm32f0xx_i2c.c 54KB
stm32f0xx_spi.c 49KB
stm32f0xx_adc.c 45KB
stm32f0xx_flash.c 38KB
stm32f0xx_dma.c 28KB
stm32f0xx_cec.c 24KB
stm32f0xx_pwr.c 19KB
stm32f0xx_dac.c 18KB
stm32f0xx_gpio.c 18KB
stm32f0xx_comp.c 15KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 13KB
system_stm32f0xx.c 12KB
stm32f0xx_lp_modes.c 12KB
stm32f0xx_syscfg.c 11KB
stm32f0xx_iwdg.c 11KB
stm32f0xx_exti.c 10KB
stm32f0xx_wwdg.c 10KB
main.c 9KB
main.c 9KB
main.c 9KB
stm32f0xx_crc.c 8KB
main.c 8KB
main.c 7KB
stm32f0_discovery.c 7KB
stm32f0xx_dbgmcu.c 7KB
main.c 7KB
main.c 7KB
main.c 6KB
main.c 6KB
main.c 6KB
main.c 6KB
main.c 6KB
stm32f0xx_misc.c 6KB
main.c 6KB
stm32f0xx_it.c 5KB
main.c 5KB
main.c 5KB
main.c 5KB
stm32f0xx_it.c 5KB
main.c 5KB
main.c 5KB
stm32f0xx_it.c 5KB
main.c 5KB
main.c 5KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
stm32f0xx_it.c 4KB
main.c 4KB
.cproject 25KB
.cproject 25KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
.cproject 24KB
共 524 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- usbfans2018-09-25凑合着用吧。
- 深圳背包客2018-04-03例子不错,在平台上测试了,可以运行。
- oumiga662014-03-03非常好的资源,开发板上试了。慢慢学习。
- meilnwpu2015-12-24资料很多都是M3的,凑合用吧
asdf0147y
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功