I'm not clear about what precisely you're seeing and with which algorithm. The yaw should not be drifting with the 9 axis algorithm.
- If you're using the 6 axis accel+gyro algorithm (no magnetometer) then the yaw will drift since obviously you need a magnetic sensor to give yaw angle and stabilise the gyroscope in yaw
- If you're using the the 9 axis algorithm and it re-stabilises to the correct yaw angle after very aggressive rotation then you could easily be clipping the gyro. We always run the gyro at maximum 2000deg/sec for that reason. The human wrist is easily capable of 2500 deg/sec rotation. If you have the gyro set to a low range below 2000deg/sec then the gyro will clip, the gyro integration will be in error and you'll see a slow correction of those integration errors by the Kalman filter as it stabilizes to the magnetic vector.
To answer your questions specifically:
- we don't see drift in gyro yaw on the reference software
- the problem is likely in your gyro settings and not fixable by tweaking accel or magnetometer settings
If you have changed the gyro gain settings from the default 2000dps then make sure that you also change the gyro sensitivity setting in these lines in file drivers.c to match your new setting. See the datasheet for the gain setting to be used.
// place the gain for this full scale range into the gyro structure
FXAS21002_COUNTSPERDEGPERSEC 16 // for 2000dps=32000 counts
iCountsPerDegPerSec = FXAS21002_COUNTSPERDEGPERSEC;
fDegPerSecPerCount = 1.0F / FXAS21002_COUNTSPERDEGPERSEC;