<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FXAS21000 Zero-Rate Offset Compensation not working correctly. in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/FXAS21000-Zero-Rate-Offset-Compensation-not-working-correctly/m-p/349065#M1016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I believe I have resolved my problem.&amp;nbsp;&amp;nbsp; The key to getting the offset compensation to work is that the Gyro must be fully in the ACTIVE mode prior to initiating the Zero Compensation (setting ZR_cond).&amp;nbsp; Thus the Gyro init algo I am now using is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $40 to CTRL_REG1($13) to force a Soft Reset&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Wait a short time (2ms) for boot to complete&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $00 to CTRL_REG0($0D) to setup for +/-1600dps range and turn off Hi Pass Filter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Wrrte $06 to CTRL_REG1($13) to put device into ACTIVE mode with ODR=100Hz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Wait 325ms for device to transition from STANDBY mode to ACTIVE mode . spec says ODR/2+250)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $86 to CTRL_REG1($13) to Start Offset Compensation (ZR_cond=1) + Active+ ODR=100Hz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Read CTRL_REG1 repeatedly until it indicates Offset Compensation has finished&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So this inits the Gyro such that a main micro can poll the device to retrieve Gyro data (say ever 15ms).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Jan 2015 20:38:02 GMT</pubDate>
    <dc:creator>johnwolfe</dc:creator>
    <dc:date>2015-01-16T20:38:02Z</dc:date>
    <item>
      <title>FXAS21000 Zero-Rate Offset Compensation not working correctly.</title>
      <link>https://community.nxp.com/t5/Sensors/FXAS21000-Zero-Rate-Offset-Compensation-not-working-correctly/m-p/349064#M1015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am seeking help/advice on initializing the FXAS21000 gyro chip.&amp;nbsp; I am using the FRDMK64 board and the Xtrinsic board. The WHO_AM_I response from this chip is $D1 indicating this is a FXAS21000 chip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It seems that only on cold power on does the gyro chip come up with offset compensations that appear somewhat reasonable.&amp;nbsp;&amp;nbsp; This results in gyro values of -4.0 to +4.0 dps for each axis when later retrieving data via polling (I have interrupts turned off)…although this still seems a little high to me.&amp;nbsp; I have it configured for +/-1600 range with ODR=200Hz, and the K64 is sampling and retrieving data every 12ms.&amp;nbsp; I keep the FXAS21000 in Active state at all times when running.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; However, when doing a K64 running reset or FRDM64 reset (push reset button),&amp;nbsp; the FW will run through the init code for the FXAS21000 chip but the offset compensation does not&amp;nbsp; appear to work.&amp;nbsp; I can show this by first purposely moving the device during power up to establish bad offset compensation values. Lets say after I do this that subsequent polling of data shows&amp;nbsp; X/Y/Z = +50.0/-20.0/2.0 when the device is not moving.&amp;nbsp; Then keeping device steady (unmoving), when I do a K64 micro reset (press reset button on FRDM board),&amp;nbsp; after FW initialization and when polling I now get&amp;nbsp; values of X/Y/Z = -50.0/+20.0/-2.0, plus or minus say 4dps on each.&amp;nbsp; NOTICE the sign of the values have changed. If I do reset again they signs invert again.&lt;/P&gt;&lt;P style="padding-left: 45px;"&gt;I have tried 3 different algorithms shown below, but they all give me the same results. &lt;BR /&gt;It appears that after initialization, when polling I get reasonable values from the device as it is moved…it is just that the offset may not be correct.&lt;/P&gt;&lt;P style="padding-left: 45px;"&gt;Can anyone identify the common problem on these init steps, or suggest what steps I should try instead.&amp;nbsp; Any help would be greatly appreciated. For example, in Algo 1 it purposely moves the device to Active mod and waits for first data to be acquired because the Spec suggests that ZR_cond should not be set unless there are first samples available??&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;BR /&gt;John Wolfe&lt;/P&gt;&lt;P&gt;Algo #1:&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read INT_SOURCE_FLAG($0B)&amp;nbsp; until BOOTEND flag is SET&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 112px;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;SPAN class="pasted-list-info"&gt;o&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Because if Power on cycle Gyro could be going through boot&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$40 to do Soft Reset (RST=1)&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 112px;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;SPAN class="pasted-list-info"&gt;o&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Because if only K64 running reset want to force gyro with init values&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read INT_SOURCE_FLAG($0B)&amp;nbsp; until&amp;nbsp; BOOTEND flag is SET&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 112px;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;SPAN class="pasted-list-info"&gt;o&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Because Soft Reset causes gyro to go through boot&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG0($0D)=$00 for range of +/- 1600 and hi-pass filter disabled&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$02 to move to Active Mode&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 112px;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;SPAN class="pasted-list-info"&gt;o&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Because FXAS21000 spec says “ZR_cond may be written only after the first sample is available, as it uses the current sample for calibrations.&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read DR_STATUS until ZDR, YDR, XDR are set (we have valid data)&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$82 to start Offset compensation (ZR_Comp=1) &lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read CTRL_REG1($13) until ZR_Comp=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Algo #2: &lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$40 to do Soft Reset (RST=1)&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Delay a short time&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG0($0D)=$00 for range of +/- 1600 and hi-pass filter disabled&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$82 to force into ACTIVE mode and initiate Zero Compenstation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Algo #3: Similar to init algo at “FXAS21000 Bare metal Example project” at&amp;nbsp; &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-100869" target="_blank"&gt;https://community.freescale.com/docs/DOC-100869&lt;/A&gt;&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read INT_SOURCE_FLAG($0B)&amp;nbsp; until BOOTEND flag is SET&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 112px;"&gt;&lt;SPAN style="font-family: 'Courier New';"&gt;&lt;SPAN class="pasted-list-info"&gt;o&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;Because whole device powered Gyro could be going through boot&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$40 to do Soft Reset (RST=1)&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read CTRL_REG1 until&amp;nbsp; RST is CLEARed &lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$80 to start Offset compensation (ZR_Comp=1)&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Repeatedly read CTRL_REG1($13) until ZR_Comp=0&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG0($0D)=$00 for range of +/- 1600 and hi-pass filter disabled&lt;/P&gt;&lt;P style="text-indent: -0.25in; padding-left: 67px;"&gt;&lt;SPAN class="pasted-list-info"&gt;-&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Write CTRL_REG1($13)=$02 to put into ACTIVE mode.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 21:10:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/FXAS21000-Zero-Rate-Offset-Compensation-not-working-correctly/m-p/349064#M1015</guid>
      <dc:creator>johnwolfe</dc:creator>
      <dc:date>2026-02-03T21:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: FXAS21000 Zero-Rate Offset Compensation not working correctly.</title>
      <link>https://community.nxp.com/t5/Sensors/FXAS21000-Zero-Rate-Offset-Compensation-not-working-correctly/m-p/349065#M1016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I believe I have resolved my problem.&amp;nbsp;&amp;nbsp; The key to getting the offset compensation to work is that the Gyro must be fully in the ACTIVE mode prior to initiating the Zero Compensation (setting ZR_cond).&amp;nbsp; Thus the Gyro init algo I am now using is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $40 to CTRL_REG1($13) to force a Soft Reset&lt;BR /&gt;&amp;nbsp;&amp;nbsp; - Wait a short time (2ms) for boot to complete&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $00 to CTRL_REG0($0D) to setup for +/-1600dps range and turn off Hi Pass Filter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Wrrte $06 to CTRL_REG1($13) to put device into ACTIVE mode with ODR=100Hz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Wait 325ms for device to transition from STANDBY mode to ACTIVE mode . spec says ODR/2+250)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Write $86 to CTRL_REG1($13) to Start Offset Compensation (ZR_cond=1) + Active+ ODR=100Hz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; - Read CTRL_REG1 repeatedly until it indicates Offset Compensation has finished&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So this inits the Gyro such that a main micro can poll the device to retrieve Gyro data (say ever 15ms).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2015 20:38:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/FXAS21000-Zero-Rate-Offset-Compensation-not-working-correctly/m-p/349065#M1016</guid>
      <dc:creator>johnwolfe</dc:creator>
      <dc:date>2015-01-16T20:38:02Z</dc:date>
    </item>
  </channel>
</rss>

