1 /*
2 * Copyright 2018 NXP.
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 /***********************************************************************************************************************
9 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
10 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
11 **********************************************************************************************************************/
12 /*
13 * How to set up clock using clock driver functions:
14 *
15 * 1. Setup clock sources.
16 *
17 * 2. Setup voltage for the fastest of the clock outputs
18 *
19 * 3. Set up wait states of the flash.
20 *
21 * 4. Set up all dividers.
22 *
23 * 5. Set up all selectors to provide selected clocks.
24 */
25
26 /* clang-format off */
27 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
28 !!GlobalInfo
29 product: Clocks v5.0
30 processor: LPC54114J256
31 mcu_data: ksdk2_0
32 processor_version: 0.0.19
33 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
34 /* clang-format on */
35
36 #include "fsl_power.h"
37 #include "fsl_clock.h"
38 #include "clock_config.h"
39
40 /*******************************************************************************
41 * Definitions
42 ******************************************************************************/
43
44 /*******************************************************************************
45 * Variables
46 ******************************************************************************/
47 /* System clock frequency. */
48 extern uint32_t SystemCoreClock;
49
50 /*******************************************************************************
51 ************************ BOARD_InitBootClocks function ************************
52 ******************************************************************************/
BOARD_InitBootClocks(void)53 void BOARD_InitBootClocks(void)
54 {
55 BOARD_BootClockRUN();
56 }
57
58 /*******************************************************************************
59 ********************** Configuration BOARD_BootClockRUN ***********************
60 ******************************************************************************/
61 /* clang-format off */
62 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
63 !!Configuration
64 name: BOARD_BootClockRUN
65 called_from_default_init: true
66 outputs:
67 - {id: System_clock.outFreq, value: 12 MHz}
68 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
69 /* clang-format on */
70
71 /*******************************************************************************
72 * Variables for BOARD_BootClockRUN configuration
73 ******************************************************************************/
74 /*******************************************************************************
75 * Code for BOARD_BootClockRUN configuration
76 ******************************************************************************/
BOARD_BootClockRUN(void)77 void BOARD_BootClockRUN(void)
78 {
79 #ifndef SDK_SECONDARY_CORE
80 /*!< Set up the clock sources */
81 /*!< Set up FRO */
82 POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); /*!< Ensure FRO is on */
83 CLOCK_SetupFROClocking(12000000U); /*!< Set up FRO to the 12 MHz, just for sure */
84 CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally
85 being below the voltage for current speed */
86 POWER_SetVoltageForFreq(12000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */
87 CLOCK_SetFLASHAccessCyclesForFreq(12000000U); /*!< Set FLASH wait states for core */
88
89 /*!< Set up dividers */
90 CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Set AHBCLKDIV divider to value 1 */
91
92 /*!< Set up clock selectors - Attach clocks to the peripheries */
93 CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch MAIN_CLK to FRO12M */
94 /*< Set SystemCoreClock variable. */
95 SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
96 #endif
97 }
98
99