01-07-2021 04:07 AM - edited 01-07-2021 04:15 AM
Hi everyone!
I'm trying to configure threshold interrupt for bmm150. After lots of effort, I can not generate any interrupt signal from bmm150. Bellow, I tried configuring high threshold in Y axis, a interrupt will be generated when magnetic in Y axis exceeds 300 uT.
const int THR_INTERRUPT = 0x32; // 50*6 = 300(micro T)
uint16_t desired_settings = BMM150_INT_PIN_EN_SEL | BMM150_INT_LATCH_SEL |/*** END ***/
BMM150_INT_POLARITY_SEL | BMM150_HIGH_THRESHOLD_SETTING_SEL | BMM150_HIGH_THRESHOLD_INT_SEL;
state->settings.int_settings.int_pin_en = BMM150_INT_ENABLE;
state->settings.int_settings.int_polarity = BMM150_ACTIVE_HIGH_POLARITY;
state->settings.int_settings.int_latch = BMM150_NON_LATCHED;
state->settings.int_settings.high_int_en = BMM150_THRESHOLD_Y;
state->settings.int_settings.high_threshold = THR_INTERRUPT;
int8_t rslt = bmm150_set_sensor_settings(desired_settings, state);
BMM_INST_LOG(LOW, this, "Config thredhold for interrupt finished, rslt = %d, thredhold = %d", rslt, THR_INTERRUPT);
// Read registers after configuring
for(int i = 0; i <= 19; i++) {
bmm150_get_regs(state->scp_service, state->com_port_info.port_handle, 0x40 + i, ®_data, 1, state);
BMM_INST_LOG(LOW, this, "Register 0x%x: 0x%x", 0x40 + i, reg_data);
}
After configuring, I checked the log and saw that my configuring code is implemented already. And bellow are values of registers read from bmm150 after I configured threshold interrupt:
Register 0x40: 0x32
Register 0x41: 0x5
Register 0x42: 0x29
Register 0x43: 0x7
Register 0x44: 0x59
Register 0x45: 0xf8
Register 0x46: 0x25
Register 0x47: 0x0
Register 0x48: 0xb0
Register 0x49: 0x64
Register 0x4a: 0x0
Register 0x4b: 0x1
Register 0x4c: 0x6
Register 0x4d: 0x2f
Register 0x4e: 0x45
Register 0x4f: 0x0
Register 0x50: 0x32
Register 0x51: 0x7
Register 0x52: 0xe
Register 0x53: 0xff
My bmm150 is working well, I used a magnet to make Y axis exceeds 300 uT but there is no interrupt generated in INT pin. Does anyone help me figure out the problem. Thank so much !
01-12-2021 08:29 AM
Hi Sir:
If you want to use BMM150 interrupt feature, you should choose Normal mode.
Please see the following picture and modify your sourece code.
Hopefully, it can help you.