Jump to content
clay_shooter

Using SysTicks to get interrupt callbacks?

Recommended Posts

I'd like to run interrupt handlers on timer functions. With the MSP430 I had to write a library for it. It looks like I should be able to use SystTicks functions like registerSysTickCb().  

 

How often would I get called?  80Mhz/???

Share this post


Link to post
Share on other sites

Thanks for the reply. I wasn't sure if it was 1ms or 1us. There are other posts floating around about delaymillis() vs delaymicros() and how they are implemented. I'm still not sure how micros are calculated if they aren't using SystTick, some other timer (5?) perhaps.

 

So in theory, I should be able to register a handler with registerSysTickCb() and get a callback every 1ms?

Share this post


Link to post
Share on other sites

It uses SysTick. It actually used to use another timer before but we recently converted it over to a pure-SysTick implementation. See wiring.c in hardware/lm4f/cores/lm4f for details.

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

So in theory, I should be able to register a handler with registerSysTickCb() and get a callback every 1ms?

Yup, beware though there is no way to "un"register your callback.

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

I was a little curious about the purpose behind that registerSysTickCb() function, since it seems to be "internal" to Energia and not exposed much or talked about; the only thing that uses it is the Tiva-C Ethernet library for TM4C129 where it provides a "tick" for the lwip stack.  So it's definitely there for others to abuse, although keeping the execution time low is important to avoid overrunning it ... and missing the next SysTick event due to being stuck in IRQ context.  But those Tiva's run pretty fast anyway.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×