FreeRTOS : Timer req'd for run time stats

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User11773
Level 4
Level 4
First like received First solution authored
My timer ticks is a 1KHz rate.
I need a 32 bit timer running at 10KHz rate for run time stats. 10x Tick rate is recommended.
What timers to use?
Any example code?
I'm using Dave 4. XMC4700.
0 Likes
4 Replies
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

See the TIMER_EXAMPLE_XMC45 as a reference. It can be easily ported to XMC4700.
It will use a CCU4 or CCU8 slice to implement the timer.

4749.attach

Regards,
Jesus
0 Likes
User11773
Level 4
Level 4
First like received First solution authored
Thanks Jesus.
But FreeRTOS needs a 32 bit free run counter, counting at 10kHz rate.
And to be able to read the counter value quickly and atomically.
I have looked at the DAVE Timer app, but its not explained well how it works.
There is the TIMER_GetTime() function that returns a 32 bit value.
But its not clear to me what exactly it returns. It seems to imply 1 microsecond resolution. And not sure what to set Time Interval too.
Do I set Time Interval to 2^32 / 100?
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

You can concatenate two CCU4 slices to get a 32bit timer. See XMCLib example \XMCLib\examples\XMC4800_series\CCU4\CCU4_TIMER_CONCATENATION

Regards,
Jesus
0 Likes
User11773
Level 4
Level 4
First like received First solution authored
I've got it working. But .. I'm not sure I fully believe the numbers.
I used a Timer APP that triggers an interrupt. In the ISR/Handler I increment the Global variable "g_stat_timer_ticks++;" FreeRTOS App is then happy.
My Tick rate is 1000Hz, my Timer rate is 10x, 10KHz.
But, I suspect my Timer is too slow as some tasks report low utilization (<1%).
0 Likes