|
1 | 1 | /*
|
| 2 | + * The Clear BSD License |
2 | 3 | * Copyright (c) 2015, Freescale Semiconductor, Inc.
|
3 | 4 | * Copyright 2016-2017 NXP
|
| 5 | + * All rights reserved. |
4 | 6 | *
|
5 | 7 | * Redistribution and use in source and binary forms, with or without modification,
|
6 |
| - * are permitted provided that the following conditions are met: |
| 8 | + * are permitted (subject to the limitations in the disclaimer below) provided |
| 9 | + * that the following conditions are met: |
7 | 10 | *
|
8 | 11 | * o Redistributions of source code must retain the above copyright notice, this list
|
9 | 12 | * of conditions and the following disclaimer.
|
|
16 | 19 | * contributors may be used to endorse or promote products derived from this
|
17 | 20 | * software without specific prior written permission.
|
18 | 21 | *
|
| 22 | + * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. |
19 | 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20 | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21 | 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
45 | 49 | /* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************
|
46 | 50 | !!ClocksProfile
|
47 | 51 | product: Clocks v1.0
|
48 |
| -processor: LPC54618J512 |
49 |
| -package_id: LPC54618J512ET180 |
| 52 | +processor: LPC54628J512 |
| 53 | +package_id: LPC54628J512ET180 |
50 | 54 | mcu_data: ksdk2_0
|
51 | 55 | processor_version: 0.0.0
|
52 |
| -board: LPCXpresso54618 |
| 56 | +board: LPCXpresso54628 |
53 | 57 | * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/
|
54 | 58 |
|
55 | 59 | #include "fsl_power.h"
|
@@ -244,5 +248,65 @@ void BOARD_BootClockPLL180M(void)
|
244 | 248 | CLOCK_AttachClk(kSYS_PLL_to_MAIN_CLK); /*!< Switch System clock to SYS PLL 180MHz */
|
245 | 249 |
|
246 | 250 | /* Set SystemCoreClock variable. */
|
247 |
| - SystemCoreClock = BOARD_BootClockPLL180M_CORE_CLOCK; |
| 251 | + SystemCoreClock = BOARD_BOOTCLOCKPLL180M_CORE_CLOCK; |
248 | 252 | }
|
| 253 | + |
| 254 | +/******************************************************************************* |
| 255 | + ******************** Configuration BOARD_BootClockPLL220M ********************* |
| 256 | + ******************************************************************************/ |
| 257 | +/* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* |
| 258 | +!!Configuration |
| 259 | +name: BOARD_BootClockPLL220M |
| 260 | +called_from_default_init: true |
| 261 | +outputs: |
| 262 | +- {id: FRO12M_clock.outFreq, value: 12 MHz} |
| 263 | +- {id: FROHF_clock.outFreq, value: 48 MHz} |
| 264 | +- {id: MAIN_clock.outFreq, value: 220 MHz} |
| 265 | +- {id: SYSPLL_clock.outFreq, value: 220 MHz} |
| 266 | +- {id: System_clock.outFreq, value: 220 MHz} |
| 267 | +settings: |
| 268 | +- {id: SYSCON.MAINCLKSELB.sel, value: SYSCON.PLL_BYPASS} |
| 269 | +- {id: SYSCON.M_MULT.scale, value: '110', locked: true} |
| 270 | +- {id: SYSCON.N_DIV.scale, value: '3', locked: true} |
| 271 | +- {id: SYSCON.PDEC.scale, value: '2', locked: true} |
| 272 | +- {id: SYSCON_PDRUNCFG0_PDEN_SYS_PLL_CFG, value: Power_up} |
| 273 | + * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ |
| 274 | + |
| 275 | +/******************************************************************************* |
| 276 | + * Variables for BOARD_BootClockPLL220M configuration |
| 277 | + ******************************************************************************/ |
| 278 | +/******************************************************************************* |
| 279 | + * Code for BOARD_BootClockPLL220M configuration |
| 280 | + ******************************************************************************/ |
| 281 | +void BOARD_BootClockPLL220M(void) |
| 282 | +{ |
| 283 | + /*!< Set up the clock sources */ |
| 284 | + /*!< Set up FRO */ |
| 285 | + POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); /*!< Ensure FRO is on */ |
| 286 | + CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally |
| 287 | + being below the voltage for current speed */ |
| 288 | + POWER_SetVoltageForFreq(220000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */ |
| 289 | + CLOCK_SetFLASHAccessCyclesForFreq(220000000U); /*!< Set FLASH wait states for core */ |
| 290 | + |
| 291 | + /*!< Set up SYS PLL */ |
| 292 | + const pll_setup_t pllSetup = { |
| 293 | + .pllctrl = SYSCON_SYSPLLCTRL_SELI(34U) | SYSCON_SYSPLLCTRL_SELP(31U) | SYSCON_SYSPLLCTRL_SELR(0U), |
| 294 | + .pllmdec = (SYSCON_SYSPLLMDEC_MDEC(13243U)), |
| 295 | + .pllndec = (SYSCON_SYSPLLNDEC_NDEC(1U)), |
| 296 | + .pllpdec = (SYSCON_SYSPLLPDEC_PDEC(98U)), |
| 297 | + .pllRate = 220000000U, |
| 298 | + .flags = PLL_SETUPFLAG_WAITLOCK | PLL_SETUPFLAG_POWERUP |
| 299 | + }; |
| 300 | + CLOCK_AttachClk(kFRO12M_to_SYS_PLL); /*!< Set sys pll clock source*/ |
| 301 | + CLOCK_SetPLLFreq(&pllSetup); /*!< Configure PLL to the desired value */ |
| 302 | + |
| 303 | + /*!< Set up dividers */ |
| 304 | + CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Reset divider counter and set divider to value 1 */ |
| 305 | + |
| 306 | + /*!< Set up clock selectors - Attach clocks to the peripheries */ |
| 307 | + CLOCK_AttachClk(kSYS_PLL_to_MAIN_CLK); /*!< Switch MAIN_CLK to SYS_PLL */ |
| 308 | + SYSCON->MAINCLKSELA = ((SYSCON->MAINCLKSELA & ~SYSCON_MAINCLKSELA_SEL_MASK) | SYSCON_MAINCLKSELA_SEL(0U)); /*!< Switch MAINCLKSELA to FRO12M even it is not used for MAINCLKSELB */ |
| 309 | + /* Set SystemCoreClock variable. */ |
| 310 | + SystemCoreClock = BOARD_BOOTCLOCKPLL220M_CORE_CLOCK; |
| 311 | +} |
| 312 | + |
0 commit comments