CMPS14 Accuracy degrades suddenly occasionally

I have 2 CMPS14’s on the bow of my boat, using them for autopilot. About 97% of the time they work reasonably well. One is on my trolling motor, and the other is on the boat hull. FWIW, the trolling motor compass was purchased a couple years ago. I added a hull compass and purchased it early this year, and had this issue with it, so I bought another to see if the second one would not have the problem. The issue is:

Every so often, perhaps once every 10 hours of operation (??) the compass gets really wacked out, and is maybe up to 90 degrees off. It’s solidly wrong, and if I rotate, the error follows as a constant error on the heading. My software is very simple, I use 0x23 to poll heading, roll, and pitch. What cures the error is a power cycle of the unit.

My older CMPS14 does not do this, just the new ones (hull). When the hull compass goes crazy, I can adjust the trolling motor to point the same direction as the hull, the trolling motor compass is in the correct direction, but the hull compass is wrong by up to 90 degrees! Unplug, reconnect, all better!

Any idea what’s up here?

If you suspect EMI or magnetic interference, try moving the hull compass further away from potential sources of interference or adding shielding around it.

I do not think it’s interference. The hull compass is 2 feet away from the trolling motor compass. The trolling motor compass is not affected. I am out in the middle of a lake, so I doubt there is any transient radio interference of sufficient strength to affect just the hull compass. The interface is serial using an FTDI USB->serial converter that is 8 feet away. I have checked the 5v VCC with my o-scope, and it’s clean. I have an active GNSS antenna with shielded cable a foot away. There is a Bluetooth GPIO a couple of feet away. The tablet I use for the software is in an aluminum enclosure 8 feet away that acts as a Faraday shield. So, yes, potential sources of interference, but why the trolling compass not affected, and why does it work 97% of the time, and then when it “fails”, it’s off tremendously? Why does a quick reboot fix it?

I forgot to mention that this compass refuses to calibrate the magnetometer to level 3, only 2.