Peter Drescher / ST_401_84MHZ

Dependents:   Nucleo_spi_master_20MHz Nucleo_vs_Arduino_Speed_Test DMA_I2S_Test MPU9150AHRS ... more

Files at this revision

API Documentation at this revision

Comitter:
dreschpe
Date:
Wed Mar 05 19:38:06 2014 +0000
Child:
1:d19543ab3afa
Commit message:
Rev 1.0

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST_F401_84MHZ.cpp	Wed Mar 05 19:38:06 2014 +0000
@@ -0,0 +1,28 @@
+// use the STM32CubeMX Tool to calculate the register settings 
+// www.st.com/stm32cube‎ 
+// 
+
+#include "stm32f4xx_hal.h" 
+
+static void SystemClock_Config_84MHz_internal(void)
+{
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
+  RCC_OscInitTypeDef RCC_OscInitStruct;
+
+  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;                // internal 16MHz RC 
+  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
+  RCC_OscInitStruct.HSICalibrationValue = 6;
+  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;                              // PLL on
+  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
+  RCC_OscInitStruct.PLL.PLLM = 16;                                          // setup PLL divider
+  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);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ST_F401_84MHZ.h	Wed Mar 05 19:38:06 2014 +0000
@@ -0,0 +1,6 @@
+#ifndef MBED_ST_F401_84MHZ_H
+#define MBED_ST_F401_84MHZ_H
+
+static void SystemClock_Config_84MHz_internal(void);
+
+#endif
\ No newline at end of file