Skip to content

Commit 7650df6

Browse files
committed
Allow configuring cpu frequency through board_build.f_cpu.
1 parent eb50ef2 commit 7650df6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

system/CMSIS/system/system_LPC17xx.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,21 @@ void SystemInit (void)
559559

560560
LPC_SC->CCLKCFG = 0x00000002; /* Setup CPU Clock Divider */
561561

562-
if(isLPC1769()) {
562+
#if F_CPU == 120000000 && MCU_LPC1769
563563
LPC_SC->PLL0CFG = 0x0000000E; /* configure PLL0 */
564564
LPC_SC->PLL0FEED = 0xAA;
565565
LPC_SC->PLL0FEED = 0x55;
566-
} else {
567-
LPC_SC->PLL0CFG = 0x00010018; // 100MHz
566+
#elif F_CPU == 100000000
567+
LPC_SC->PLL0CFG = 0x00010018;
568568
LPC_SC->PLL0FEED = 0xAA;
569569
LPC_SC->PLL0FEED = 0x55;
570-
}
570+
#elif F_CPU == 96000000
571+
LPC_SC->PLL0CFG = 0x0000000B;
572+
LPC_SC->PLL0FEED = 0xAA;
573+
LPC_SC->PLL0FEED = 0x55;
574+
#else
575+
#error "The configured cpu frequency is not supported"
576+
#endif
571577

572578
LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
573579
LPC_SC->PLL0FEED = 0xAA;

0 commit comments

Comments
 (0)