BNO080 and Teensy 4.0

I recently tried the “Example2-Accelerometer” example using the Sparkfun library, and a Teensy 4.0.

The Teensy seems to achieve the ‘setup’ portion of the example, but seems to hang at that point. I assume because ‘myIMU.dataAvailable’ does not become true. I also tried the code commenting out the ‘Wire.setClock(400000)’. A copy of the short code is below for reference.

I’m confident in the connection/setup. The connection is simply a Quiic connector breadboard connected to the Teensy. If I build the Teensy with the I2C scanner, it produces the correct 0x4B address for then BNO080.

Any advice, or next steps? I found a thread on the PJRC (Teensy) site that had some I2C start-up issues.

https://forum.pjrc.com/threads/57543-Te … uit-BNO055

#include <Wire.h>

#include "SparkFun_BNO080_Arduino_Library.h"
BNO080 myIMU;

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("BNO080 Read Example");

  Wire.begin();

  myIMU.begin();

  Wire.setClock(400000); //Increase I2C data rate to 400kHz

  myIMU.enableAccelerometer(50); //Send data update every 50ms

  Serial.println(F("Accelerometer enabled"));
  Serial.println(F("Output in form x, y, z, in m/s^2"));
}

void loop()
{
  //Look for reports from the IMU
  if (myIMU.dataAvailable() == true)
  {
    float x = myIMU.getAccelX();
    float y = myIMU.getAccelY();
    float z = myIMU.getAccelZ();

    Serial.print(x, 2);
    Serial.print(F(","));
    Serial.print(y, 2);
    Serial.print(F(","));
    Serial.print(z, 2);
    Serial.print(F(","));

    Serial.println();
  }
}

I had some additional time to experiment with the library.

The thread regarding the BNO0555 noted adding increased delay in the reset sequence, due to chip start delay, got things up and going. This did not work for the 080.

I modified the Accelerometer example code, and stored the output of the myIMU.begin() call, and found the begin function is the source of failure (returns false).

After further experimentation, trying the ‘PrintPacket’ example, the error seems related to a failure ‘receivePacket’ function in the .cpp. The ‘begin’ function calls this to flush the buffer after issuing reset. The PrintPacket code seems to throw ‘I2C Timeout’ from the receivePacket function. I haven’t yet isolated how/why.

Additional insights are greatly appreciated. I’ll continue to share if I figure it out.

I experimented further this evening.

Code ran with no problem on a Teensy 3.6.

After additional experimentation on the 4.0, I believe the interface hangs in the ‘begin’ function of the BNO080 library. The code sends a reset packet, and waits for an ‘advertisement’ data payload. The library is designed to read/dump this data, and begin on the other side ready to issue/accept command. I think it may be hanging at this phase.

I haven’t yet been able to disassemble/instrument the code to further isolate the problem.

Any pointers or experiment suggestions are appreciated.

I’ve also initiated a thread in the PJRC (Teensy) forum.

https://forum.pjrc.com/threads/58268-Sp … post220665

Hi ckmiauto,

That is weird the issue is specifically related to the Teensy 4.0. I will talk to the engineers for this board and we will look into it further. My guess is some clock settings with the 4.0 are causing the problem here.