AnsweredAssumed Answered

ecompass rollover from +180 to -180

Question asked by LUCAS BAER on Apr 4, 2017
Latest reply on Apr 7, 2017 by Mike Stanley

Hello All,


I am working with the Sensor Fusion ecompass software with an FRDM-K22F + FRDM-STBC-AGM01 demo board combo.


My question is this:


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:






















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.


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  +/-3 degree range of 180 the reading is invalid.


If this has been answered somewhere else please point me there and sorry for the redundancy!