04-25-2019 06:24 PM
Hi,
we are usign BHI160 and bhy sensor library.
I am trying to understand the configuration we are using on the physical and virtual sensor; hence I have patched in some routines to dump what i think is correct info. I find data sheets and documentation a little confusing about what these config numbers mean.
void start_bhy_accelerometer_sensor(int8_t sampling_rate_accelerometer)
{
BHY_RETURN_FUNCTION_TYPE result = BHY_ERROR;
u16 sr, mrl, cs, dr;
if( BHY_SUCCESS == bhy_get_wakeup_sensor_configuration( VS_TYPE_ACCELEROMETER, &sr, &mrl, &cs, &dr ) ){
NRF_LOG_INFO("IAC:SR:%d,MRL:%d,CS:%d, DR:%d", sr, mrl, cs, dr);
}else{
NRF_LOG_INFO("IAC:???");
}
bhy_enable_virtual_sensor(VS_TYPE_ACCELEROMETER, VS_WAKEUP, sampling_rate_accelerometer, 0, VS_FLUSH_NONE, 0, 0);
if( BHY_SUCCESS == bhy_get_wakeup_sensor_configuration( VS_TYPE_ACCELEROMETER, &sr, &mrl, &cs, &dr ) ){
NRF_LOG_INFO("CAC:SR:%d,MRL:%d,CS:%d, DR:%d", sr, mrl, cs, dr);
}else{
NRF_LOG_INFO("CAC:???");
}
result = bhy_install_sensor_callback(VS_TYPE_ACCELEROMETER, VS_WAKEUP, sensors_callback_common);
APP_ERROR_CHECK(result);
}
<info> app: IAC:SR:12289,MRL:257,CS:16, DR:16
<info> app: CAC:SR:12289,MRL:257,CS:16, DR:16
So what do these numbers represent 12289 ( Rate in Hz; 12KHz? or what?)
Change sensitivity 16? What does this represent?
Dynamic Range 16; what does this represent 16g? Why does phys sensor say 4g (see later).?
<info> app: IGY:SR:12548,MRL:2049,CS:1000, DR:16
<info> app: CGY:SR:12548,MRL:2049,CS:1000, DR:16
Similar questions for gyro? What do figures represent?
<info> app: IMG:SR:2818,MRL:3845,CS:2000, DR:15
<info> app: CMG:SR:2818,MRL:3845,CS:2000, DR:15
<info> app:
Similar questions for magnetometer? What do figures represent?
void dumpPhysicalSensorStatus( void )
{
struct accel_physical_status_t as;
struct gyro_physical_status_t gs;
struct mag_physical_status_t ms;
if( BHY_SUCCESS == bhy_get_physical_sensor_status( &as, &gs, &ms )){
NRF_LOG_INFO("");
NRF_LOG_INFO("Accel Phys:SR:%d,DR:%d,Flag:%d", as.accel_sample_rate, as.accel_dynamic_range, as.accel_flag );
NRF_LOG_INFO("Gyro Phys:SR:%d,DR:%d,Flag:%d", gs.gyro_sample_rate, gs.gyro_dynamic_range, gs.gyro_flag );
NRF_LOG_INFO("Mag Phys:SR:%d,DR:%d,Flag:%d", ms.mag_sample_rate, ms.mag_dynamic_range, ms.mag_flag );
NRF_LOG_INFO("");
}
}
<info> app: Accel Phys:SR:100,DR:4,Flag:225
So sample rate 100Hz, dynamic range 4g; so what does this mean?
Wikipedia says dynamic range is ratio between smallest and largest value; surely this is not just 4.
I assume for a signed short this means -32,768 to 32,767 where low limit is -2g and high limit is 2g.
<info> app: Gyro Phys:SR:100,DR:2000,Flag:225
Again sample rate 100Hz, Dynamic range 2000; 2000 what (not g as sensor hub document says) and what does this represent.
Is this 2000 degrees/second?
<info> app: Mag Phys:SR:25,DR:2000,Flag:225
So sample rate 25Hz, Dynamic Range 2000; Again 2000 what?
Regards,
Owain
Solved! Go to Solution.
06-04-2019 04:31 AM
BHI160 uses bit7 to identify the direction of the operation, 0xE1 is the read address for parameter 97 (wakeup accelerometer config). The write address of parameter 97 is 0x61.
At this point I would like to advise that unless you want to carefully read the entire datasheet, please disregard all APIs from the bhy.h file and only use the functions from bhy_uc_driver.h file.
The fact that BHI160 is a complex device is the reason why we provide an entire driver and not just a simple API, like we do with our other sensors.
The bhy_uc_driver.h file along wth the example codes should provide functionnality for the vast majority of use-cases.
06-12-2020 05:15 PM
The bhy_get_wakeup_sensor_configuration() parameter ID in the documentation appears wrong. You write with BHY_PARAMETER_REQUEST_WRITE_PARAMETER_97 (0xE1)
and read with BHY_PARAMETER_REQUEST_READ_PARAMETER_97 (0x61).
See my PR where I fix the documentation in the code: https://github.com/BoschSensortec/BHy1_driver_and_MCU_solution/pull/13
07-14-2020 01:09 PM
This does appear to be true; or well at least I get readings back using those sesnor ID's.
Here dump of physical sensor configuration (bhy_get_physical_sensor_status()) and virtual sensor configuration after configuration has been done (bhy_get_wakeup_sensor_configuration(). You See sensor ID's 0xE? return giberish; IID's 0x6? seem to make some sense.
<info> app: Accel Phys:SR:100,DR:16,Flag:225
<info> app: Gyro Phys:SR:100,DR:2000,Flag:225
<info> app: Mag Phys:SR:25,DR:2000,Flag:225
<info> app:
<info> app: Sensor 61 SR 100 DR 16
<info> app: Sensor 62 SR 0 DR 2000
<info> app: Sensor 63 SR 0 DR 1
<info> app: Sensor 64 SR 100 DR 2000
<info> app: Sensor 6A SR 100 DR 16
<info> app: Accel Phys:SR:100,DR:16,Flag:225
<info> app: Gyro Phys:SR:100,DR:2000,Flag:225
<info> app: Mag Phys:SR:25,DR:2000,Flag:225
<info> app:
<info> app: Sensor E1 SR 100 DR 53248
<info> app: Sensor E2 SR 100 DR 53248
<info> app: Sensor E3 SR 100 DR 53248
<info> app: Sensor E4 SR 100 DR 53248
<info> app: Sensor EA SR 100 DR 53248