Hello,
I am using the Nano 33 BLE Sense board and find that the register of the magnetometer needs to be configured separately.
In subsection 8.5 of LSM9DS1 datasheet https://www.st.com/resource/en/datasheet/lsm9ds1.pdf, it is CTRL_REG1_M (20h) register. It said that "FAST_ODR enables data rates higher than 80 Hz. " Does anyone know what is the accurate ODR if I enable this FAST_ODR?
In Arduino_LSM9DS1 library, the default setting is: writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xb4);
If I change it to writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M, 0xbe);, the ODR will be 80Hz or higher than 80 Hz (FAST_ODR)?
Thank you very much for your kind help in advance.
Tang
Hello Tang
I'm working on an update of the LSM9DS1 library.
There are functions for changing the sample rate of all the DOF.
So far I did not implement the above 80 Hz for magnetic.
What I found for the Gyro and the Accel is that the sample rate could differ significantly from the listed value.
Since ODR is in the tracking calculation of the Gyro, I needed a more accurate value.
I made a very rapid measuring method that gets callled upon setting a new ODR value. The get...ODR function returns the actual measured value.
This is not yet implemented for magnetic.
I'll have a look into it. If you can't wait, you can look in the code yourself for
float LSM9DS1Class::measureAccelGyroODR(unsigned int duration)
to adapt.
femmeverbeek:
Hello Tang
I'm working on an update of the LSM9DS1 library.
GitHub - FemmeVerbeek/Arduino_LSM9DS1: LSM9DS1 Library for Arduino
There are functions for changing the sample rate of all the DOF.
So far I did not implement the above 80 Hz for magnetic.
What I found for the Gyro and the Accel is that the sample rate could differ significantly from the listed value.
Since ODR is in the tracking calculation of the Gyro, I needed a more accurate value.
I made a very rapid measuring method that gets callled upon setting a new ODR value. The get...ODR function returns the actual measured value.
This is not yet implemented for magnetic.
I'll have a look into it. If you can't wait, you can look in the code yourself for
float LSM9DS1Class::measureAccelGyroODR(unsigned int duration)
to adapt.
Thank you so much for your kind help.
Ok this is what I did
A little tweak in the .CPP
int LSM9DS1Class::setMagnetODR(uint8_t range) // range (0..15) = {0.625,1.25,2.5,5.0,10.0,20.0,40.0,80.0}Hz
{ uint8_t setting = ((range & 0b00000111) << 2) | ((range & 0b00001000) >> 2);
setting = setting | (readRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M) & 0b11100001) ;
return writeRegister(LSM9DS1_ADDRESS_M, LSM9DS1_CTRL_REG1_M,setting) ;
}
So a value above 7 sets the fast bit.
Result
magnetic field ODR param = 0 setting 0.63 Hz
magnetic field ODR param = 1 setting 1.27 Hz
magnetic field ODR param = 2 setting 2.54 Hz
magnetic field ODR param = 3 setting 5.07 Hz
magnetic field ODR param = 4 setting 10.15 Hz
magnetic field ODR param = 5 setting 20.29 Hz
magnetic field ODR param = 6 setting 40.55 Hz
magnetic field ODR param = 7 setting 81.00 Hz
magnetic field ODR param = 8 setting 405.67 Hz
magnetic field ODR param = 9 setting 405.60 Hz
magnetic field ODR param = 10 setting 405.71 Hz
magnetic field ODR param = 11 setting 402.09 Hz
magnetic field ODR param = 12 setting 402.27 Hz
magnetic field ODR param = 13 setting 403.62 Hz
magnetic field ODR param = 14 setting 404.18 Hz
magnetic field ODR param = 15 setting 400.35 Hz
Aparently setting the fast_ODR bit works, but there is only one high ODR available.