04-08-2021 03:41 PM
I use BHI160B.
I call bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status) and get all parameters zero value.
other than that I have gyro example working, but I want to know which dynamic range value is set after I called :
bhy_enable_virtual_sensor(VS_TYPE_GYROSCOPE, VS_WAKEUP, sample_range, 0, VS_FLUSH_NONE, 0, dynamic_range);
this because I want my computation to be right : float_tmp = pi_const * (sensor_data->data_vector.x) * dynamic_range / 32768 / 180 ;
thanks.
eyal.
Solved! Go to Solution.
04-09-2021 10:57 AM
Hello Eyalb,
Before you call sensor API, have you finished sensor initialization?
By the way, which example code you used?
https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution/tree/master/examples
04-11-2021 10:54 AM
hello.
Yes. I finished sensor init and then called func to get parameters.
I use this code :
bhy_driver_init(&bhy_fw);
semTake(imuSem,WAIT_FOREVER);
if(bhy_install_sensor_callback(VS_TYPE_GYROSCOPE, VS_WAKEUP, sensors_callback))
{
DEBUG("Fail to install VS_TYPE_GYROSCOPE callback\n");
return;
}
/* enables the virtual sensors : */
if (bhy_enable_virtual_sensor(VS_TYPE_GYROSCOPE, VS_WAKEUP, sample_range, 0, VS_FLUSH_NONE, 0, 0/*dynamic_range*/))
{
DEBUG("==========================Fail to enable sensor id=%d==================================\n", VS_TYPE_GYROSCOPE);
return;
}
if (!( bhy_get_physical_sensor_status(&accel_status, &gyro_status, &mag_status)))
{
dynamic_range = gyro_status.gyro_dynamic_range;
DEBUG("read dynamic_range. value is : %d \n",dynamic_range);
}
else
DEBUG("error read dynamic_range. \n");
while(1) {
semTake(imuSem,WAIT_FOREVER);
/*while (!ioport_get_pin_level(BHY_INT) && !bytes_remaining);*/
bhy_read_fifo(fifo + bytes_left_in_fifo, FIFO_SIZE - bytes_left_in_fifo, &bytes_read, &bytes_remaining);
......
thanks.
04-12-2021 09:58 AM
Hello Eyalb,
There was a example in github to read sensor status, could you test it on your platform?
04-12-2021 11:58 AM
I'll test it ASAP. thanks.