Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: How do I force interrupts?
PostPosted: Tue Dec 15, 2009 9:14 pm 
Offline

Joined: Thu Oct 23, 2008 7:47 pm
Posts: 9
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: