# FXAS12002

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

## FXAS12002

1,378 Views
Contributor II

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).

Labels (1)
• ### SensorFusion

1 Solution
1,081 Views
NXP Employee

Hi Richard,

I have observed your code and emailed you the correct calculation method. Please let me know if you have any questions

Thanks

Aswin

6 Replies
1,081 Views
NXP Employee

Hi Richard,

Can you please point me/inbox me the sample code you are using?

Thanks

Aswin

1,081 Views
Contributor II

Aswin

I can send you my code for this, can I have your email? I do not wish to put this code into forum.

1,081 Views
NXP Employee

Please inbox me the code at aswin.sivakumar@nxp.com

1,081 Views
Contributor II

I have posted the email over the weekend.

1,082 Views
NXP Employee

Hi Richard,

I have observed your code and emailed you the correct calculation method. Please let me know if you have any questions

Thanks

Aswin

1,081 Views
Contributor II

Thank you for your kind assistance and wish you nice summer vacation.