<?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: ecompass rollover from +180 to -180 in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649978#M4125</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lucas,&lt;/P&gt;&lt;P&gt;There have been multiple eCompass applications built over the years, by different individuals/businesses within NXP.&lt;/P&gt;&lt;P&gt;Can you tell me exactly which software release you are using and the URL you got it from?&lt;/P&gt;&lt;P&gt;I ask because the current sensor fusion release (7.1) has a 0 to 360 compass heading range. &amp;nbsp;There's no rollover at 180 degrees. it happens at 0/360. &amp;nbsp;We rolled the magnetic calibration software into the sensor fusion builds several years back. &amp;nbsp;Is it possible you have an older release of just the eCompass software or a standalone project that is not part of the standard NXP sensor fusion release?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other reason I suspect a different application is that the standard sensor fusion kit has a binary interface back to the sensor fusion toolbox. &amp;nbsp;There's no way you could easily decipher it in putty. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The MCUXpresso SDK builder at&amp;nbsp;&lt;A class="link-titled" href="https://mcuxpresso.nxp.com/en/welcome" title="https://mcuxpresso.nxp.com/en/welcome"&gt;Welcome to MCUXpresso | MCUXpresso Config Tools&lt;/A&gt;&amp;nbsp; can be used to build a K22F SDK. &amp;nbsp;Make sure you select the ISSDK and FreeRTOS options. &amp;nbsp;Try the application under SDK_2.1_FRDM-K22F/boards/frdmk22f_agm01/issdk_examples/algorithms/sensorfusion. &amp;nbsp;You will also need the Sensor Fusion Toolkit, which can be downloaded from nxp.com/sensorfusion.&lt;/P&gt;&lt;P&gt;Please let me know if that helps.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Apr 2017 16:00:35 GMT</pubDate>
    <dc:creator>michaelestanley</dc:creator>
    <dc:date>2017-04-05T16:00:35Z</dc:date>
    <item>
      <title>ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649977#M4124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with the Sensor Fusion ecompass software with an FRDM-K22F + FRDM-STBC-AGM01 demo board combo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The range of compass angles output is -180 to +180. When looking at the Compass Angle output in a putty window everything looks good except when the angle approaches and passes 180. Instead of transitioning smoothly like 177,178,179,180,-179,-178,-177 the device does a complete rollover. It gets to about 178 then begins to drop in 10 degree increments until it wraps back to -180. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;175&lt;/P&gt;&lt;P&gt;176&lt;/P&gt;&lt;P&gt;177&lt;/P&gt;&lt;P&gt;160&lt;/P&gt;&lt;P&gt;150&lt;/P&gt;&lt;P&gt;140&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;10&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;-10&lt;/P&gt;&lt;P&gt;-20&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;-160&lt;/P&gt;&lt;P&gt;-170&lt;/P&gt;&lt;P&gt;-175&lt;/P&gt;&lt;P&gt;-176&lt;/P&gt;&lt;P&gt;-177&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It takes about 50 readings for the compass angle to wrap around to the correct negative value. Hopefully this explanation is clear. I have multiple excel data dumps explicitly profiling the event, but I doubt that level of detail is necessary to debug this. This event occurs when transitioning from positive to negative as well as from negative to positive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anybody else seeing this? I'm using freescale hardware and the sensor fusion library and haven't edited the code in any way regarding the readings. Everything is factory stock hardware and software. This rollover event is a real killer as anytime the ecompass is in the &amp;nbsp;+/-3 degree range of 180 the reading is invalid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this has been answered somewhere else please point me there and sorry for the redundancy!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2026 22:02:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649977#M4124</guid>
      <dc:creator>lucasbaer</dc:creator>
      <dc:date>2026-02-03T22:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649978#M4125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lucas,&lt;/P&gt;&lt;P&gt;There have been multiple eCompass applications built over the years, by different individuals/businesses within NXP.&lt;/P&gt;&lt;P&gt;Can you tell me exactly which software release you are using and the URL you got it from?&lt;/P&gt;&lt;P&gt;I ask because the current sensor fusion release (7.1) has a 0 to 360 compass heading range. &amp;nbsp;There's no rollover at 180 degrees. it happens at 0/360. &amp;nbsp;We rolled the magnetic calibration software into the sensor fusion builds several years back. &amp;nbsp;Is it possible you have an older release of just the eCompass software or a standalone project that is not part of the standard NXP sensor fusion release?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other reason I suspect a different application is that the standard sensor fusion kit has a binary interface back to the sensor fusion toolbox. &amp;nbsp;There's no way you could easily decipher it in putty. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The MCUXpresso SDK builder at&amp;nbsp;&lt;A class="link-titled" href="https://mcuxpresso.nxp.com/en/welcome" title="https://mcuxpresso.nxp.com/en/welcome"&gt;Welcome to MCUXpresso | MCUXpresso Config Tools&lt;/A&gt;&amp;nbsp; can be used to build a K22F SDK. &amp;nbsp;Make sure you select the ISSDK and FreeRTOS options. &amp;nbsp;Try the application under SDK_2.1_FRDM-K22F/boards/frdmk22f_agm01/issdk_examples/algorithms/sensorfusion. &amp;nbsp;You will also need the Sensor Fusion Toolkit, which can be downloaded from nxp.com/sensorfusion.&lt;/P&gt;&lt;P&gt;Please let me know if that helps.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2017 16:00:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649978#M4125</guid>
      <dc:creator>michaelestanley</dc:creator>
      <dc:date>2017-04-05T16:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649979#M4126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the prompt reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the workflow I followed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I went to:&amp;nbsp;&lt;A class="link-titled" href="https://mcuxpresso.nxp.com/en/welcome" title="https://mcuxpresso.nxp.com/en/welcome"&gt;Welcome to MCUXpresso | MCUXpresso Config Tools&lt;/A&gt;&amp;nbsp;and created an SDK for my hardware platform (FRDM-K22F-AGM01).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Download SDK&lt;/P&gt;&lt;P&gt;Unzip SDK&lt;/P&gt;&lt;P&gt;Open Kinetis Design Studio&lt;/P&gt;&lt;P&gt;File-&amp;gt;New-&amp;gt;Kinetis SDK 2.x Project&lt;/P&gt;&lt;P&gt;Navigate to the SDK downloaded from the link listed above&lt;/P&gt;&lt;P&gt;Name Project, Hit Next&lt;/P&gt;&lt;P&gt;Go through nested menus as follows: Boards-&amp;gt;FRDM-K22F board-&amp;gt;Examples-&amp;gt;demo_apps-&amp;gt;ecompass&lt;/P&gt;&lt;P&gt;Here is a picture:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17704i9185EF4FBBDBA721/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click Finish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From here I have a full source code project I can work with in Kinetis Design Studio. This project builds fine and I have edited it successfully, adding some debug statements, button pushes, etc. I have not touched any of the ecompass code. The fact that I am able to build, load and debug the program on the target hardware makes me feel like I didn't miss any check boxes or fat finger something anywhere in the download process. As far as the project goes the magnetic calibration is built in, and once complete the program repeatedly prints the ecompass reading over a COM port to a putty window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a copy of the readme.txt file that is included with the project:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Overview&lt;BR /&gt;========&lt;BR /&gt;The E-Compass demo application demonstrates the use of the FXOS8700 sensor. The tilt-compensated algorithm calculates&lt;BR /&gt;all three angles (pitch, roll, and yaw or compass heading).&lt;/P&gt;&lt;P&gt;Toolchain supported&lt;BR /&gt;===================&lt;BR /&gt;- IAR embedded Workbench 7.70.1&lt;BR /&gt;- Keil MDK 5.20&lt;BR /&gt;- GCC ARM Embedded 2015-4.9-q3&lt;BR /&gt;- Kinetis Development Studio IDE 3.2.0&lt;BR /&gt;- Atollic TrueSTUDIO 5.5.2&lt;/P&gt;&lt;P&gt;Hardware requirements&lt;BR /&gt;=====================&lt;BR /&gt;- Mini/micro USB cable&lt;BR /&gt;- FRDMK22F board&lt;BR /&gt;- Personal Computer&lt;/P&gt;&lt;P&gt;Board settings&lt;BR /&gt;==============&lt;BR /&gt;No special settings are required.&lt;/P&gt;&lt;P&gt;Prepare the Demo&lt;BR /&gt;================&lt;BR /&gt;1. Connect a USB cable between the host PC and the OpenSDA USB port on the target board.&lt;BR /&gt;2. Open a serial terminal with the following settings:&lt;BR /&gt; - 115200 baud rate&lt;BR /&gt; - 8 data bits&lt;BR /&gt; - No parity&lt;BR /&gt; - One stop bit&lt;BR /&gt; - No flow control&lt;BR /&gt;3. Download the program to the target board.&lt;BR /&gt;4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.&lt;/P&gt;&lt;P&gt;Running the demo&lt;BR /&gt;================&lt;BR /&gt;When the demo runs successfully, you can see the information below printed to the terminal.&lt;/P&gt;&lt;P&gt;Note: you must rotate the board 360 degrees to get the max / min value of the magnetic field.&lt;/P&gt;&lt;P&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;To calibrate Magnetometer, roll the board on all orientations to get max and min values&lt;BR /&gt;Press any key to start calibrating...&lt;/P&gt;&lt;P&gt;Calibrating magnetometer...&lt;BR /&gt;Calibrate magnetometer successfully!&lt;BR /&gt;Magnetometer offset Mx: 313 - My: 432 - Mz: 494&lt;BR /&gt;Compass Angle: xxxx&lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;Customization options&lt;BR /&gt;=====================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this is enough info to figure out what I'm working with. This ecompass output of this project definitely is ranged from -180 to +180.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 06:29:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649979#M4126</guid>
      <dc:creator>lucasbaer</dc:creator>
      <dc:date>2017-04-06T06:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649980#M4127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Lucas, I found it. &amp;nbsp;This example was up to date maybe 8 years ago, but we've gotten much better since. &amp;nbsp;I need to see if I can get this one removed from the SDK. &amp;nbsp;It is not based on the sensor fusion library, and a quick inspection of the code shows it's offers only a 1st order hard iron computation. &amp;nbsp;I suggest you switch to the examples I pointed you to above. &amp;nbsp;They provide not only basic eCompass, but a full 9-axis version that is far superior.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Apr 2017 15:57:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649980#M4127</guid>
      <dc:creator>michaelestanley</dc:creator>
      <dc:date>2017-04-06T15:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649981#M4128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your support. I'm glad there is new, much improved code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I probably should have prefaced this post with the fact that I am a complete neophyte to the world of kinetis, sensor fusion, KDS, etc. (Now Coldfire V1 + Codewarrior + Processor Expert? That's another story - domination!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My belief is that the workflow is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Navigate to&amp;nbsp;&lt;A data-content-finding="Community" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fmcuxpresso.nxp.com%2Fen%2Fwelcome" rel="nofollow" style="color: #5e89c1; background-color: #ffffff; border: 0px; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;Welcome to MCUXpresso | MCUXpresso Config Tools&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Create an SDK, download and unzip it&lt;/P&gt;&lt;P&gt;Open KDS -&amp;gt; File -&amp;gt; New -&amp;gt; Kinetis SDK 2.x Project&amp;nbsp;&lt;/P&gt;&lt;P&gt;Point to recently unzipped SDK&lt;/P&gt;&lt;P&gt;Select the specific project you want from the dropdown&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I have accomplished this. When I do so I'm presented with the following menus:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/17629iC4AD62620F86BC61/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this what you were referring to when you recommended the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Try the application under SDK_2.1_FRDM-K22F/boards/frdmk22f_agm01/issdk_examples/algorithms/sensorfusion&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;If not, where is the recommended application?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;I have indeed downloaded the Sensor Fusion Toolkit.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Apr 2017 06:10:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649981#M4128</guid>
      <dc:creator>lucasbaer</dc:creator>
      <dc:date>2017-04-07T06:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: ecompass rollover from +180 to -180</title>
      <link>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649982#M4129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lucas,&lt;/P&gt;&lt;P&gt;Either of the 1st two listed will work. &amp;nbsp;algorithms/sensorfusion/baremetal_agm01 does not require an RTOS. &amp;nbsp;The freertos_agm01 version is based on FreeRTOS. &amp;nbsp;Just open them up, compile and download to your board. &amp;nbsp;Then fire up the Sensor Fusion Toolbox and click the AutoDetect button.&lt;/P&gt;&lt;P&gt;I also HIGHLY recommend you read the documentation for the sensor fusion kit. &amp;nbsp;It's in &amp;lt;sdk_root&amp;gt;/middleware/issdk_1.1/algorithms/sensorfusion/docs. &amp;nbsp;Start with the datasheet (NSFK_DS.pdf) and then move on to the user guide (NSFK_Prod_UG.pdf).&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Apr 2017 14:38:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/ecompass-rollover-from-180-to-180/m-p/649982#M4129</guid>
      <dc:creator>michaelestanley</dc:creator>
      <dc:date>2017-04-07T14:38:10Z</dc:date>
    </item>
  </channel>
</rss>

