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: LPC54618J512
31 mcu_data: ksdk2_0
32 processor_version: 0.0.17
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: FRO12M_clock.outFreq, value: 12 MHz}
68 - {id: FROHF_clock.outFreq, value: 48 MHz}
69 - {id: MAIN_clock.outFreq, value: 12 MHz}
70 - {id: System_clock.outFreq, value: 12 MHz}
71 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
72 /* clang-format on */
73
74 /*******************************************************************************
75 * Variables for BOARD_BootClockRUN configuration
76 ******************************************************************************/
77 /*******************************************************************************
78 * Code for BOARD_BootClockRUN configuration
79 ******************************************************************************/
BOARD_BootClockRUN(void)80 void BOARD_BootClockRUN(void)
81 {
82 /*!< Set up the clock sources */
83 /*!< Set up FRO */
84 POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); /*!< Ensure FRO is on */
85 CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally
86 being below the voltage for current speed */
87 POWER_SetVoltageForFreq(12000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */
88 CLOCK_SetFLASHAccessCyclesForFreq(12000000U); /*!< Set FLASH wait states for core */
89
90
91 /*!< Set up dividers */
92 CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Reset divider counter and set divider to value 1 */
93
94 /*!< Set up clock selectors - Attach clocks to the peripheries */
95 CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch MAIN_CLK to FRO12M */
96 /* Set SystemCoreClock variable. */
97 SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
98 }
99
100