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.
Dependents: Nucleo_spi_master_20MHz Nucleo_vs_Arduino_Speed_Test DMA_I2S_Test MPU9150AHRS ... more
Revision 2:e5c1060ec62d, committed 2014-03-05
- Comitter:
- dreschpe
- Date:
- Wed Mar 05 22:19:14 2014 +0000
- Parent:
- 1:d19543ab3afa
- Child:
- 3:1d8106fcb4c5
- Commit message:
- Add external crystal X3 mode
Changed in this revision
| ST_F401_84MHZ.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ST_F401_84MHZ.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ST_F401_84MHZ.cpp Wed Mar 05 19:53:14 2014 +0000
+++ b/ST_F401_84MHZ.cpp Wed Mar 05 22:19:14 2014 +0000
@@ -25,4 +25,33 @@
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
-}
\ No newline at end of file
+}
+
+
+// use a external 8 MHz crystal to generate the CPU clock
+// You have to add X3 8MHz
+// C33,C34 18pF 0603
+// R35,R37 0R 0603 or use wire
+void SystemClock_Config_84MHz_external(void)
+{
+ RCC_ClkInitTypeDef RCC_ClkInitStruct;
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
+ RCC_OscInitTypeDef RCC_OscInitStruct;
+
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE;
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+ RCC_OscInitStruct.LSIState = RCC_LSI_ON;
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+ RCC_OscInitStruct.PLL.PLLM = 8;
+ RCC_OscInitStruct.PLL.PLLN = 336;
+ RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
+ RCC_OscInitStruct.PLL.PLLQ = 4;
+ HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1;
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+ HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
+
+}
--- a/ST_F401_84MHZ.h Wed Mar 05 19:53:14 2014 +0000 +++ b/ST_F401_84MHZ.h Wed Mar 05 22:19:14 2014 +0000 @@ -2,5 +2,6 @@ #define MBED_ST_F401_84MHZ_H void SystemClock_Config_84MHz_internal(void); +void SystemClock_Config_84MHz_external(void); #endif \ No newline at end of file