打印
[微控制器/MCU]

NXP低功耗蓝牙集成芯片QN9080C的时钟配置

[复制链接]
646|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wdliming|  楼主 | 2019-1-22 10:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************************************
********************** Configuration BOARD_BootClockRUN ***********************
******************************************************************************/
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!Configuration
name: BOARD_BootClockRUN
called_from_default_init: true
outputs:
- {id: AHB_clock.outFreq, value: 16 MHz}
- {id: APB_clock.outFreq, value: 16 MHz}
- {id: RTC_SLETimer_clock.outFreq, value: 32.768 kHz}
- {id: RTC_clock.outFreq, value: 16 MHz}
- {id: WDT_clock.outFreq, value: 16 MHz}
settings:
- {id: SYSCON.AUTO_M_MULT.scale, value: '6'}
- {id: SYSCON.CLK_32K_SEL.sel, value: SYSCON.XTAL32K}
- {id: SYSCON.CLK_SYS_SEL.sel, value: SYSCON.XTAL_DIV}
- {id: SYSCON.XTAL_DIV.scale, value: '2', locked: true}
sources:
- {id: SYSCON.XTAL.outFreq, value: 32 MHz, enabled: true}
- {id: SYSCON.XTAL32K.outFreq, value: 32.768 kHz, enabled: true}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/

/*******************************************************************************
* Variables for BOARD_BootClockRUN configuration
******************************************************************************/
/*******************************************************************************
* Code for BOARD_BootClockRUN configuration
******************************************************************************/
void BOARD_BootClockRUN(void)
{
    /* Power up/Power down the module. */

    /* Set up clock selectors - Attach clocks to the peripheries 系统时钟树的选择*/
    CLOCK_AttachClk(k32M_to_XTAL_CLK);                  /* Switch XTAL_CLK to 32M, 1: external crystal is 32 MHz,选择外部晶振32MHz*/
    CLOCK_AttachClk(kXTAL32K_to_32K_CLK);                  /* Switch 32K_CLK to XTAL32K, 0: digital 32 kHz clock source is external 32 kHz crystal,选择外部晶振32.768kHz*/
    CLOCK_AttachClk(kXTAL_to_SYS_CLK);                  /* Switch SYS_CLK to XTAL, 01: external 16/32 MHz crystal,系统时钟CLS_SYS选择外部晶振32MHz或16MHz*/
    CLOCK_AttachClk(kAPB_to_WDT_CLK);                  /* Switch WDT_CLK to APB, 1: watchdog run at APB clock,看门狗时钟选择APB时钟*/

    /* Set up dividers 设置分频*/
    CLOCK_SetClkDiv(kCLOCK_DivOsc32mClk, 1U);      /* Set OSC32M_DIV divider to value 2 = 16MHz 1: divides 32 MHz OSC clock into 16 MHz,32MHz分频16MHz*/
    CLOCK_SetClkDiv(kCLOCK_DivXtalClk, 1U);        /* Set XTAL_DIV divider to value 2, divide crystal clock when external crystal is 32 MHz, 1: the SYS_CLK is 16 MHz*/
    CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 0U);         /* Set AHB_DIV divider to value 1, AHB_CLK: SYS_CLK / (AHB_DIV+1) AHP总线为16MHz/(0+1)= 16MHz*/
    CLOCK_SetClkDiv(kCLOCK_DivFrg1, 0U);           /* Set FRG_MULT1 to value 0, Set FRG_DIV1 to value 255 Flexcomm Clock Divider register*/
    CLOCK_SetClkDiv(kCLOCK_DivFrg0, 0U);           /* Set FRG_MULT0 to value 0, Set FRG_DIV0 to value 255 */
    CLOCK_SetClkDiv(kCLOCK_DivApbClk, 0U);         /* Set APB_DIV divider to value 1, APB总线=APB_CLK: AHB_CLK/(APB_DIV+1) = 16/(0+1)= 16MHz*/

    /* Enable/Disable clock out source and pins.*/

    /* Enable/Disable the specified peripheral clock.*/
}

以上就是NXP低功耗蓝牙集成芯片QN9080C的时钟配置案例,来自SDK,这里做了标注,就是RTC的时钟配置,代码中没有实现,只在开头处说是16MHz,以上是自己的学习记录,有错误的还请指出

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:我的未来不是梦

76

主题

913

帖子

4

粉丝