mirror of https://github.com/ARMmbed/mbed-os.git
[DISCO_F429ZI] changed clock settings
Original STM32Cube F4 driver sets SYSCLK for STM32F429 to 16MHz. This adds a 168MHz and 180MHz configuration to system_stm32f4xx.c generated by STM32CubeMX code generator. The rtos clock configuration is changed too. In singletest.py run everything is OK.pull/797/head
parent
6f8f626bd6
commit
2002b797ad
|
@ -20,7 +20,21 @@
|
||||||
* be called whenever the core clock is changed
|
* be called whenever the core clock is changed
|
||||||
* during program execution.
|
* during program execution.
|
||||||
*
|
*
|
||||||
*
|
* This file configures the system clock as follows:
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* System clock source | PLL_HSE_XTAL | PLL_HSE_XTAL
|
||||||
|
* | (external 8 MHz clock) | (external 8 MHz clock)
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* SYSCLK(MHz) | 168 | 180
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* AHBCLK (MHz) | 168 | 180
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* APB1CLK (MHz) | 42 | 45
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* APB2CLK (MHz) | 84 | 90
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
|
* USB capable (48 MHz precise clock) | YES | NO
|
||||||
|
*--------------------------------------------------------------------------------------
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
|
@ -65,6 +79,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "stm32f4xx.h"
|
#include "stm32f4xx.h"
|
||||||
|
#include "hal_tick.h"
|
||||||
|
|
||||||
#if !defined (HSE_VALUE)
|
#if !defined (HSE_VALUE)
|
||||||
#define HSE_VALUE ((uint32_t)8000000) /*!< Default value of the External oscillator in Hz */
|
#define HSE_VALUE ((uint32_t)8000000) /*!< Default value of the External oscillator in Hz */
|
||||||
|
@ -120,6 +135,10 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Select the SYSCLOCK to start with (0=OFF, 1=ON) */
|
||||||
|
#define USE_SYSCLOCK_168 (1) /* Use external xtal */
|
||||||
|
#define USE_SYSCLOCK_180 (0) /* Use external clock */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
@ -135,7 +154,7 @@
|
||||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||||
variable is updated automatically.
|
variable is updated automatically.
|
||||||
*/
|
*/
|
||||||
uint32_t SystemCoreClock = 16000000;
|
uint32_t SystemCoreClock = 168000000;
|
||||||
__IO const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
__IO const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,6 +219,19 @@ void SystemInit(void)
|
||||||
#else
|
#else
|
||||||
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Configure the Cube driver */
|
||||||
|
SystemCoreClock = 16000000; // At this stage the HSI is used as system clock
|
||||||
|
HAL_Init();
|
||||||
|
|
||||||
|
/* Configure the System clock source, PLL Multiplier and Divider factors,
|
||||||
|
AHB/APBx prescalers and Flash settings */
|
||||||
|
SystemClock_Config();
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
/* Reset the timer to avoid issues after the RAM initialization */
|
||||||
|
TIM_MST_RESET_ON;
|
||||||
|
TIM_MST_RESET_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -508,6 +540,82 @@ void SystemInit_ExtMemCtl(void)
|
||||||
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
|
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
|
||||||
}
|
}
|
||||||
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
|
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
|
||||||
|
|
||||||
|
/** System Clock Configuration
|
||||||
|
*/
|
||||||
|
#if USE_SYSCLOCK_168 != 0
|
||||||
|
/*
|
||||||
|
* generated code by STM32CubeMX 4.4.0 for board 32F429Discovery
|
||||||
|
* and SYSCLK=168MHZ
|
||||||
|
*/
|
||||||
|
void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
|
||||||
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
|
RCC_OscInitStruct.HSEState = RCC_HSE_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_DIV2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||||
|
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||||
|
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|
||||||
|
|RCC_CLOCKTYPE_PCLK2;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif USE_SYSCLOCK_180 != 0
|
||||||
|
/*
|
||||||
|
* generated code by STM32CubeMX 4.4.0 for board 32F429Discovery
|
||||||
|
* and SYSCLK=180MHZ
|
||||||
|
*/
|
||||||
|
void SystemClock_Config(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||||
|
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||||
|
|
||||||
|
__PWR_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||||
|
|
||||||
|
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||||
|
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||||
|
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||||
|
RCC_OscInitStruct.PLL.PLLM = 8;
|
||||||
|
RCC_OscInitStruct.PLL.PLLN = 360;
|
||||||
|
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||||
|
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||||
|
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||||
|
|
||||||
|
HAL_PWREx_ActivateOverDrive();
|
||||||
|
|
||||||
|
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1
|
||||||
|
|RCC_CLOCKTYPE_PCLK2;
|
||||||
|
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||||
|
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||||
|
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||||
|
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||||
|
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -153,7 +153,7 @@
|
||||||
# define OS_CLOCK 72000000
|
# define OS_CLOCK 72000000
|
||||||
|
|
||||||
#elif defined(TARGET_STM32F429ZI)
|
#elif defined(TARGET_STM32F429ZI)
|
||||||
# define OS_CLOCK 16000000
|
# define OS_CLOCK 168000000
|
||||||
|
|
||||||
# else
|
# else
|
||||||
# error "no target defined"
|
# error "no target defined"
|
||||||
|
|
Loading…
Reference in New Issue