Other Parts Discussed in Thread: C2000WARE
主题中讨论的其他器件:C2000WARE
您好!
我正在配置我们的代码以从闪存运行。 当代码进入 PLL 的初始化例程时、它会停止、并且似乎 PLL 正在跛行模式下运行。 以前、我们的代码是从 RAM 中执行的、没有出现任何问题。 特定代码如下所示:
void InitPll()
{
//
// 1. Make sure the PLL is not running in limp mode
//
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 0)
{
EALLOW;
//
// OSCCLKSRC1 failure detected. PLL running in limp mode.
// Re-enable missing clock logic.
//
SysCtrlRegs.PLLSTS.bit.MCLKCLR = 1;
EDIS;
//
// Replace this line with a call to an appropriate
// SystemShutdown(); function.
//
asm(" ESTOP0"); // Uncomment for debugging purposes
}
接下来、我尝试了 C2000Ware 示例"flash_F2802x"。 运行此示例不会显示上述行为。 我注意到使用了不同的等待状态值、因此我在我们自己的代码中调整了等待状态、上述问题有所不同。 不过,我不明白原因。 以下是使用的特定值:
等待状态的旧值、其中 PLL 似乎处于跛形模式:
// Set the Paged Waitstate for the Flash // FlashRegs.FBANKWAIT.bit.PAGEWAIT = 0; // // Set the Random Waitstate for the Flash // FlashRegs.FBANKWAIT.bit.RANDWAIT = 1; // // Set the Waitstate for the OTP // FlashRegs.FOTPWAIT.bit.OTPWAIT = 1;
等待状态的新值运行正常:
// Set the Paged Waitstate for the Flash // FlashRegs.FBANKWAIT.bit.PAGEWAIT = 2; // // Set the Random Waitstate for the Flash // FlashRegs.FBANKWAIT.bit.RANDWAIT = 2; // // Set the Waitstate for the OTP // FlashRegs.FOTPWAIT.bit.OTPWAIT = 3;
对于"旧值"、我使用了数据表(SPRS523N)的表5-24、其中指定了所需的最小等待状态。 设置等待状态的代码在初始化 PLL 之前执行。 根据技术参考手册(SPRUI09)的理解、在复位 SYSCLKOUT 等于 2.5MHz 或400ns 后、会产生上述"旧值"。
是否有人知道 PLL 为什么会进入跛行模式?
此致、
Steven。
