I plan to use a BHI260AB connected to a nRF52840 via SPI, and I'm looking at the BHY2 Sensor API repository https://github.com/BoschSensortec/BHY2-Sensor-API
I already implemented the low level SPI read and write calls, and I can successfully get Euler angles using the euler.c example, so things are looking up.
I cannot find any documentation for the APIs, though. I know I can look thru the code and use the examples (like euler.c) for a sense of how to use the APIs, but I was hoping for some documentation. Does it exist? The rest of Bosch documentation is really good, and it's strange to see nothing for all those pretty fundamental APIs
Thanks for the prompt reply. Yes, as mentioned, it's not impossible to make sense of the APIs by looking at the code and datasheet, but the datasheet/code is not a perfect match, and it's taken me a bit of time to figure out basic things like how the code is organized, what virtual sensors use which data structure, how to port it to an embedded platform, etc. Other parts of the Bosch code are better documented.
Is there a way to use the BHY2 Sensor APIs to put the BHI260 in low power mode (deep sleep) until a wake up IMU event happens? In the board I'm using, the BHI260AB is connected to the main processor and the PMIC using the HIRQ pin. We need to conserve battery when the device is not worn, so we plan to use the PMIC to put the rest of the board in the lowest possible power mode, set the BHI260 to deep sleep and lowest clock, and have the entire system wake up when a movement happens.
I have not found any example about sleep/wake, and the APIs do not seem to have specific code. And so far I have not found a description in the datasheet. There are multiple references to the various sleep states, but I must have missed something.
Unfortunately I can't provide too many details on the device. It's a low power sports wearable device, transmitting data with ANT+. When the user stops the activity, the device is removed from the body and usually set away. When the user is ready again, the device is worn. Given we use a small rechargeable battery, having an ultra-low power mode when unused is critical
So we need to detect lack of activity for a few seconds (that part is done), then start the process to go into low power mode by properly configuring the BHI260, readying the main processor for sleep, and finally programming a PMIC to cut power to all the rails minus the BHI260 one. In a way the main processor kills its power as the last action
We would like for the BHI to detect, as you say, any type of motion and pull HIRQ low. That will power up again all the PMIC rails, and in turn boot the main processor which will "remember" it went to sleep, and restart from there. The board already connects HIRQ to the PMIC and the PMIC is programmed to wake up on an event
We need help in configuring the BHI for the lowest possible power consumption, then programming a wake up even on motion to issue the HIRQ signal. From reading the datasheet it's all possible. But I'm still unclear on the exact sequence needed 🙂