AnsweredAssumed Answered

How to get waveform by Timer working with PWM_OUT mode in BF561?

Question asked by kevinxiao on Nov 8, 2012
Latest reply on Nov 19, 2012 by kevinxiao

Hi,

 

I want a f = 50KHz waveform, it's duty cycle  is  50%; My test code as follow, Could you tell me why it is failed?

And need i setting PF config register, if it is,how to do?

Thanks very much!

 

#include <ccblkfn.h>

#include "adi_initialize.h"

#include "AD7606_CoreA.h"

int main(void)

{

          /* Initialize managed drivers and/or services */

          adi_initComponents();

#ifndef RUN_ON_SINGLE_CORE

          *pSICA_SYSCR &= 0xFFDF; // clear bit 5 to unlock

#endif

          // set Clocks

          // sets Core clock to 600MHz (= 18 x 33MHz) and SCLK to 120MHz (=600Mhz / 5) on BUB

          Set_PLL( (short)(CORECLK/CLKIN), (short)(CORECLK/SYSCLK));

 

                    /* Set TMR1 as PWM_OUT mode and output 50KHz clk for AD7606 Convert A & B*/

                    // Disable Timer 1 first, in case there was an unexpected history.

                    *pTMRS8_DISABLE = TIMDIS1;

                    *pTIMER1_CONFIG = PERIOD_CNT | PULSE_HI | PWM_OUT;

                    *pTIMER1_PERIOD = 0x9600; //SCLK = 120MHz, PWM_CLK = 50KHz;

                    *pTIMER1_WIDTH  = 0x4800;            // duty cycle  of 50%

                    //Open timer1

                    *pTMRS8_ENABLE =  TIMEN1;

                    /*Set timer over*/

                    while(1)

                    {

                              asm("nop;");

                    }

}

Outcomes