Magnetometer resets to 0 independant of angle

I am using the BMF055 on a custom board. I derived the software from the BSXLite example. My modificaqtions are minor.  I just use Euler angles instead of quaternions. Also I use Sercom1 for the sensor SPI and Sercom 3 for the uart.

When powering on, I get after a few seconds a level 3 on the gyroscope, but in no way I can get anything else than 0 for the magnetometer or the accelerometer.

At power on all 3 sensors are set at zero. So for instance if I have the board at 45 degrees at power on, it will show 0 degrees. When I put the board flat it shows a pitch of -45 degrees. I could possibly live with that, as the sensor will always be horizontal when powering up.

Worse is that the heading is always set at zero, independant of the angle to the north.

I am struggling with this already for almost a week, and I hope someone can point me to the my possible mistake. I appreciate any ideas and if some more detailed info is needed, I can go in depth.

Best reply by RonBreukers

I finally figured out what happened. I started with the original demo program, and step by step introduced my changes.

The root cause is that I do not need and use a data rate of 100 Hz. I use -for EMC reasons- a baud rate of 19200 baud and a data rate of 5 Hz. The calibration is coupled to that data rate, and thus you had to take with for instance the accelerometer calibration 20 seconds stable at each position insteafd of 1 second. Obviously that was not the way I tested the calibration. After I reset the baud rate to 115200 baud and a data rate of 100 Hz it all worked as it should.

Maybe someone can learn from my mistake.

View original
3 replies
Resolved