Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SysClockConf.cpp
00001 /* 00002 ****************************************************************************** 00003 * @file SysClockConf.c 00004 * @version 00005 * @date 05-July-2016 00006 * @brief System Clock configuration for STM32F103C8T6 00007 ***************************************************************************** 00008 * 00009 * All rights reserved. 00010 00011 This program is free software: you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your option) any later version. 00015 00016 This program is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #include "SysClockConf.h" 00026 #include "mbed.h" 00027 00028 void HSE_SystemClock_Config(void) { 00029 RCC_OscInitTypeDef RCC_OscInitStruct; 00030 RCC_ClkInitTypeDef RCC_ClkInitStruct; 00031 RCC_PeriphCLKInitTypeDef PeriphClkInit; 00032 00033 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; 00034 RCC_OscInitStruct.HSEState = RCC_HSE_ON; 00035 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; 00036 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 00037 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 00038 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; 00039 HAL_RCC_OscConfig(&RCC_OscInitStruct); 00040 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; 00041 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 00042 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 00043 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; 00044 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; 00045 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2); 00046 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB; 00047 PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; 00048 PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5; 00049 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit); 00050 } 00051 00052 void confSysClock(void) { 00053 HAL_RCC_DeInit(); 00054 HSE_SystemClock_Config(); 00055 SystemCoreClockUpdate(); 00056 }
Generated on Wed Jul 20 2022 04:40:14 by
