Tuesday, October 1, 2013

Kalman filter with dspic33f : fixed point vs floating point speed comparison

Initially, I implemented Kalman filter for Microchip dspic33f MPU with floating point arithmetic calculations(mainly 2x2 float matrices) to measure inclination angle. The filter works brilliantly. However, I knew that fixed point calculation can greatly speed up the floating point Kalman filter. Hence, I decided to implement my Kalman filter in Q16 format. After that, I compared speed of 2 algorithms by using an oscilloscope. The output pin is set at the beginning and cleared at the end of the Kalman process.
Floating point Kalman filter :

Fixed point Kalman filter :

From above pictures, the fixed Kalman filter uses only ~46% time taken by floating point Kalman filter. Note : My dspic33f runs at 80 MHz.

No comments:

Post a Comment