如题,FR5969开发板上用的是无源晶振,配置可以启动,但是自己画的板子上面用的是有源晶振,示波器可以看到晶振的波形,频率也都正确。卡在了 while(HWREG8(CS_BASE + OFS_CSCTL5) & LFXTOFFG)这个
下面是我的时钟初始化代码
- void SysClockInit(void)
- {
- GPIO_setAsPeripheralModuleFunctionInputPin(
- GPIO_PORT_PJ,
- GPIO_PIN4+ GPIO_PIN5,
- GPIO_PRIMARY_MODULE_FUNCTION
- );
- GPIO_setAsPeripheralModuleFunctionInputPin(
- GPIO_PORT_PJ,
- GPIO_PIN6 + GPIO_PIN7,
- GPIO_PRIMARY_MODULE_FUNCTION
- );
- // Set DCO frequency to 1 MHz
- CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_0);
- //Set external clock frequency to 32.768 KHz
- CS_setExternalClockSource(32768, 16000000);
- //Set ACLK=LFXT
- CS_initClockSignal(CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
- // Set SMCLK = DCO with frequency divider of 1
- CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
- // Set MCLK = DCO with frequency divider of 1
- CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1);
- //Start XT1 with no time out
- CS_turnOnLFXT(CS_LFXT_DRIVE_3);
- CS_turnOnHFXT(CS_HFXT_DRIVE_16MHZ_24MHZ);
- CS_turnOffHFXT();
- }
复制代码
这个先了解下的
一周热门 更多>