我们有一个设计的两个不同的修订版板、除了振荡器、在 DSP 部分没有任何变化。 具有20MHz 振荡器的旧板在电源复位后可以正常启动、但具有30MHz 振荡器的新板不能正常启动。 除了软件中的分频比、我们是否需要进行任何其他设置或更改才能启动新电路板、或者是否存在任何其他问题。 RAM 加载在两个版本上都正常工作。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我们有一个设计的两个不同的修订版板、除了振荡器、在 DSP 部分没有任何变化。 具有20MHz 振荡器的旧板在电源复位后可以正常启动、但具有30MHz 振荡器的新板不能正常启动。 除了软件中的分频比、我们是否需要进行任何其他设置或更改才能启动新电路板、或者是否存在任何其他问题。 RAM 加载在两个版本上都正常工作。
对于30MHz 版本、我们使用以下设置
#define DSP28_DIVSEL 2 //为 SYSCLKOUT 启用/2
#define DSP28_PLLCR 7
我们还尝试了以下选项、但没有改变
#define DSP28_DIVSEL 0 //为 SYSCLKOUT 启用/4
#define DSP28_PLLCR 6
和
#define DSP28_PLLCR 0 //在此模式中绕过 PLL
我们使用的20MHz 版本
#define DSP28_PLLCR 10
Fred、
谢谢、闪存 WS 应该可以、从100MHz (20MHz X -塔)变为105MHz (30MHz)都需要 WS=3、因此这不需要改变。
您能否确认是否正在使用 sysctrl.c 中的 InitPLL()函数来设置 PLL? 这更适合我确认这里的操作顺序。
您在30MHz X 直流转换器中看到的任何器件行为、例如、请参阅 XRSn 脉冲或任何有关代码在引导流程中可能已进入的位置的指示?
void InitPll(Uint16 val, Uint16 divsel) { // // Make sure the PLL is not running in limp mode // if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 0) { // // Missing external clock has been detected // Replace this line with a call to an appropriate // SystemShutdown(); function. // asm(" ESTOP0"); } // // DIVSEL MUST be 0 before PLLCR can be changed from // 0x0000. It is set to 0 by an external reset XRSn // This puts us in 1/4 // if (SysCtrlRegs.PLLSTS.bit.DIVSEL != 0) { EALLOW; SysCtrlRegs.PLLSTS.bit.DIVSEL = 0; EDIS; } // // Change the PLLCR // if (SysCtrlRegs.PLLCR.bit.DIV != val) { EALLOW; // // Before setting PLLCR turn off missing clock detect logic // SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1; SysCtrlRegs.PLLCR.bit.DIV = val; EDIS; // // Optional: Wait for PLL to lock. // During this time the CPU will switch to OSCCLK/2 until // the PLL is stable. Once the PLL is stable the CPU will // switch to the new PLL value. // // This time-to-lock is monitored by a PLL lock counter. // // Code is not required to sit and wait for the PLL to lock. // However, if the code does anything that is timing critical, // and requires the correct clock be locked, then it is best to // wait until this switching has completed. // // // Wait for the PLL lock bit to be set. // // // The watchdog should be disabled before this loop, or fed within // the loop via ServiceDog(). // // // Uncomment to disable the watchdog // DisableDog(); while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1) { // // Uncomment to service the watchdog // //ServiceDog(); } EALLOW; SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0; EDIS; } // // If switching to 1/2 // if((divsel == 1)||(divsel == 2)) { EALLOW; SysCtrlRegs.PLLSTS.bit.DIVSEL = divsel; EDIS; } // // NOTE: ONLY USE THIS SETTING IF PLL IS BYPASSED (I.E. PLLCR = 0) OR OFF // If switching to 1/1 // * First go to 1/2 and let the power settle // The time required will depend on the system, this is only an example // * Then switch to 1/1 // if(divsel == 3) { EALLOW; SysCtrlRegs.PLLSTS.bit.DIVSEL = 2; DELAY_US(50L); SysCtrlRegs.PLLSTS.bit.DIVSEL = 3; EDIS; } }
这应该是您的所有代码、我们可以运行30MHz 代码和闪存、并从旧板开始:
空 InitPll (uint16 val、uint16 divsel)
{
//确保 PLL 没有在跛形模式下运行
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS!= 0)
{
//检测到缺少外部时钟
//将此行替换为对相应行的调用
// SystemShutdown();函数。
// asm (" ESTOP0");
}
// DIVSEL 必须为0才能将 PLLCR 从更改为
// 0x0000。 通过外部复位 XRSn 将其设置为0
//这使我们进入1/4
if (SysCtrlRegs.PLLSTS.bit.DIVSEL!= 0)
{
EALLOW;
SysCtrlRegs.PLLSTS.bit.DIVSEL = 0;
EDIS;
}
//更改 PLLCR
if (SysCtrlRegs.PLLCR.bit.DIV!= val)
{
EALLOW;
//在设置 PLLCR 之前关闭缺少的时钟检测逻辑
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1;
SysCtrlRegs.PLLCR.bit.DIV = val;
EDIS;
//可选:等待 PLL 锁定。
//在此期间,CPU 将切换到 OSCCLK/2,直到
// PLL 是稳定的。 一旦 PLL 稳定、CPU 将会执行该操作
//切换到新的 PLL 值。
//
//此锁定时间由 PLL 锁定计数器监控。
//
//无需代码来等待 PLL 锁定。
//但是,如果代码执行任何对计时至关重要的操作,
//并要求锁定正确的时钟,则最好锁定
//等待此切换完成。
//等待 PLL 锁定位被置位。
//应在该循环之前禁用看门狗,或在其中馈送看门狗
//通过 ServiceDoG()的循环。
//取消注释以禁用看门狗
DisableDog ();
while (SysCtrlRegs.PLLSTS.bit.PLLLOCKS!= 1)
{
//取消注释以处理看门狗
// ServiceDoG();
}
EALLOW;
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0;
EDIS;
}
//如果切换到1/2
if (((divsel ==1)||(divsel ==2))
{
EALLOW;
SysCtrlRegs.PLLSTS.bit.DIVSEL = DIVsel;
EDIS;
}
//注意:只有当 PLL 被绕过时才使用此设置(即 PLLCR = 0)或关闭
//如果切换到1/1
//*首先转到1/2并让功率稳定下来
//所需的时间取决于系统,这只是一个示例
//*然后切换到1/1
if (divsel == 3)
{
EALLOW;
SysCtrlRegs.PLLSTS.bit.DIVSEL = 2;
DELAY_US (50L);
SysCtrlRegs.PLLSTS.bit.DIVSEL = 3;
EDIS;
}
}