Thanks for your reply.
Unfortunately the magnetometer in the FXOS8700CQ is not immune to the gimbal lock.
----------------------
I've been going through all the algorithm in NXP Sensor Fusion Toolbox. Gaming Handset algorithm that does not use magnetometer also shows gimbal lock symptom. Which means the problem is nothing about the magnetometer. It should be the algorithm itself.
The gimbal lock is due to the limitation of the Euler Angles calculation method.
------------------
I have checked NSFK_Prod_UG.pdf which stated that:
"Rotation matrices have the advantage of always being unique. Euler angles are subject to gimbal lock and should not be used for internal calculations (only input/output of results). "
In addition, I have a glance at NXP sensor fusion which use quaternion in most of the calculations. Isn't quaternion immune to gimbal Lock?
Is this a known issue for NXP sensor fusion? Finally, how to solve this gimbal lock problem?