BNO08x SPI GetSensorEvent() Blocking Loop


Hi I've done some extensive testing using a BNO08x with the latest Adafruit libraries and a Teensy 4.1 connected via SPI. It seems that the Adafruit BNO08x.getSensorEvent() method consumes a dynamic amount of loop time to make the main loop frequency equal the event rate of the BNO08x.

For example, if I comment out the BNO0x.getSensorEvent() method, the main loop runs at ~5000 Hz. As soon as I add the getSensorEvent() method back in the main loop, the frequency drops to 100-300Hz depending on which reports I have enabled. If I don't enable any reports, the main loop frequency is about 10Hz...?

It seems that it is not yielding to the main loop for some reason. To be clear, this is not the frequency of the events returned, this is the frequency of the main Teensy loop() function. I also removed all processing of the returned sensorValue data to eliminate that processing time from the equation.

Does anyone know a way to make the getSensorEvent() method yield? I'm guessing it is something related to the Hillcrest Sensor Hub Transport Protocol (SHTP)

Adafruit Library:

This is the basic code to demonstrate the issue. See the lines to comment/uncomment in the void loop()
#include <Arduino.h>
#include <Adafruit_BNO08x.h>

// For SPI mode, we need a CS pin
#define BNO08X_CS 10
#define BNO08X_INT 30
#define BNO08X_RESET 33

Adafruit_BNO08x  bno08x(BNO08X_RESET);
sh2_SensorValue_t sensorValue;

sh2_SensorId_t reportType = SH2_ARVR_STABILIZED_RV;
long reportIntervalUs = 5000;

void setReports(sh2_SensorId_t reportType, long report_interval) {
    Serial.println("Setting desired reports");
    if (!bno08x.enableReport(reportType, report_interval)) {
        Serial.println("Could not enable stabilized remote vector");

void setup(void) {

    while (!Serial) delay(10);     // will pause Zero, Leonardo, etc until serial console opens

    Serial.println("Adafruit BNO08x test!");

    // Try to initialize!
    if (!bno08x.begin_SPI(BNO08X_CS, BNO08X_INT)) {
        Serial.println("Failed to find BNO08x chip");
        while (1) { delay(10); }
    Serial.println("BNO08x Found!");

    setReports(reportType, reportIntervalUs);

    Serial.println("Reading events");

uint32_t timer;
uint32_t interval = 50;
uint32_t cycles_past = 0;
double loop_rate;

void loop() {

    if (bno08x.wasReset()) {
        Serial.print("sensor was reset ");
        setReports(reportType, reportIntervalUs);

    // comment this line out for inscreased loop_rate
    // if it is uncommented, the loop_rate exactly matches the event rate

    if (micros() - timer >= interval) {
        loop_rate = (double)cycles_past / (((double)micros() - (double)timer) / 1000000.0);
        cycles_past = 0;
        timer = micros();