在线时间3 小时
UID3513824
注册时间2018-10-30
NXP金币0
TA的每日心情 | 怒 2018-11-1 15:00 |
---|
签到天数: 2 天 [LV.1]初来乍到
新手上路
- 积分
- 20
- 最后登录
- 2019-5-10
|
用官方工具MCUXpresso Config Tools v4.0
生成的C文件::
- /***********************************************************************************************************************
- * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
- * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
- **********************************************************************************************************************/
- /*
- * How to set up clock using clock driver functions:
- *
- * 1. Setup clock sources.
- *
- * 2. Setup voltage for the fastest of the clock outputs
- *
- * 3. Set up wait states of the flash.
- *
- * 4. Set up all dividers.
- *
- * 5. Set up all selectors to provide selected clocks.
- */
- /* clang-format off */
- /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
- !!GlobalInfo
- product: Clocks v4.0
- processor: LPC54606J512
- package_id: LPC54606J512BD100
- mcu_data: ksdk2_0
- processor_version: 3.0.1
- * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
- /* clang-format on */
- #include "fsl_power.h"
- #include "fsl_clock.h"
- #include "clock_config.h"
- /*******************************************************************************
- * Definitions
- ******************************************************************************/
- /*******************************************************************************
- * Variables
- ******************************************************************************/
- /* System clock frequency. */
- extern uint32_t SystemCoreClock;
- /*******************************************************************************
- ************************ BOARD_InitBootClocks function ************************
- ******************************************************************************/
- void BOARD_InitBootClocks(void)
- {
- BOARD_BootClockRUN();
- }
- /*******************************************************************************
- ********************** Configuration BOARD_BootClockRUN ***********************
- ******************************************************************************/
- /* clang-format off */
- /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
- !!Configuration
- name: BOARD_BootClockRUN
- called_from_default_init: true
- outputs:
- - {id: FRO12M_clock.outFreq, value: 12 MHz}
- - {id: FROHF_clock.outFreq, value: 96 MHz}
- - {id: MAIN_clock.outFreq, value: 180 MHz}
- - {id: SYSPLL_clock.outFreq, value: 180 MHz}
- - {id: System_clock.outFreq, value: 180 MHz}
- settings:
- - {id: SYSCON.MAINCLKSELB.sel, value: SYSCON.PLL_BYPASS}
- - {id: SYSCON.M_MULT.scale, value: '30', locked: true}
- - {id: SYSCON.N_DIV.scale, value: '1', locked: true}
- - {id: SYSCON.PDEC.scale, value: '2', locked: true}
- - {id: SYSCON_PDRUNCFG0_PDEN_SYS_PLL_CFG, value: Power_up}
- sources:
- - {id: SYSCON.fro_hf.outFreq, value: 96 MHz}
- * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
- /* clang-format on */
- /*******************************************************************************
- * Variables for BOARD_BootClockRUN configuration
- ******************************************************************************/
- /*******************************************************************************
- * Code for BOARD_BootClockRUN configuration
- ******************************************************************************/
- void BOARD_BootClockRUN(void)
- {
- /*!< Set up the clock sources */
- /*!< Set up FRO */
- POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); /*!< Ensure FRO is on */
- CLOCK_AttachClk(kFRO12M_to_MAIN_CLK); /*!< Switch to FRO 12MHz first to ensure we can change voltage without accidentally
- being below the voltage for current speed */
- POWER_SetVoltageForFreq(180000000U); /*!< Set voltage for the one of the fastest clock outputs: System clock output */
- CLOCK_SetFLASHAccessCyclesForFreq(180000000U); /*!< Set FLASH wait states for core */
- /*!< Set up SYS PLL */
- const pll_setup_t pllSetup = {
- .pllctrl = SYSCON_SYSPLLCTRL_SELI(32U) | SYSCON_SYSPLLCTRL_SELP(16U) | SYSCON_SYSPLLCTRL_SELR(0U),
- .pllmdec = (SYSCON_SYSPLLMDEC_MDEC(8191U)),
- .pllndec = (SYSCON_SYSPLLNDEC_NDEC(770U)),
- .pllpdec = (SYSCON_SYSPLLPDEC_PDEC(98U)),
- .pllRate = 180000000U,
- .flags = PLL_SETUPFLAG_WAITLOCK | PLL_SETUPFLAG_POWERUP
- };
- CLOCK_AttachClk(kFRO12M_to_SYS_PLL); /*!< Set sys pll clock source*/
- CLOCK_SetPLLFreq(&pllSetup); /*!< Configure PLL to the desired value */
- /*!< Set up dividers */
- CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!< Reset divider counter and set divider to value 1 */
- /*!< Set up clock selectors - Attach clocks to the peripheries */
- CLOCK_AttachClk(kSYS_PLL_to_MAIN_CLK); /*!< Switch MAIN_CLK to SYS_PLL */
- SYSCON->MAINCLKSELA = ((SYSCON->MAINCLKSELA & ~SYSCON_MAINCLKSELA_SEL_MASK) | SYSCON_MAINCLKSELA_SEL(0U)); /*!< Switch MAINCLKSELA to FRO12M even it is not used for MAINCLKSELB */
- /* Set SystemCoreClock variable. */
- SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
- }
复制代码
运行之后频率只有12MHZ,正常都有48mhz的,求教哪里出错了?
我就是在main里运行BOARD_BootClockRUN();
最佳答案
请将你在MCUXpresso Config Tools 配置完成的时钟走线截图一下,还有建议在debug时,查看相关寄存器的值,手动计算,进行二次确认
|
|