Implementing Sensor Fusion for the FXOS8700CQ on Windows Compact 2013

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implementing Sensor Fusion for the FXOS8700CQ on Windows Compact 2013

856 Views
andrewking
Contributor I

I'm trying to calculate an accurate compass heading using a FXOS8700CQ unit (not on an MCU board).

 

We are running a Windows Compact 2013 BSP that provides access to data from the FXOS8700CQ unit mounted directly onto our device. The BSP is able to return two structures :

     struct COMPASS_READING { short X; short Y; short Z; } from the magnetometer, and 

     struct ACCEL_READING { short X; short Y; short Z; } from the accelerometer.

 

I've downloaded the example FreescaleSensorFusionRevision5 from NXP Sensor Fusion|NXP, and the code in the example uses these structures instead :

    struct MagSensor { int16 iBs[3]; int16 iBc[3]; float fBs[3]; float fBc[3]; int16 iCountsPeruT; float fuTPerCount; float fCountsPeruT; uint8 iWhoAmI; } and

    struct AccelSensor { int16 iGs[3]; int16 iCountsPerg; float fGs[3]; float fgPerCount; uint8 iWhoAmI; }

 

Additionally, the example applcation FreescaleSensorFusionRevision5 uses header files that are not included in the download (eg I2CFreedom.h, UART.h, FTM.h)

 

I'm trying to understand if we have enough information available from our BSP in order to be able to run the fusion algorithms, or if I need to take another approach based upon the information that I have available to me.

 

I've tried using other algorithms based upon calculating pitch and roll (to compensate for tilt) in order to determine a compass heading, but the calculations produce results that are very noisy, and don't seem to bear much relationship to compass heading.

 

An example file containing the readings that I am receiving is attached.

 

I'd appreciate any advice that anyone can offer

Original Attachment has been moved to: compass_data.txt.zip

Labels (1)
0 Kudos
1 Reply

412 Views
michaelestanley
NXP Employee
NXP Employee

Andrew,

First, apologies for the delayed response.  I missed the notification on your posting.

Your BSP is returning sensor values, which is all you need as far as raw data is concerned.  Do you know if the BSP already includes magnetic calibration software?  If not, you will need to include it yourself (it is part of the sensor fusion library).

I suggest you NOT start with the 5.00 sensor fusion.  The 7.xx variant is much more suited to your purposes, as it does not require Processor Expert to generate hardware interfaces, and instead relies on direct access to a lower level SDK, which is easily swapped out in favor of your BSP.  The 7.xx library can be included as part of either FRDM-K64F or FRDM-K22F SDKs generated at Welcome to MCUXpresso | MCUXpresso Config Tools .  Make sure you select the ISSDK and FreeRTOS options before you generate the SDK.  Documentation is in <sdkroot>/middleware/issdk_1.0/algorithms/sensorfusion/docs.

If you contact me directly at mike.stanley@nxp.com, I would be happy to set up a Skype session to talk through your issues.

Regards,

Mike

0 Kudos