Part Number: CC2541
I am trying to make sense of the cc2541 clock and timer3,but for some reason I get a longer time period then expected.
My board is running with 32Mhz external oscillator and I configures the clock as follow:
CLKCONCMD = (CLKCONCMD & ~(CLKCON_OSC | CLKCON_CLKSPD)) | CLKCON_CLKSPD_32M;
And Timer3:
T3CTL = T3CTL_DIV_1 | T3CTL_MODE_FREERUN | T3CTL_OVFIM | T3CTL_CLR | T3CTL_START;
in the Time3 isr function, I toggle an output and monitor it with a scope. The scope shows a square signal at about 32khz, or a period of 32uS.
If I correctly understand the configuration, Timer3 should be incremented 32M/sec and the isr should be invoked 32M/256 /sec. resulting a period of about 8uS, which is about 4 times shorter from what I actually get.
What am I missing ?
Here is my isr
#pragma vector = T3_VECTOR
__interrupt void t3_isr(void)
{
static uint8 on=0;
// Clears the module interrupt flag.
T3OVFIF = 0;
P1_0 = on; // toggle the output
on=!on;
// Clears the CPU interrupt flag.
T3IF = 0;
}