I am trying to use the BMM150 with a higher ODR but I am not able to do it.
I have some questions I would need help with.
First. Do I need to set FORCE mode right before a reading? I am finding that in case I do not do that, measure is not refreshed.
Second. I have read on the manual that in order to get ODR > 300Hz I should use LOW POWER PRESET with Rep XY 3 and Rep Z 3. Recommended ODR is 10 but then I should use FORCE MODE.
This is the configuration I use:
REP XY register should be 1 because the formula says that (RepXY = Register value * 2 +1)
REP Z register should be 2. As manual says, REPZ = Register value + 1.
On the 0x4E register I configure the following:
|DRDY Enable|INT disable|CZ enable|CY Enable|CX Enable|DR Pol High|ILatch NO|IPOL High|
This gives me a register of 0x85
On register 0x4C I configure the following:
|ADVST NORMAL|ODR 10|OPMODE NORMAL|ST DIS|
This gives me a register of 0x00
Then, every time I want to read I send the 0x4C register to be set as FORCE (register 0x4C set to 0x02) and then I performe a read of 8 values on the 0x42 address.
I do not see improvements of doing this instead of checking the DRDY bit status and then perform a reading. Is there something else I need to do? Is there anything wrong on the configuration?
Yes, you should set BMM160 to low power preset, and read data by force mode, then you could get high ODR.
There was example code in github, you could refer it.
Thank you BSTRobin.
I have checked that repo but I could not find any example of force measure. Only low/high threshold and drdy interrupt.
Refer the API in driver code.
|* \ingroup bmm150|
|* \defgroup bmm150ApiPowermode Power mode|
|* @brief Set / Get power mode of the sensor|
|* \ingroup bmm150ApiPowermode|
|* \page bmm150_api_bmm150_set_op_mode bmm150_set_op_mode|
|* int8_t bmm150_set_op_mode(const struct bmm150_settings *settings, struct bmm150_dev *dev);|
|* @details This API is used to set the power mode of the sensor.|
|* @param[in] settings : Structure instance of bmm150_settings.|
|* @param[in] dev : Structure instance of bmm150_dev.|
|* settings->pwr_mode | Power mode|
|* 0x00 | BMM150_POWERMODE_NORMAL|
|* 0x01 | BMM150_POWERMODE_FORCED|
|* 0x03 | BMM150_POWERMODE_SLEEP|
|* 0x04 | BMM150_POWERMODE_SUSPEND|
|* @return Result of API execution status|
|* @retval 0 -> Success|
|* @retval >0 -> Warning|
|* @retval <0 -> Fail|
int8_t bmm150_set_op_mode(const struct bmm150_settings *settings, struct bmm150_dev *dev);