Hi all!
I'm using AT91sam7x256-EK, and one of purposes is a pulse counting in a tight time range, 10 microseconds. For this I use Timer-0 as a range-maker and Timer-1 as counter. Both start synchronously with a command:
Code:
AT91C_BASE_TCB->TCB_BCR = AT91C_TCB_SYNC;
(it's IAR EWARM 5.4)
Interrupt is called on Timer-0 RC-compare, and first stops the counter. When checked it with a 2MHz generator I found a result of 23 impulses instead of 20 expected. In a real task it can cause some mistakes, so I decided to use AIC feature "Fast Forcing" and see if it would help.
Code for new configure is:
Code:
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_FIQ] = (unsigned int) &ISR_Tc0;
AT91C_BASE_AIC->AIC_FFER = 1 << AT91C_ID_TC0;
AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_TC0) | (1 << AT91C_ID_FIQ);
I guess it's rather simple :) but it doesn't seem to work!
First I declared a handler for fast interrupt (it's void ISR_Tc0), then I enabled fast forcing of Timer-0 and at last enabled interrupts from Timer-0 and a Fast ones.
Do you think this forcing-stuff is going to help me at all? If so, how should I make it right?
Thanks for any help