LPC43xx Chip_Clock_EnableCrystal Hard fault advisory

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC43xx Chip_Clock_EnableCrystal Hard fault advisory

978 次查看
Eli_H
NXP Pro Support
NXP Pro Support

I am posting this as I ran into this issue after starting some new development with the LPC4357.

The function void Chip_Clock_EnableCrystal(void) in the chip support library has a while loop delay to pause for the crystal osc. to stablize before engaging the PLL.   The "stock" value of 1000 is not quite enough for many crystals and/or layouts.   

I am using the embedded artists  4357 developer kit and found that I can get a hardfault during the PLL init phase about 50% of the time.  Simply making this larger fixes the issue.       In my case I make it very large (100000)  and the PLL starts 100%.

No to need to respond, I am just posting this as an advisory.   I ran into this back in 2013 with the LPCOpen libraries and completely forgot I had versions of the libraries with this patched.

标签 (2)
0 项奖励
回复
1 回复

884 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Eli,

Regarding the snippet of code, I think it is okay if you increase the delay as 100 000, it just waits for the stabilization of the  crystal.

Hope it can help you

BR

XiangJun rong

/* Enables the crystal oscillator */
void Chip_Clock_EnableCrystal(void)
{
    volatile uint32_t delay = 1000;

    uint32_t OldCrystalConfig = LPC_CGU->XTAL_OSC_CTRL;

    /* Clear bypass mode */
    OldCrystalConfig &= (~2);
    if (OldCrystalConfig != LPC_CGU->XTAL_OSC_CTRL) {
        LPC_CGU->XTAL_OSC_CTRL = OldCrystalConfig;
    }

    /* Enable crystal oscillator */
    OldCrystalConfig &= (~1);
    if (OscRateIn >= 20000000) {
        OldCrystalConfig |= 4;    /* Set high frequency mode */

    }
    LPC_CGU->XTAL_OSC_CTRL = OldCrystalConfig;

    /* Delay for 250uSec */
    while(delay--) {}
}

0 项奖励
回复