AnsweredAssumed Answered

ADSP-21364 Problem with Peripheral TIMER Initialization

Question asked by Spas on Dec 16, 2010
Latest reply on Dec 16, 2010 by DivyaS

Hi, everybody!


I have a problem with initialization of Peripheral Timer
working in PWM OUT mode.
First i initialize the processor's PLL block than after
i initialize "TIMER0" by loading appropriate values in TM0PRD and TM0W registers,
but after this TM0CNT register don't load the value from TM0PRD register.


Below i aplicate the programing code which i wrote:


void PLLInit(void)
    *pPMCTL |= 0x80000000;                                      // disable PCLK to Peripheral Timer   
    sm("ustat2 = dm(PMCTL);");
    asm("bit set ustat2 PLLBP | PLLD4 |PLLM16;");     //set a multiplier of 16 and a divider of 4 and enable Bypass mode
    asm("r0 = 4096;");                                               // wait for PLL to lock at new rate (requirement for VCO change)
    asm("lcntr = r0, do pllwait until lce;");
    asm("pllwait: nop;");
    asm("ustat2 = dm(PMCTL);");
    asm("bit clr ustat2 PLLBP;");                                 // take PLL out of Bypass
    asm("dm(PMCTL) = ustat2;");
    asm("ustat2 = dm(PMCTL);");
    asm("bit set ustat2 DIVEN;");                            // Enable the DIVEN bit, PLL is now at CLKIN*4 (CoreCLK = CLKIN * M/D = CLKIN* 16/4)
    asm("dm(PMCTL) = ustat2;");


void TMR0Init(void)
    *pTM0STAT = 0x00000200;        //  Disable Timer_0
    *pTM0CTL  = 0x0000000D;        //  PWM_OUT mode for Timer_0, Positive active pulse is 1, count to end of period
    *pTM0PRD  = 0x0000FFFF;       //  Set period value
    *pTM0W    = 0x00007FFF;        //  Set pulse width
    *pTM0STAT = 0x00000100;       //  Enable Timer_0 and start of counting
    *pPMCTL  &= 0x7FFFFFFF;      //  enable PCLK to Peripheral Timer   


Can somebody to advise me what i have to do?