1.Introduction
BMM350 3-axis digital geomagnetic sensor. It can measure the magnetic field strength in three spatial axes and is characterized by low power consumption (200uA), low noise (190nT rms@xy-axis 450nT rms@z-axis), high range (±2000μT), and high sampling rate (400~25/16Hz, selectable).
It utilizes TMR (Tunneling Magneto Resistance) technology and has a unique field shock recovery function. This feature makes the device highly robust to external magnetic fields, thus always ensuring high accuracy under the impact of surrounding magnetic fields.
It can be used for indoor and outdoor navigation and positioning, electronic compass, and AR/VR device application development.
2.Features
- 1 programmable interrupt pin
- Low power consumption (200uA)
- Low noise (190nT rms@xy axis 450nT rms@z axis)
- High range (±2000μT)
3.Application
- Drones
- Gaming
- Indoor/Outdoor navigation
- Magnetic heading information
- Augmented reality
- Tilt-compensated electronic compass for map rotation
4.Pinout
Pin | Description |
---|---|
3V3 | DC3.3V |
GND | Ground |
SCL | I2C Clock |
SDA | I2C Data |
INT | Interrupt |
Note:
- All voltages of data outputs are 3.3V.
- Only 3.3V input is allowed.
5.Specification
- Working voltage:3.3V
- Working temperature:-40~85°C
- Communication protocol:I2C
- Resolution:0.1uT
- Zero-point drift:±40uT
- Nonlinear error:< 1%FS(Full Scale)
- Measurement range:±2000μT
- Working current:200uA(Normal mode)
- Low noise:190nT rms@xy axis 450nT rms@z axis
- Accuracy:±2.5°(@30uT Horizontal magnetic field component)
- Start up time:3ms
6.Dimensional Drawing
7.Tutorial
7.1 Hardware
- FireBeetle ESP32-E (SKU:DFR0654) ×1
- Fermion: BMM350 Triple Axis Magnetometer Sensor(SKU:SEN0622)×1
- Dupond wire
7.2 Software
- Arduino IDE: Click to download Arduino IDE
- Install the ESP32 SDK:FireBeetle 2 ESP32-E WIKI
- Arduino library:DFRobot_BMM350 Github repo,
7.3 Wire diagram
Fermion I2C BMM350 Sensor:VCC---(to)---ESP32-E dev board:3V3;
Fermion I2C BMM350 Sensor:GND---(to)---ESP32-E dev board:GND;
Fermion I2C BMM350 Sensor:SCL---(to)---ESP32-E dev board:SCL;
Fermion I2C BMM350 Sensor:SDA---(to)---ESP32-E dev board:SDA;
7.4 Sample code
- Sample code1-(getAllState.ino)
- Sample code2-(getGeomagneticData.ino)
- Sample code3-(thresholdInterrupt.ino)
Sample code1-(getAllState.ino)
Upload the code
/*! * @file getAllState.ino * @brief Get all the config status, self test status; the sensor turns to sleep mode from normal mode after reset * @n Experimental phenomenon: serial print the sensor config information and the self-test information * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @license The MIT License (MIT) * @author [GDuang](yonglei.ren@dfrobot.com) * @version V1.0.0 * @date 2024-05-06 * @url https://github.com/dfrobot/DFRobot_BMM350 */ #include "DFRobot_BMM350.h" DFRobot_BMM350_I2C bmm350(&Wire, 0x14); void setup() { Serial.begin(115200); while(!Serial); while(bmm350.begin()){ Serial.println("bmm350 init failed, Please try again!"); delay(1000); } Serial.println("bmm350 init success!"); /**! * Sensor self-test, returns a string indicating the result of the self-test. */ Serial.println(bmm350.selfTest()); /**! * Setting the sensor operating mode * opMode: * BMM350_SUSPEND_MODE // suspend mode: Suspend mode is the default power mode of BMM350 after the chip is powered, Current consumption in suspend mode is minimal, * so, this mode is useful for periods when data conversion is not needed. Read and write of all registers is possible. * BMM350_NORMAL_MODE // normal mode Get geomagnetic data normally. * BMM350_FORCED_MODE // forced mode Single measurement, the sensor restores to suspend mode when the measurement is done. * BMM350_FORCED_MODE_FAST // To reach ODR = 200Hz is only possible by using FM_ FAST. */ bmm350.setOperationMode(BMM350_NORMAL_MODE); /**! * Setting the preset mode allows the user to easily configure the sensor to acquire geomagnetic data (the default rate for acquiring geomagnetic data is 12.5 Hz). * presetMode: * BMM350_PRESETMODE_LOWPOWER // Low power mode, get a fraction of data and take the mean value. * BMM350_PRESETMODE_REGULAR // Regular mode, get a number of data and take the mean value. * BMM350_PRESETMODE_ENHANCED // Enhanced mode, get a plenty of data and take the mean value. * BMM350_PRESETMODE_HIGHACCURACY // High accuracy mode, get a huge number of take and draw the mean value. */ bmm350.setPresetMode(BMM350_PRESETMODE_HIGHACCURACY); /**! * Set the rate at which geomagnetic data is acquired, the higher the rate, the faster the speed (no delay function) * rate: * BMM350_DATA_RATE_1_5625HZ * BMM350_DATA_RATE_3_125HZ * BMM350_DATA_RATE_6_25HZ * BMM350_DATA_RATE_12_5HZ (default rate) * BMM350_DATA_RATE_25HZ * BMM350_DATA_RATE_50HZ * BMM350_DATA_RATE_100HZ * BMM350_DATA_RATE_200HZ * BMM350_DATA_RATE_400HZ */ bmm350.setRate(BMM350_DATA_RATE_25HZ); /**! * Enable x-, y-, and z-axis measurements, enabled by default, no configuration required, when disabled geomagnetic data for x, y, and z-axis will be inaccurate. * To configure more parameters, see the setMeasurementXYZ() function in the .h file. */ bmm350.setMeasurementXYZ(); /**! * Get configuration data rate. Unit: Hz */ float rate = bmm350.getRate(); Serial.print("rate is "); Serial.print(rate); Serial.println(" HZ"); /**! * Gets the measurement status of the x-, y-, and z-axes and returns the measurement status as a string. */ Serial.println(bmm350.getMeasurementStateXYZ()); /**! * Get the sensor operation mode and return the sensor operation status as a string */ Serial.println(bmm350.getOperationMode()); /**! * After a software reset, enter suspend mode. */ bmm350.softReset(); } void loop() { /**! * Get the sensor operation mode and return the sensor operation status as a string */ Serial.println(bmm350.getOperationMode()); delay(3000); }
Result
Upload the sample program and the serial monitor prints out the current configuration status of the sensor
Sample code 2(getGeomagneticData.ino)
Upload the code
/*! * @file getGeomagneticData.ino * @brief Get the geomagnetic data at 3 axis (x, y, z), get the compass degree * @n "Compass Degree", the angle formed when the needle rotates counterclockwise from the current position to the true north * @n Experimental phenomenon: serial print the geomagnetic data of x-axis, y-axis and z-axis and the compass degree * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @license The MIT License (MIT) * @author [GDuang](yonglei.ren@dfrobot.com) * @version V1.0.0 * @date 2024-05-06 * @url https://github.com/dfrobot/DFRobot_BMM350 */ #include "DFRobot_BMM350.h" DFRobot_BMM350_I2C bmm350(&Wire, 0x14); void setup() { Serial.begin(115200); while(!Serial); while(bmm350.begin()){ Serial.println("bmm350 init failed, Please try again!"); delay(1000); } Serial.println("bmm350 init success!"); //Normal bmm350.setOperationMode(BMM350_NORMAL_MODE); /**! * Set preset mode, make it easier for users to configure sensor to get geomagnetic data (The default rate for obtaining geomagnetic data is 12.5Hz) * presetMode: * BMM350_PRESETMODE_LOWPOWER // Low power mode, get a fraction of data and take the mean value. * BMM350_PRESETMODE_REGULAR // Regular mode, get a number of data and take the mean value. * BMM350_PRESETMODE_ENHANCED // Enhanced mode, get a plenty of data and take the mean value. * BMM350_PRESETMODE_HIGHACCURACY // High accuracy mode, get a huge number of take and draw the mean value. */ bmm350.setPresetMode(BMM350_PRESETMODE_HIGHACCURACY); /**! * Set the rate of obtaining geomagnetic data, the higher, the faster(without delay function) * rate: * BMM350_DATA_RATE_1_5625HZ * BMM350_DATA_RATE_3_125HZ * BMM350_DATA_RATE_6_25HZ * BMM350_DATA_RATE_12_5HZ (default rate) * BMM350_DATA_RATE_25HZ * BMM350_DATA_RATE_50HZ * BMM350_DATA_RATE_100HZ * BMM350_DATA_RATE_200HZ * BMM350_DATA_RATE_400HZ */ bmm350.setRate(BMM350_DATA_RATE_25HZ); /**! * Enable the measurement at x-axis, y-axis and z-axis, default to be enabled, no config required, the geomagnetic data at x, y and z will be inaccurate when disabled. * Refer to setMeasurementXYZ() function in the .h file if you want to configure more parameters. */ bmm350.setMeasurementXYZ(); } void loop() { sBmm350MagData_t magData = bmm350.getGeomagneticData(); Serial.print("mag x = "); Serial.print(magData.x); Serial.println(" uT"); Serial.print("mag y = "); Serial.print(magData.y); Serial.println(" uT"); Serial.print("mag z = "); Serial.print(magData.z); Serial.println(" uT"); // float type data //Serial.print("mag x = "); Serial.print(magData.float_x); Serial.println(" uT"); //Serial.print("mag y = "); Serial.print(magData.float_y); Serial.println(" uT"); //Serial.print("mag z = "); Serial.print(magData.float_z); Serial.println(" uT"); float compassDegree = bmm350.getCompassDegree(); Serial.print("the angle between the pointing direction and north (counterclockwise) is:"); Serial.println(compassDegree); Serial.println("--------------------------------"); delay(3000); }
Result
Upload the sample code, the serial port prints out the geomagnetic data and compass angle data acquired by the sensor
Sample Code 3 (thresholdInterrupt.ino)
Upload the code
/*! * @file thresholdInterrupt.ino * @brief Set the interrupt to be triggered when beyond/below threshold, when the interrupt at a axis occur, the relevant data will be printed in the serial port. * @n Experimental phenomenon: when the geomagnetic data at 3 axis (x, y, z) beyond/below threshold, serial print the geomagnetic data, unit (uT) * @n Experimental phenomenon: the main controller interrupt will be triggered by level change caused by INT pin interrupt, then the geomagnetic data can be obtained * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @license The MIT License (MIT) * @author [GDuang](yonglei.ren@dfrobot.com) * @version V1.0.0 * @date 2024-05-06 * @url https://github.com/dfrobot/DFRobot_BMM350 */ #include "DFRobot_BMM350.h" DFRobot_BMM350_I2C bmm350(&Wire, 0x14); volatile uint8_t interruptFlag = 0; void myInterrupt(void) { interruptFlag = 1; // Interrupt flag #if defined(ESP32) || defined(ESP8266) || defined(ARDUINO_SAM_ZERO) detachInterrupt(13); // Detach interrupt #else detachInterrupt(0); // Detach interrupt #endif } void setup() { Serial.begin(115200); while(!Serial); delay(5000); while(bmm350.begin()){ Serial.println("bmm350 init failed, Please try again!"); delay(1000); } Serial.println("bmm350 init success!"); /**! * Set sensor operation mode * opMode: * BMM350_SUSPEND_MODE // suspend mode: Suspend mode is the default power mode of BMM350 after the chip is powered, Current consumption in suspend mode is minimal, * so, this mode is useful for periods when data conversion is not needed. Read and write of all registers is possible. * BMM350_NORMAL_MODE // normal mode Get geomagnetic data normally. * BMM350_FORCED_MODE // forced mode Single measurement, the sensor restores to suspend mode when the measurement is done. * BMM350_FORCED_MODE_FAST // To reach ODR = 200Hz is only possible by using FM_ FAST. */ bmm350.setOperationMode(BMM350_NORMAL_MODE); /**! * Set preset mode, make it easier for users to configure sensor to get geomagnetic data (The default rate for obtaining geomagnetic data is 12.5Hz) * presetMode: * BMM350_PRESETMODE_LOWPOWER // Low power mode, get a fraction of data and take the mean value. * BMM350_PRESETMODE_REGULAR // Regular mode, get a number of data and take the mean value. * BMM350_PRESETMODE_ENHANCED // Enhanced mode, get a plenty of data and take the mean value. * BMM350_PRESETMODE_HIGHACCURACY // High accuracy mode, get a huge number of take and draw the mean value. */ bmm350.setPresetMode(BMM350_PRESETMODE_HIGHACCURACY); /**! * Set the rate of obtaining geomagnetic data, the higher, the faster(without delay function) * rate: * BMM350_DATA_RATE_1_5625HZ * BMM350_DATA_RATE_3_125HZ * BMM350_DATA_RATE_6_25HZ * BMM350_DATA_RATE_12_5HZ (default rate) * BMM350_DATA_RATE_25HZ * BMM350_DATA_RATE_50HZ * BMM350_DATA_RATE_100HZ * BMM350_DATA_RATE_200HZ * BMM350_DATA_RATE_400HZ */ bmm350.setRate(BMM350_DATA_RATE_25HZ); /**! * Enable the measurement at x-axis, y-axis and z-axis, default to be enabled, no config required, the geomagnetic data at x, y and z will be inaccurate when disabled. * Refer to setMeasurementXYZ() function in the .h file if you want to configure more parameters. */ bmm350.setMeasurementXYZ(); /*! * HIGH_THRESHOLD_INTERRUPT:The interrupt is triggered only if the set threshold range is exceeded. * 4:This parameter is a 16-fold parameter, for example, if this parameter is set to 1, then an interrupt will be triggered when the geomagnetic parameter exceeds 16 * BMM350_ACTIVE_HIGH:Interrupt pin set to high trigger */ bmm350.setThresholdInterrupt(HIGH_THRESHOLD_INTERRUPT, 4, BMM350_ACTIVE_HIGH); #if defined(ESP32) || defined(ESP8266) /**! Select according to the set DADY pin polarity INPUT_PULLUP // Low polarity, set pin 13 to pull-up input INPUT_PULLDOWN // High polarity, set pin 13 to pull-down input interput io All pins can be used. Pin 13 is recommended */ pinMode(/*Pin */13 ,INPUT_PULLUP); attachInterrupt(/*interput io*/13, myInterrupt, ONLOW); #elif defined(ARDUINO_SAM_ZERO) pinMode(/*Pin */13 ,INPUT_PULLUP); attachInterrupt(/*interput io*/13, myInterrupt, LOW); #else /**! The Correspondence Table of AVR Series Arduino Interrupt Pins And Terminal Numbers * --------------------------------------------------------------------------------------- * | | Pin | 2 | 3 | | * | Uno, Nano, Mini, other 328-based |--------------------------------------------| * | | Interrupt No | 0 | 1 | | * |-------------------------------------------------------------------------------------| * | | Pin | 2 | 3 | 21 | 20 | 19 | 18 | * | Mega2560 |--------------------------------------------| * | | Interrupt No | 0 | 1 | 2 | 3 | 4 | 5 | * |-------------------------------------------------------------------------------------| * | | Pin | 3 | 2 | 0 | 1 | 7 | | * | Leonardo, other 32u4-based |--------------------------------------------| * | | Interrupt No | 0 | 1 | 2 | 3 | 4 | | * |-------------------------------------------------------------------------------------- */ /**! The Correspondence Table of micro:bit Interrupt Pins And Terminal Numbers * --------------------------------------------------------------------------------------------------------------------------------------------- * | micro:bit | DigitalPin |P0-P20 can be used as an external interrupt | * | (When using as an external interrupt, |---------------------------------------------------------------------------------------------| * |no need to set it to input mode with pinMode)|Interrupt No|Interrupt number is a pin digital value, such as P0 interrupt number 0, P1 is 1 | * |-------------------------------------------------------------------------------------------------------------------------------------------| */ /**! Select according to the set DADY pin polarity INPUT_PULLUP // Low polarity, set pin 2 to pull-up input */ pinMode(/*Pin */2 ,INPUT_PULLUP); /**! Set the pin to interrupt mode // Open the external interrupt 0, connect INT1/2 to the digital pin of the main control: function callback function state LOW // When the pin is at low level, the interrupt occur, enter interrupt function */ attachInterrupt(/*Interrupt No*/0, /*function*/myInterrupt ,/*state*/LOW ); #endif } void loop() { /**! * Get the data that threshold interrupt occured and interrupt status (get the data ready status through software) * Returns the structure for storing geomagnetic data, the structure stores the data of 3 axis and interrupt status, * No interrupt triggered when the data at x-axis, y-axis and z-axis is NO_DATA * Refer to .h file if you want to check interrupt status. */ /* sBmm350ThresholdData_t thresholdData = bmm350.getThresholdData(); if(thresholdData.mag_x != NO_DATA){ Serial.print("mag x = "); Serial.print(thresholdData.mag_x); Serial.println(" uT"); } if(thresholdData.mag_y != NO_DATA){ Serial.print("mag y = "); Serial.print(thresholdData.mag_y); Serial.println(" uT"); } if(thresholdData.mag_z != NO_DATA){ Serial.print("mag z = "); Serial.print(thresholdData.mag_z); Serial.println(" uT"); } Serial.println(); */ /**! When the interrupt occur in INT IO, get the threshold interrupt data (get the threshold interrupt status through hardware) */ if(interruptFlag == 1){ sBmm350ThresholdData_t thresholdData = bmm350.getThresholdData(); if(thresholdData.mag_x != NO_DATA){ Serial.print("mag x = "); Serial.print(thresholdData.mag_x); Serial.println(" uT"); } if(thresholdData.mag_y != NO_DATA){ Serial.print("mag y = "); Serial.print(thresholdData.mag_y); Serial.println(" uT"); } if(thresholdData.mag_z != NO_DATA){ Serial.print("mag z = "); Serial.print(thresholdData.mag_z); Serial.println(" uT"); } Serial.println(); interruptFlag = 0; #if defined(ESP32) || defined(ESP8266) attachInterrupt(13, myInterrupt, ONLOW); #elif defined(ARDUINO_SAM_ZERO) attachInterrupt(13, myInterrupt, LOW); #else attachInterrupt(0, myInterrupt, LOW); #endif } delay(3000); }
Result
Upload sample code, bring magnet close to sensor, serial port prints change data
8. API list
/**
* @fn softReset
* @brief Software reset, reset to suspend mode after software reset.
*/
void softReset(void);
/**
* @fn setOperationMode
* @brief Setting the sensor's execution mode
* @param opMode mode
* @n BMM350_SUSPEND_MODE Suspend Mode:Suspend mode is the default power mode of the BMM350 after the chip is powered up, the current consumption is minimized in suspend mode, so this mode is suitable for the period when no data conversion is required (all register reads and writes are possible)
* @n BMM350_NORMAL_MODE Normal mode: Acquisition of geomagnetic data
* @n BMM350_FORCED_MODE Forced mode: single measurement, sensor returns to pause mode when measurement is complete
* @n BMM350_FORCED_MODE_FAST ODR up to 200Hz only when using FM_FAST
*/
void setOperationMode(uint8_t opMode);
/**
* @fn getOperationMode
* @brief Get the sensor's execution mode
* @return String is the execution mode of the sensor
*/
String getOperationMode(void);
/**
* @fn setPresetMode
* @brief Setting the preset mode makes it easier for the user to configure the sensor to acquire geomagnetic data (the default acquisition rate is 12.5 Hz).
* @param presetMode
* @n BMM350_PRESETMODE_LOWPOWER Low power mode, get a small amount of data, take the mean.
* @n BMM350_PRESETMODE_REGULAR Normal mode, get medium data, take the mean.
* @n BMM350_PRESETMODE_ENHANCED Enhanced mode, get a lot of data, take the mean.
* @n BMM350_PRESETMODE_HIGHACCURACY High-precision mode, obtaining a large amount of data Taking the average value
*/
void setPresetMode(uint8_t presetMode, uint8_t rate = BMM350_DATA_RATE_12_5HZ);
/**
* @fn setRate
* @brief Set the rate of acquiring geomagnetic data, the larger the rate, the faster the acquisition (without the delay function).
* @param rate
* @n BMM350_DATA_RATE_1_5625HZ
* @n BMM350_DATA_RATE_3_125HZ
* @n BMM350_DATA_RATE_6_25HZ
* @n BMM350_DATA_RATE_12_5HZ (default speed)
* @n BMM350_DATA_RATE_25HZ
* @n BMM350_DATA_RATE_50HZ
* @n BMM350_DATA_RATE_100HZ
* @n BMM350_DATA_RATE_200HZ
* @n BMM350_DATA_RATE_400HZ
*/
void setRate(uint8_t rate);
/**
* @fn getRate
* @brief Get the configured data rate.Unit: HZ
* @return rate
*/
uint8_t getRate(void);
/**
* @fn selfTest
* @brief Sensor self-test, return value indicates self-test result
* @param testMode:
* @n eBMM350_SELF_TEST_NORMAL Routine self-test, check x-axis, y-axis, z-axis for on or short circuit
* @return result The returned string is the result of the self-test
*/
String selfTest(eBMM350_SELFTEST testMode = eBMM350_SELF_TEST_NORMAL);
/**
* @fn setMeasurementXYZ
* @brief Enable x, y and z-axis measurement, the default setting is enable, the geomagnetic data of xyz-axis is not accurate after disable.
* @param en_x
* @n BMM350_X_EN Enable x-axis measurement
* @n BMM350_X_DIS Disable x-axis measurement
* @param en_y
* @n BMM350_Y_EN Enable y-axis measurement
* @n BMM350_Y_DIS Disable y-axis measurement
* @param en_z
* @n BMM350_Z_EN Enable z-axis measurement
* @n BMM350_Z_DIS Disable x-axis measurement
*/
void setMeasurementXYZ(enum bmm350_x_axis_en_dis en_x = BMM350_X_EN, enum bmm350_y_axis_en_dis en_y = BMM350_Y_EN, enum bmm350_z_axis_en_dis en_z = BMM350_Z_EN);
/**
* @fn getMeasurementStateXYZ
* @brief Get the state of the x, y, and z axes
* @return result Returns the string as state
*/
String getMeasurementStateXYZ(void);
/**
* @fn getGeomagneticData
* @brief Obtain geomagnetic data in the x, y, and z axes.
* @return Structures of geomagnetic data. Unit: uT
*/
sBmm350MagData_t getGeomagneticData(void);
/**
* @fn getCompassDegree
* @brief Getting Compass Directions
* @return compass angle (0° - 360°)
* @n 0° = North, 90° = East, 180° = South, 270° = West.
*/
float getCompassDegree(void);
/**
* @fn setDataReadyPin
* @brief Enable or disable the data ready interrupt pin
* @n Data coming to DRDY pin after enable.
* @n Data won't coming to DRDY pin after disable.
* @n high polarity:High level is the active level, the default is low level, the level becomes high when the interrupt is triggered.
* @n low polarity:Low level is the active level, default is high, the level changes to low when the interrupt is triggered.
* @param modes
* @n BMM350_ENABLE_INTERRUPT Enable DRDY
* @n BMM350_DISABLE_INTERRUPT Disable DRDY
* @param polarity
* @n BMM350_ACTIVE_HIGH high polarity
* @n BMM350_ACTIVE_LOW low polarity
*/
void setDataReadyPin(uint8_t modes, uint8_t polarity=POLARITY_HIGH);
/**
* @fn getDataReadyState
* @brief Get the status of data readiness and use it to determine whether the data is ready or not.
* @return status
* @n true The data is ready.
* @n false The data is not ready.
*/
bool getDataReadyState(void);
/**
* @fn setThresholdInterrupt(uint8_t modes, int8_t threshold, uint8_t polarity)
* @brief Threshold interrupt, triggered when the geomagnetic value of a channel is above/below the threshold.
* @n High polarity: high level is active level, default is low level, level becomes high when interrupt is triggered.
* @n Low polarity: low level is active level, default is high level, the level changes to low when interrupt is triggered.
* @param modes
* @n LOW_THRESHOLD_INTERRUPT Low Threshold Interrupt Mode
* @n HIGH_THRESHOLD_INTERRUPT High Threshold Interrupt Mode
* @param threshold
* @n Threshold, the default expansion is 16 times, e.g., if the threshold 1 is passed in the low threshold mode, the actual geomagnetic data lower than 16 will trigger an interrupt.
* @param polarity
* @n POLARITY_HIGH high polarity
* @n POLARITY_LOW low polarity
*/
void setThresholdInterrupt(uint8_t modes, int8_t threshold, enum bmm350_intr_polarity polarity);
/**
* @fn getThresholdData
* @brief Get the data where a threshold interrupt occurred
* @return Returns the structure that holds the geomagnetic data, which holds the three-axis data and the interrupt status.
* @n No interrupt is triggered when the xyz-axis data is NO_DATA.
* @n Mag_x, mag_y, mag_z Stores geomagnetic data.
* @n Interrupt_x, interrupt_y, interrupt_z Stores axis interrupt status.
*/
sBmm350ThresholdData_t getThresholdData(void);
9. FAQ
Q1:Why sometimes the acquired data range exceeds the measuring range?
A1: There is a limitation on the measurement range of BMM350, i.e., the sum of absolute values for each axis should be less than this value. That is, SQRT(Hx^2 + Hy^2 + Hz^2) = 2000uT
You can refer to subsection 5.3 of the BMM350 datasheet Below.