Part Number: TMS320F28027
Other Parts Discussed in Thread: C2000WARE
Hi,
I am in the process of configuring our code to run from flash. When the code enters the initialization routine for the PLL, it stops and it appears that the PLL is running in limp mode. Before, our code was being executed from RAM and no problems appeared. The specific code looks like this:
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
}
Next, I tried the C2000Ware example "flash_f2802x". Running this example does not show the above behaviour. I noticed that different values for the waitstates were used, so I adjusted the waitstates in our own code and the above problem dissapears. However, I do not understand why. Below are the specific values used:
The old values for the waitstates, where it appears that the PLL is in limp mode:
// 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;
The new values for the waitstates, which runs fine:
// 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;
For the "old values", I used table 5-24 of the datasheet (SPRS523N) which specifies the minimum required wait states. The code of setting the wait states is executed before initializing the PLL. As I understand from the technical reference manual (SPRUI09), after a reset SYSCLKOUT equals 2.5 MHz or 400ns which resulted in the above "old values".
Does anyone have an idea why the PLL would go in limp mode?
Kind regards,
Steven.
