Page 1 of 1

ARM

Posted: Sun Apr 24, 2011 9:32 pm
by wayne millard
Hi every body,

Can i get a 1us interrupt from the arm ecio?

Thanks,
Wayne :)

Re: ARM

Posted: Tue Apr 26, 2011 10:33 am
by Benj
Hello Wayne,

At the moment Flowcode only supports multiples of the prescaler clock allowing for a max interrupt rate of 93600Hz. I know there is a way of creating timer interrupts that are more controllable by changing the value that is loaded into the overflow register.

Probably by using the following line of C code with a timer 1 interrupt.

Configure the timer interrupt as follows.
Internal Count 1:2
Count Mode - 8bit

Then add the following line of C code after the interrupt enable icon.

AT91C_BASE_TC1->TC_RC = 0x00000018;

This is not perfect but it will give you an interrupt rate of approx 1.0016us.

Re: ARM

Posted: Tue Apr 26, 2011 11:30 am
by wayne millard
Thanks Benj

I will give it a go thanks for the fast reply.

Wayne :D

Re: ARM

Posted: Tue Apr 26, 2011 9:50 pm
by wayne millard
Hi BenJ,

i tried what you said but could not get to work what have i done wrong.
Checked with a oscilloscope only stays high.

Thanks,
Wayne

Re: ARM

Posted: Wed Apr 27, 2011 10:00 am
by Benj
Hello Wayne,

I have had a quick go here and its looking like the interrupt is triggering so fast that the main program never gets chance to run. Incrementing the timer overflow value a bit starts the program running as expected so I think this must be the problem. There must be more overhead to the interrupt routine then I originally thought. Sean is the guy who would know but he is currently away on holiday this week.

Re: ARM

Posted: Wed Apr 27, 2011 10:20 am
by wayne millard
Thanks benj,

i need to generate times from as little as 50us to 30ms to a accuracy of 1us. i tried with a pic could only get about 10us. so then got the arm development hopping that this would do it.

Thanks
Wayne

Re: ARM

Posted: Wed Apr 27, 2011 10:56 am
by Benj
Hello Wayne,

Ok you could do something like this.

You know that loading the value 0x18 into the timer rollover register gives a 1us delay so you can simply multiply up this number to give you the accurate delay you require.

eg
50us would equal 50 x 0x18 = 0x4B0
30ms would equal 30 x 1000 x 0x18 = 0xAFC80

So instead of multiple timer interrupts you simply have one that runs for the entire delay.

Re: ARM

Posted: Wed Apr 27, 2011 11:12 am
by wayne millard
Hi benj,

i need to calculate the time that i require in a menu. To generate a start and stop pulse's.
in a interrupt i counted the number of interrupts to give the required time.

So how would i do the same thing?

Thanks,
Wayne