10-17-2019 11:43 AM
The BMI150 can obtain valuable magnetometer data in the forcad mode, and then configure it to the normal mode. The magnetometer data is 0. I want to know where I am wrong with the configuration, or what causes this phenomenon.
10-18-2019 03:51 AM
Please provide the code for BMM150 configuration/initialization.
10-18-2019 10:40 AM
uint8 bmm150_init(void)
{
uint8 init_ret = BMM150_ERROR;
uint8 self_test_fault_cnt = 0;
init_ret = bmm150_read_pwr_control();
if(BMM150_OK != init_ret)
{
init_ret = bmm150_set_pwr_control(BMM150_PWR_OTHER_MODE);
if(BMM150_OK != init_ret)
{
return init_ret;
}
}
//bmm150_soft_reset();
init_ret = bmm150_read_id();
if(BMM150_OK != init_ret)
{
return init_ret;
}
#if (!NORMAL_WORK_MODE)
init_ret = bmm150_set_pwr_mode(BMM150_PWR_SLEEP_MODE);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_ready_en(BMM150_READY_EN);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_repxy(BMM150_REPXY_LOWPWR);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_repz(BMM150_REPZ_LOWPWR);
if(BMM150_OK != init_ret)
{
return init_ret;
}
#else
init_ret = bmm150_set_ready_en(BMM150_READY_EN);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_rate(BMM150_DATA_RATE_10HZ);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_repxy(BMM150_REPXY_REGULAR);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_repz(BMM150_REPZ_REGULAR);
if(BMM150_OK != init_ret)
{
return init_ret;
}
init_ret = bmm150_set_pwr_mode(BMM150_PWR_NORMAL_MODE);
if(BMM150_OK != init_ret)
{
return init_ret;
}
#endif
return BMM150_OK;
}
Thanks.
10-21-2019 09:17 AM - edited 10-21-2019 09:36 AM
Please check the following points with your code :
Check the register ‘Power Control’ bit in register 0x4B and ‘OP Mode’ bit in register 0x4C after initialization is complete.
Please download and use BMM150 API: