LPC11U14 interrupt at regular intervals

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U14 interrupt at regular intervals

1,957 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Frankb on Thu Nov 08 08:12:15 MST 2012
I´m using the LP11U14 to read out a gyroscope. Now I would like to do this every couple of miliseconds. For this I need a interrupt to occur exactly every 1 ms. I have tried to use the systick example found on the NXP website, but I found out it doesnt create an interrupt exactly every 1ms. Does anybody  know what is the accuracy of this systick system? And is there a way to increase the accuracy? Or maybe somebody has ideas on how to achieve my goal in a different way?
0 Kudos
Reply
9 Replies

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Sun Nov 11 13:17:29 MST 2012
I wrote this little tutorial for using a timer (in the LPC2129) as the tick system. Three things to consider:

1.- All timer modules accross NXP microcontrollers line (LPC2000 and LPC1000) are the same, so just adapt the values and name registers.

2.- You can adapt it for other things than that of system's tick

3.- It's in spanish :D but the Google's translator might help

http://fjrg76.wordpress.com/2012/10/21/generacion-del-tick-del-sistema-con-el-lpc2129/
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Fri Nov 09 10:01:28 MST 2012

Quote: Frankb
Sorry but I a real newb when it comes to microprocessors, so I have no idea on what to look for.


Look for the thing called "user manual" :p
Just kidding of course ... but once you found an example for the timer, also have a look at the section in the user manual describing the timers.

It might be good to know that most of the peripherals between the different LPC1xxx chips are the same. So the 32 bits timer on the lpc11u14 is the same as on the 1114, 1343, 1769 etc...

Rob
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Nov 09 02:14:27 MST 2012
UM10462 is describing basics of CT16 and CT32 in Chapter 15-16 :) There's also a CT32 sample in:

http://www.lpcware.com/content/nxpfile/sample-code-bundle-lpc11uxx-peripherals-using-lpcxpresso

For understanding basics you can also search for "LPC1114 timer" in this forum. There are a few samples which should show cature or match function :)
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Frankb on Fri Nov 09 01:41:42 MST 2012
Thanks for the information! Where can I find more on these standard timers? Sorry but I a real newb when it comes to microprocessors, so I have no idea on what to look for.
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Nov 08 09:27:23 MST 2012
Depends on your code (and of course optimization) :eek:
If serving your interrupt + interrupt code is reaching your timer interval LPC is busy with doing interrupt stuff and your main program is ignored :o
So I would avoid to trigger an interrupt faster than 1/10 ms and use another solution (like standard timer) :)
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Frankb on Thu Nov 08 09:10:26 MST 2012
That is great to hear :). I guess that setting the LED bit to 1 or 0 also takes some time which is not inluded in the delay... So I trust you guys that it works as it should :). If I try to set the interval to 1Us by setting:

SysTick_Config(SystemCoreClock / 1000000)

Would it still be very accurate? And what is the limit?
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Nov 08 08:46:47 MST 2012
In general, SysTick is a reliable time source :)

Your 1 ms setup isn't unusual also, so the problem is your faulty code ;)
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Frankb on Thu Nov 08 08:33:16 MST 2012
Well, it was a very crude test. I used the example to create an blinking light that turns on/off once every 10000 systicks. Then I let a stopwatch coincide with the blinking and I noticed that after an hour the blinking light was ahead about 1.5 seconds on the stopwatch. So I don´t know exactly how much it was off, but it was a vible difference, so either the stopwatch was wrong or the systicks :).
0 Kudos
Reply

1,886 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Thu Nov 08 08:19:04 MST 2012
Your example must be wrong.
I use FreeRTOS and that uses systick to create the OS tick and this works perfectly well.

How did you measure the systick interval?

Rob
0 Kudos
Reply