Hi,
We used the official code on GitHub to test BMM350. Magnetometer and temperature values will have an offset at low temperatures.
It seems to be caused by the following lines of code:
The sensor operating temperatures ranging from -40 to 85 degrees, and we test at about -30 degrees. Here are the data log of the variables at the time of the exception.
out_data[3]
temp
-0.91
24.58
-0.52
24.97
-0.18
25.31
0.14
-25.35
0.4
-25.09
0.68
-24.81
When the value of out_data[3] variable is less than zero, there is a suddenly offset due to suspicious processing. Magnetic data are compensated by temperature values in bmm350_get_compensated_mag_xyz_temp_data function. So the magnetometer will also occurs offset.
We suspect that the correct calculation should be that out_data[3] should be subtracted by 25.49 in any case. However, there is no information about temperature calculation in datasheet, so we don't know if this is correct.
Data log charts:
Hopefully someone will answer this question. Thank you in advance for your time and assistance.