Open
Description
Subject of the issue
If the main loop evaluation time in an Arduino sketch is slightly larger than the update rate of the sensor, the Sensor will not report any updates via SPI any more.
Not sure, whether this is a library problem or whether there is some internal (inside the BNO080) buffer overflow, which stops the sensor from working properly.
Your workbench
- What development board or microcontroller are you using?
-> Teensy 4.0 - What version of hardware or breakout board are you using?
-> don't know - How is the breakout board to your microcontroller?
-> connected with SPI - How is everything being powered?
-> USB power supply - Are there any additional details that may help us help you?
-> no
Steps to reproduce
Slightly modified version of SPI example "Example1-RotationVector"
- Sample time of 10 ms, delay of 9 ms in main loop --> everything works fine
#include "SparkFun_BNO080_Arduino_Library.h"
BNO080 myIMU;
//These pins can be any GPIO
byte imuCSPin = 10;
byte imuWAKPin = 14;
byte imuINTPin = 16;
byte imuRSTPin = 15;
unsigned long startTime; //Used for calc'ing Hz
long measurements = 0; //Used for calc'ing Hz
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println("BNO080 SPI Read Example");
if(myIMU.beginSPI(imuCSPin, imuWAKPin, imuINTPin, imuRSTPin) == false)
{
Serial.println("BNO080 over SPI not detected. Are you sure you have all 6 connections? Freezing...");
while(1);
}
myIMU.enableRotationVector(10); //Send data update every 10ms
startTime = millis();
}
void loop()
{
Serial.println("Doing other things");
delay(9); //You can do many other things. We spend most of our time printing and delaying.
//Look for reports from the IMU
if (myIMU.dataAvailable() == true)
{
measurements++;
Serial.print((float)measurements / ((millis() - startTime) / 1000.0), 2);
Serial.print(F("Hz"));
Serial.println();
}
}
- Sample time of 10 ms, delay of 11 ms in main loop --> measurements will stop after a few updates
#include "SparkFun_BNO080_Arduino_Library.h"
BNO080 myIMU;
//These pins can be any GPIO
byte imuCSPin = 10;
byte imuWAKPin = 14;
byte imuINTPin = 16;
byte imuRSTPin = 15;
unsigned long startTime; //Used for calc'ing Hz
long measurements = 0; //Used for calc'ing Hz
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println("BNO080 SPI Read Example");
if(myIMU.beginSPI(imuCSPin, imuWAKPin, imuINTPin, imuRSTPin) == false)
{
Serial.println("BNO080 over SPI not detected. Are you sure you have all 6 connections? Freezing...");
while(1);
}
myIMU.enableRotationVector(10); //Send data update every 10ms
startTime = millis();
}
void loop()
{
Serial.println("Doing other things");
delay(9); //You can do many other things. We spend most of our time printing and delaying.
//Look for reports from the IMU
if (myIMU.dataAvailable() == true)
{
measurements++;
Serial.print((float)measurements / ((millis() - startTime) / 1000.0), 2);
Serial.print(F("Hz"));
Serial.println();
}
}
Expected behavior
Measurements over SPI should still be available
Actual behavior
Can not read any data from sensor