Personal tools

RTOS: CPU usage measurement

From Gluonpilot

Jump to: navigation, search

Quite often people ask my why I don't switch to a 32-bit microcontroller. 16bit at 40MIPS looks so ancient!

That's true, but people often forget that twice as fast is still slow! Efficient coding is more important here. The new trace features in FreeRTOS 7.0 allowed me to do some measurements. People familiar with the firmware will know that gluonpilot uses 7 threads (called tasks):

  • Control: highest priority
  • Sensors / Kalman
  • GPS input & navigation/script
  • Gluon control station input
  • Datalogging
  • Gluon control station output (telemetry)
  • OSD

A logic analyser allows us to visualise the running time of every thread (ordered according to "hard-RTOS" priority):

You can clearly see our control & kalman thread running at 50Hz, with the control thread having higher priority than Kalman (the latter one is interrupted sometimes). Other interesting things to notice are the huge overhead due to the telemetry being outputted by printf() and the synchronous output. This is an area that can use optimization!

Even I was surprised to see how little CPU cycles the firmware is using!

Tom (talk) • 19:34, 12 September 2012 • no comments

Automating your flight!

Contact page

Products Documentation ForumShop
Copyright (C)