Frequency Counter (Update)

Spend some time this weekend and now have the display timer update callback working. I originally set it up to read from a queue, but that did work like I expected. To clarify, the callback worked well, since it was only pulling the data out of the queue. The issue came from putting the data in the queue.
Capturing frequency is really the counts per time period. To do this we tie a counter to an external pin and we see how many counts is has after a time period has expired. The software architecture would typically be to use a timer peripheral setup to fire an interrupt service routine (ISR) when the timer expires.

The process typically looks like this:

  1. Setup the timer so that the expiration period is the gate time.
  2. Clear the counter value.
  3. Enable the timer.

When the gate timer expires the ISR gets called and does the following:

  1. Stop the counter.
  2. Clear the interrupt flag.
  3. Calculate the frequency. (This may be done later)

So everything was going fine, until I tried to put a new entry in the queue.

Seems FreeRTOS compares the priority of the interrupt that is called to the ISR that is used for the system tick of the RTOS.

Now to figure out whether to continue down the path of using the queue, or to switch to just using a global variable.

I put the code on GitHub here.

Advertisements

About isaacdrose

Software Engineer. All around nerdy guy.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: