Hello,
I'm trying to get Timer1 running as I want it. I'm using PIT but the frequency of the timer seems to be too slow. Does someone know on what frequency the Bus Clock runs?
I'm trying to get an interrupt every 31.25ns (3 cycles at 96MHz).
with this code I only get 716kHz at the output instead of 32MHz.
Thanks a lot for your help!
I'm trying to get Timer1 running as I want it. I'm using PIT but the frequency of the timer seems to be too slow. Does someone know on what frequency the Bus Clock runs?
I'm trying to get an interrupt every 31.25ns (3 cycles at 96MHz).
Code:
char CLKout = 2;
void setup() {
pinMode(CLKout, OUTPUT);
SIM_SCGC6 |= SIM_SCGC6_PIT;
PIT_MCR = 0x00;
NVIC_ENABLE_IRQ(IRQ_PIT_CH1);
PIT_LDVAL1 = 0x00000002; // setup Timer 1 for 3 cycles
PIT_TCTRL1 |= 0x00000003; // enable Timer 1 interrupts (TIE = 1) & start Timer 1 (TEN = 0)
}
void pit1_isr(void){
digitalWrite(CLKout,!digitalRead(CLKout));
PIT_TFLG1 = 0;
}
void loop() {
}
with this code I only get 716kHz at the output instead of 32MHz.
Thanks a lot for your help!