There is a strange issue, within the trigger threshold range, entering ws mode will immediately wake up. For example, if the current magnetic field intensity is 1mT and I set the threshold to be less than 1.25mT, an interrupt will occur. Then, if I configure it to enter ws mode, it will be immediately awakened. After waking up, I configure it to run in continuous conversion mode for about 10 seconds, and continue to repeat the previous operation. If I configure it to enter ws mode, it will also be immediately awakened.The following is the configuration of the two modes switching.
RetTypeDef hall_sensor_logic_set_continuous_mode(void) { RetTypeDef ret = RET_OK; uint8_t value; if (g_op_mode == CONTINUOUS_MODE) { DEBUG_LOG_ERROR("[HALL] already in continuous mode.\r\n"); return RET_OK; } g_op_mode = CONTINUOUS_MODE; DEBUG_LOG_ERROR("[HALL] set continuous mode.\r\n"); value = 0x14; hall_sensor_hal_write_byte(TMAG5273_REG_DEVICE_CONFIG_1, &value); value = 0x87; hall_sensor_hal_write_byte(TMAG5273_REG_SENSOR_CONFIG_1, &value); value = 0x00; hall_sensor_hal_write_byte(TMAG5273_REG_INT_CONFIG_1, &value); value = 0x14; hall_sensor_hal_write_byte(TMAG5273_REG_SENSOR_CONFIG_2, &value); value = 0xC5; hall_sensor_hal_write_byte(TMAG5273_REG_MAG_GAIN_CONFIG, &value); value = 0x02; hall_sensor_hal_write_byte(TMAG5273_REG_DEVICE_CONFIG_2, &value); return ret; } RetTypeDef hall_sensor_logic_set_w_s_mode(void) { RetTypeDef ret = RET_OK; uint8_t value; if (g_op_mode == W_S_MODE) { DEBUG_LOG_ERROR("[HALL] already in W&S mode.\r\n"); return RET_OK; } g_op_mode = W_S_MODE; DEBUG_LOG_ERROR("[HALL] set W&S mode.\r\n"); value = 0x14; hall_sensor_hal_write_byte(TMAG5273_REG_DEVICE_CONFIG_1, &value); value = 0x17; hall_sensor_hal_write_byte(TMAG5273_REG_SENSOR_CONFIG_1, &value); value = 0x20; hall_sensor_hal_write_byte(TMAG5273_REG_SENSOR_CONFIG_2, &value); value = 0x64; hall_sensor_hal_write_byte(TMAG5273_REG_INT_CONFIG_1, &value); value = 0x04; hall_sensor_hal_write_byte(TMAG5273_REG_X_THR_CONFIG, &value); value = 0x23; hall_sensor_hal_write_byte(TMAG5273_REG_DEVICE_CONFIG_2, &value); return ret; }