/**
******************************************************************************
* @file system_stm32f1xx.c
* @author MCD Application Team
* @version V4.2.0
* @date 31-March-2017
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Source File.
*
* 1. This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
* factors, AHB/APBx prescalers and Flash settings).
* This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f1xx_xx.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
* 2. After each device reset the HSI (8 MHz) is used as system clock source.
* Then SystemInit() function is called, in "startup_stm32f1xx_xx.s" file, to
* configure the system clock before to branch to main program.
*
* 4. The default value of HSE crystal is set to 8 MHz (or 25 MHz, depending on
* the product used), refer to "HSE_VALUE".
* When HSE is used as system clock source, directly or through PLL, and you
* are using different crystal you have to adapt the HSE value to your own
* configuration.
*
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup stm32f1xx_system
* @{
*/
/** @addtogroup STM32F1xx_System_Private_Includes
* @{
*/
#include "stm32f1xx.h"
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Defines
* @{
*/
#if !defined (HSE_VALUE)
#define HSE_VALUE 8000000U /*!< Default value of the External oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSE_VALUE */
#if !defined (HSI_VALUE)
#define HSI_VALUE 8000000U /*!< Default value of the Internal oscillator in Hz.
This value can be provided and adapted by the user application. */
#endif /* HSI_VALUE */
/*!< Uncomment the following line if you need to use external SRAM */
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
/* #define DATA_IN_ExtSRAM */
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Variables
* @{
*/
/*******************************************************************************
* Clock Definitions
*******************************************************************************/
#if defined(STM32F100xB) ||defined(STM32F100xE)
uint32_t SystemCoreClock = 24000000U; /*!< System Clock Frequency (Core Clock) */
#else /*!< HSI Selected as System Clock source */
uint32_t SystemCoreClock = 72000000U; /*!< System Clock Frequency (Core Clock) */
#endif
const uint8_t AHBPrescTable[16U] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
const uint8_t APBPrescTable[8U] = {0, 0, 0, 0, 1, 2, 3, 4};
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_FunctionPrototypes
* @{
*/
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
#ifdef DATA_IN_ExtSRAM
static void SystemInit_ExtMemCtl(void);
#endif /* DATA_IN_ExtSRAM */
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
/**
* @}
*/
/** @addtogroup STM32F1xx_System_Private_Functions
* @{
*/
/**
* @brief Setup the microcontroller system
* Initialize the Embedded Flash Interface, the PLL and update the
* SystemCoreClock variable.
* @note This function should be used only after reset.
* @param None
* @retval None
*/
void SystemInit (void)
{
/* Reset the RCC clock configuration to the default reset state(for debug purpose) */
/* Set HSION bit */
RCC->CR |= 0x00000001U;
/* Reset SW, HPRE, PPRE1, PPRE2, ADCPRE and MCO bits */
#if !defined(STM32F105xC) && !defined(STM32F107xC)
RCC->CFGR &= 0xF8FF0000U;
#else
RCC->CFGR &= 0xF0FF0000U;
#endif /* STM32F105xC */
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= 0xFEF6FFFFU;
/* Reset HSEBYP bit */
RCC->CR &= 0xFFFBFFFFU;
/* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE/OTGFSPRE bits */
RCC->CFGR &= 0xFF80FFFFU;
#if defined(STM32F105xC) || defined(STM32F107xC)
/* Reset PLL2ON and PLL3ON bits */
RCC->CR &= 0xEBFFFFFFU;
/* Disable all interrupts and clear pending bits */
RCC->CIR = 0x00FF0000U;
/* Reset CFGR2 register */
RCC->CFGR2 = 0x00000000U;
#elif defined(STM32F100xB) || defined(STM32F100xE)
/* Disable all interrupts and clear pending bits */
RCC->CIR = 0x009F0000U;
/* Reset CFGR2 register */
RCC->CFGR2 = 0x00000000U;
#else
/* Disable all interrupts and clear pending bits */
RCC->CIR = 0x009F0000U;
#endif /* STM32F105xC */
#i
没有合适的资源?快使用搜索试试~ 我知道了~
stm32 spwm cube工程源码
共92个文件
o:20个
d:20个
crf:19个
需积分: 11 31 下载量 187 浏览量
2018-05-31
11:49:20
上传
评论 2
收藏 5.45MB ZIP 举报
温馨提示
本历程是一个完整的功能,已经编译测试过了,载波频率是20K,程序是使用CUBE生成的,基本配置过程都有,功能也很完善,预留了,串口和ADC功能。很方面的例子。应用的东西我就没写什么,希望能帮助到大家
资源推荐
资源详情
资源评论
收起资源包目录
new_SPWM.zip (92个子文件)
new_SPWM
MDK-ARM
startup_stm32f103xe.lst 48KB
RTE
_new_SPWM
RTE_Components.h 348B
new_SPWM.uvprojx 19KB
EventRecorderStub.scvd 339B
DebugConfig
new_SPWM_STM32F103RC.dbgconf 7KB
new_SPWM.uvoptx 18KB
new_SPWM
system_stm32f1xx.d 4KB
stm32f1xx_hal_flash_ex.o 595KB
system_stm32f1xx.o 575KB
stm32f1xx_hal_adc.o 619KB
stm32f1xx_hal_uart.o 659KB
stm32f1xx_hal_flash.crf 528KB
stm32f1xx_hal_tim_ex.o 633KB
stm32f1xx_hal_gpio_ex.crf 523KB
stm32f1xx_it.d 4KB
stm32f1xx_hal_tim_ex.d 4KB
stm32f1xx_hal_tim.o 746KB
stm32f1xx_hal_rcc_ex.o 579KB
stm32f1xx_it.o 590KB
new_SPWM_new_SPWM.dep 79KB
stm32f1xx_hal_flash_ex.crf 529KB
stm32f1xx_hal_tim_ex.crf 536KB
main.d 3KB
stm32f1xx_hal_adc.crf 537KB
stm32f1xx_hal_msp.o 587KB
stm32f1xx_hal_rcc.o 597KB
stm32f1xx_hal_rcc_ex.crf 526KB
new_SPWM.build_log.htm 2KB
new_SPWM.lnp 905B
ExtDll.iex 19B
stm32f1xx_hal_uart.crf 540KB
stm32f1xx_it.crf 524KB
stm32f1xx_hal_adc_ex.o 598KB
new_SPWM.sct 479B
stm32f1xx_hal_gpio.d 4KB
stm32f1xx_hal_rcc.d 4KB
stm32f1xx_hal_dma.o 597KB
stm32f1xx_hal_gpio.crf 527KB
stm32f1xx_hal_pwr.o 598KB
main.crf 526KB
new_SPWM.htm 57KB
new_SPWM.axf 619KB
stm32f1xx_hal_dma.d 4KB
stm32f1xx_hal_tim.crf 564KB
stm32f1xx_hal_gpio.o 587KB
startup_stm32f103xe.o 6KB
stm32f1xx_hal.crf 524KB
stm32f1xx_hal_dma.crf 535KB
stm32f1xx_hal_tim.d 4KB
system_stm32f1xx.crf 523KB
stm32f1xx_hal.o 606KB
stm32f1xx_hal_rcc.crf 535KB
stm32f1xx_hal_flash.o 595KB
stm32f1xx_hal.d 4KB
startup_stm32f103xe.d 55B
stm32f1xx_hal_flash.d 4KB
stm32f1xx_hal_pwr.d 4KB
stm32f1xx_hal_rcc_ex.d 4KB
stm32f1xx_hal_adc_ex.crf 532KB
stm32f1xx_hal_uart.d 4KB
stm32f1xx_hal_adc_ex.d 4KB
stm32f1xx_hal_flash_ex.d 4KB
stm32f1xx_hal_msp.d 4KB
stm32f1xx_hal_gpio_ex.d 4KB
stm32f1xx_hal_pwr.crf 526KB
main.o 584KB
new_SPWM.map 133KB
stm32f1xx_hal_cortex.crf 524KB
stm32f1xx_hal_gpio_ex.o 577KB
stm32f1xx_hal_cortex.d 4KB
stm32f1xx_hal_msp.crf 526KB
stm32f1xx_hal_adc.d 4KB
new_SPWM.hex 23KB
stm32f1xx_hal_cortex.o 599KB
startup_stm32f103xe.s 16KB
new_SPWM.uvguix.lenovo 167KB
mx.scratch 6KB
Src
stm32f1xx_it.c 9KB
system_stm32f1xx.c 16KB
stm32f1xx_hal_msp.c 10KB
main.c 13KB
.mxproject 8KB
Inc
main.h 3KB
stm32f1xx_it.h 3KB
stm32f1xx_hal_conf.h 14KB
new_SPWM.ioc 8KB
EWARM
Project.eww 152B
stm32f103xe_flash.icf 1KB
new_SPWM.ewp 30KB
stm32f103xe_sram.icf 1KB
startup_stm32f103xe.s 17KB
new_SPWM.ewd 11KB
共 92 条
- 1
资源评论
hyh1121
- 粉丝: 6
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功