Hi
I also have FXAS12002 code sample from Freescale source for which I studied them including the FIFO transfer the code, offset and gain ,In simple term (which apply all axis)
(0) Gyroresult = 0
(1) For each FIFO element, collect 6 byte data and convert to X.Y.Z 16 bit raw data, ie GyroRaw. That freescale method.
(2) Do Offset GyroRaw = GyroRaw - Offset
(3) Do Gain Gyro = GyroRaw/Gain (fixed gain = 16, 32, 64 and 128 which in sync with freescale sample code).
(4) Sum up Gyroresult = Gyroresult + Gyro
Repeat above for 32 time,
Now I spin the board 360 deg within 1 second peroid, where FIFO buffer capture every 80mSec for 32 time which is 2.56 second period, then an interrupt take place and run above operation. Now I get Gyroresult as conclusion but number does not make sense unless I do the final step (from my calculaton)
(5) Gyroresult = Gyroresult/128 in order to get degree angle.
I now get close to 360deg angle (done rotation angle), I repeated this with different spin rate during 360 and conclusion is the same. I use stepper motor to do rotation for CW and CCW.
The step 5 does this puzzle me.....any thought about this, is there something I missing out?, any input?
I could not find any bug or issue so it must be working fine in accordance to Freescale spec and code sample but the code sample does not provide post FIFO operation code (ie data handling).
已解决! 转到解答。