04-16-2022 12:59 AM
I am trying to bring up a board with a BHI160B. Is the library found at https://github.com/BoschSensortec/BoschSensorHub known to work for this sensor?
The circuit involves a BHI160B with no attached secondary devices, should I be using the Bosch_PCB_7183_di03_BMI160-7183_di03.2.1.11696_170103.h firmware? The application only requires reading the accelerometer and gyroscope virtual sensors.
Solved! Go to Solution.
05-06-2022 05:22 AM
Hi bgfas,
There is no problem multiple save devices share same I2C bus.
Orientation is also a example code of virtual sensor, could you run this official example and see if it works well?
https://github.com/BoschSensortec/BoschSensorHub/blob/master/examples/orientation/orientation.ino
05-06-2022 08:42 PM
Hello,
Thanks again for your reply and the suggestion. Unfortunately this board does not have a BMM150 (only a BHI160b). When I attempt to run the firmware I get the following output:
"""
Serial working
Sensor found over I2C! Product ID: 0x83
Uploading Firmware.
Firmware booted
Orientation callback installed
Failed to enable virtual sensor (Orientation (Non Wake-up)). Loaded firmware may not support requested sensor id.
"""
05-09-2022 11:44 AM
Hi bgfas,
You could print supported sensor ID after calling getSensorInformation(), and see what sensor ID does current firmware support?
05-09-2022 04:06 PM
Hi BSTRobin,
I'm not sure which sensor_id you're referring to. I'm assuming it's not the constant defined here:
https://github.com/BoschSensortec/BoschSensorHub/blob/master/src/bhy_defs.h#L162
Would you help me understand what sensor_id you're looking for?
I added code to print out for the orientation and accelerometer sensors (wakeup) bhySensorInforrmation after loading the firmware. The code snippet is here:
"""
intrToggled = false; /* Clear interrupt status received during firmware upload */
waitForBhyInterrupt(); /* Wait for meta events from boot up */
Serial.println("Firmware booted");
/* Install a metaevent callback handler and a timestamp callback handler here if required before the first run */
bhi160.run(); /* The first run processes all boot events */
bhySensorInformation information;
bhi160.getSensorInformation(BHY_VS_ORIENTATION, true, &information);
Serial.println("BHY_VS_ORIENTATION wakeup");
Serial.print("type: "); Serial.println(information.type);
Serial.print("driver_id: "); Serial.println(information.driver_id);
Serial.print("driver_version: "); Serial.println(information.driver_version);
Serial.print("power: "); Serial.println(information.power);
Serial.print("max_range: "); Serial.println(information.max_range);
Serial.print("resolution: "); Serial.println(information.resolution);
Serial.print("fifo_reserved: "); Serial.println(information.fifo_reserved);
Serial.print("fifo_max: "); Serial.println(information.fifo_max);
Serial.print("event_size: "); Serial.println(information.event_size);
Serial.print("min_rate: "); Serial.println(information.min_rate);
bhi160.getSensorInformation(BHY_VS_ACCELEROMETER, true, &information);
Serial.println("BHY_VS_ACCELEROMETER wakeup");
Serial.print("type: "); Serial.println(information.type);
Serial.print("driver_id: "); Serial.println(information.driver_id);
Serial.print("driver_version: "); Serial.println(information.driver_version);
Serial.print("power: "); Serial.println(information.power);
Serial.print("max_range: "); Serial.println(information.max_range);
Serial.print("resolution: "); Serial.println(information.resolution);
Serial.print("fifo_reserved: "); Serial.println(information.fifo_reserved);
Serial.print("fifo_max: "); Serial.println(information.fifo_max);
Serial.print("event_size: "); Serial.println(information.event_size);
"""
And output is as follows:
"""
Serial working
Sensor found over I2C! Product ID: 0x83
Uploading Firmware.
Firmware booted
BHY_VS_ORIENTATION wakeup
type: 35
driver_id: 254
driver_version: 1
power: 0
max_range: 1
resolution: 16
fifo_reserved: 0
fifo_max: 1893
event_size: 8
min_rate: 1
BHY_VS_ACCELEROMETER wakeup
type: 33
driver_id: 48
driver_version: 1
power: 1
max_range: 4
resolution: 16
fifo_reserved: 0
fifo_max: 1893
event_size: 8
min_rate: 1
Orientation callback installed
Failed to enable virtual sensor (Orientation (Non Wake-up)). Loaded firmware may not support requested sensor id.
"""
05-10-2022 08:35 AM
Hi bgfas,
For your firmware, you could refer the following code to print supported virtual sensor information.
/* get virtual sensor information from sensor hub */
PDEBUG("Supported Virtual Sensor Information:\n");
for(i = 1; i < 32; i++)
{
bhi160.getSensorInformation(BHY_VS_ORIENTATION, true, &information);
if(information.type == i)
PDEBUG("id=%2d\n", i);
}
for(i = 1; i < 32; i++)
{
bhi160.getSensorInformation(BHY_VS_ORIENTATION, false, &information);
if(information.type == i)
PDEBUG("id=%2d\n", i);
}
PDEBUG("");
The print information should be like this: