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.

OMAPL138 PLL0中PLLCTL寄存器配置不成功



TI专家,各位朋友:

      我想把PLL0配置Bypass模式,可是发现PLLCTL寄存器无法写入。配置代码如下:

void PLL0_Bypass_Config(void)
{
	SysCfgRegistersUnlock();

	CFGCHIP0=CFGCHIP0&(~(1<<4));

	//Clear the PLLENSRC bit in PLLCTL to 0 (allows PLLEN bit to take effect).
	PLLCTL&=(~(1<<5));

	//For PLL0 only, select the clock source by programming the EXTCLKSRC bit in PLLCTL.
	PLLCTL&=(~(1<<9));

	//Clear the PLLEN bit in PLLCTL to 0 (PLL in bypass mode).
	PLLCTL=(~(0x00000001));

	//Wait for 4 OSCIN cycles to ensure that the PLLC has switched to bypass mode.

	for(num=0;num<4;num++)
	{
		asm(" NOP");
	}

	// Clear the PLLRST bit in PLLCTL to 0 (resets PLL).
	PLLCTL=PLLCTL&(~(1<<3));


	/*Set the PLLRST bit in PLLCTL to 1 to bring the PLL out of reset*/

	PLLCTL |= 0x8;

	/*Wait for PLL to lock. See PLL spec for PLL lock time*/

	for(num=0;num<2400;num++)
	{
		asm(" NOP");
	}

	CFGCHIP0=CFGCHIP0|((1<<4));

	SysCfgRegistersLock();
}

       执行完上面的函数后,PLLCTL寄存器的值没有发生变化。但是调试中在CFGCHIP0=CFGCHIP0|((1<<4));这句设置断点,通过CCS查看寄存器那里,可以修改PLLCTL寄存器的值。请问上面的配置哪里有问题吗?


 

  • wei lee1 说:
    /*Set the PLLRST bit in PLLCTL to 1 to bring the PLL out of reset*/ PLLCTL |= 0x8; /*Wait for PLL to lock. See PLL spec for PLL lock time*/ for(num=0;num<2400;num++) { asm(" NOP"); }

    对照TRM上8.2.2.3节来看,上面步骤似乎没有必要,虽然不知道与你说的问题是否相关,(其实我并不确认你是否真的遇到了问题)。还有芯片上电后就是pass模式。

    再者从TRM的figure 8-1来看,bypass只涉及PLLCTL这么几个bit。

  • #1:芯片上电后默认是bypass模式,我通过仿真器调试的时候,使用了gel,配置了PLL0和PLL1。main函数中想把PLL0重新调整为bypass模式。只所以这样做,是因为手册上说DSP进入DEEPSLEEP模式之前,需要先把PLL0给bypass。

    #2:后面的步骤确实有点多余,但是我确实是遇到了问题。PLLCTL的第0位PLLEN没法clear为0。

  • 感谢Tony
    问题解决了,是我犯了个幼稚的错误。把PLL1中PLLCTL寄存器的地址弄成PLL0中PLLCTL的了。

    由于我配置的时候CFGCHIP3相应的位没有打开,PLL1中的PLLCTL寄存器也没法写进去,所以调试的时候看这两个寄存器的值都没有发生变化。

    现在贴出来调试通过的代码:

    #define PLL0_PLLCTL (*(volatile unsigned int *)(0x01C11100))
    
    void PLL0_Bypass_Config(void)
    {
    int i=0;
    SysCfgRegistersUnlock();
    
    CFGCHIP0&=(~(1<<4));
    
    //Clear the PLLENSRC bit in PLLCTL to 0 (allows PLLEN bit to take effect).
    PLL0_PLLCTL&=(~(0x1<<5));
    
    //For PLL0 only, select the clock source by programming the EXTCLKSRC bit in PLLCTL.
    PLL0_PLLCTL&=(~(0x1<<9));
    
    //Clear the PLLEN bit in PLLCTL to 0 (PLL in bypass mode).
    PLL0_PLLCTL&=(~(0x1<<0));
    
    //Power down PLL0
    PLL0_PLLCTL|=((0x1<<1));
    
    //Wait for 4 OSCIN cycles to ensure that the PLLC has switched to bypass mode.
    
    for(i=0;i<4;i++)
    {
    asm(" NOP");
    }
    
    CFGCHIP0|=((1<<4));
    
    SysCfgRegistersLock();
    
    }