I have currently designed a PCB with a microcontroller, MAG3110 and MMA8451 to function as an electronic compass. The firmware installed on the microcontroller is a reduced version of Freescale's eCompass software. The hard iron and soft iron offsets are stored in flash, with no calibration routines being carried out on the microcontroller itself. When testing the functionality of the compass, the angles at 90, 180 and 270 degrees are all within 2 degrees of expected. The angle at 0 degrees is off by +9 to +10 degrees. This offset error is consistent with all of my PCB's as well as the LFSTBEB3110 development board. The error is at its most at 0deg although the error is significant between 350 degrees and 40 degrees. Has anyone else seen this type of functionality or known how to rectify this?
Two pieces of advice:
1. Magnetometer sensors have significant TCO (Temperature Coefficient of Offset). It is not a good idea to store values for calibration measured at one temperature only. Our reference software calibrates typically every few minutes to track temperature drift. That is the purpose of the magnetometer measurement buffer.
2. There is a new version (V3) of the eCompass software which is a bit better than V2 software, so I would recommend to upgrade to this new version.
I hope it helps.