1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 05:45:31 +03:00

define PLL setting for overclock

This commit is contained in:
Faduf 2017-07-05 16:43:10 +02:00
parent 0a7a74965a
commit f47b438918
3 changed files with 10 additions and 5 deletions

View file

@ -268,11 +268,11 @@ void init(void)
#if defined(STM32F4) && !defined(DISABLE_OVERCLOCK) #if defined(STM32F4) && !defined(DISABLE_OVERCLOCK)
// If F4 Overclocking is set and System core clock is not correct a reset is forced // If F4 Overclocking is set and System core clock is not correct a reset is forced
if (systemConfig()->cpu_overclock && SystemCoreClock != 240000000) { if (systemConfig()->cpu_overclock && SystemCoreClock != OC_FREQUENCY_HZ) {
*((uint32_t *)0x2001FFF8) = 0xBABEFACE; // 128KB SRAM STM32F4XX *((uint32_t *)0x2001FFF8) = 0xBABEFACE; // 128KB SRAM STM32F4XX
__disable_irq(); __disable_irq();
NVIC_SystemReset(); NVIC_SystemReset();
} else if (!systemConfig()->cpu_overclock && SystemCoreClock == 240000000) { } else if (!systemConfig()->cpu_overclock && SystemCoreClock == OC_FREQUENCY_HZ) {
*((uint32_t *)0x2001FFF8) = 0x0; // 128KB SRAM STM32F4XX *((uint32_t *)0x2001FFF8) = 0x0; // 128KB SRAM STM32F4XX
__disable_irq(); __disable_irq();
NVIC_SystemReset(); NVIC_SystemReset();

View file

@ -505,9 +505,9 @@ void SystemInit(void)
void SystemInitOC(void) void SystemInitOC(void)
{ {
/* PLL setting for overclocking */ /* PLL setting for overclocking */
pll_n = 480; pll_n = PLL_N_OC;
pll_p = 2; pll_p = PLL_P_OC;
pll_q = 10; pll_q = PLL_Q_OC;
SystemInit(); SystemInit();
} }

View file

@ -32,6 +32,11 @@
extern "C" { extern "C" {
#endif #endif
#define PLL_N_OC 480
#define PLL_P_OC 2
#define PLL_Q_OC 10
#define OC_FREQUENCY_HZ PLL_N_OC/PLL_P_OC*1000000
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
extern void SystemInit(void); extern void SystemInit(void);
extern void SystemInitOC(void); extern void SystemInitOC(void);