Hello,
I am trying to drive timer 3 at 2 MHz, with a pulse of one timer tick (31.25 ns). My clock speed and timer ticks is at 32 MHz, so I use the timer 3 in modulo mode with T3CC0 = 0x10 for 500 ns period. I also set it at compare mode at T3CC1 = 0x01 for 31.25 ns pulse period. Using this settings and looking at the timer 3 output, I can only get a frequency of 470 KHz, and a pulse of 130 ns. Is timer 3 using a different clock source? Below is my code for your reference. Thanks for your help.
// *************** change clock speed
CLKCONCMD &= ~0x80; // select 32KHz XOSC source
while((CLKCONSTA & 0x80) == 0x80); // wait until stable
CLKCONCMD &= ~0x40; // select 32MHz XOSC source
while((CLKCONSTA & 0x40) == 0x40); // wait until stable
CLKCONCMD &= ~0x38; // select 32MHz timer ticks
CLKCONCMD &= ~0x07; // select 32MHz clock speed
// timer 3 initialization
PERCFG &= ~0x20; // set Timer3 alt1 location
P1SEL |= 0x18; // peripheral mode
T3CNT = 0; //T3 initial value
T3CTL = 0x02;//modulo mode
T3CC0 = 0x10; //overflow value
T3CCTL1 = 0x1C; //compare mode, set output on compare, clear on 0
T3CC1 = 0x01; // compare value
T3CTL |= 0x40; //clear timer3
T3CTL |= 0x10; //start timer3
while(1);