BNO055 Qwiic connected to Arduino R4 Wifi

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
hellodavid
 
Posts: 1
Joined: Tue Jul 09, 2024 9:33 am

BNO055 Qwiic connected to Arduino R4 Wifi

Post by hellodavid »

I got this sensor: Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055 (STEMMA QT / Qwiic)

Connected it to my Ardunio R4 via the Qwiic port/cable. Then run the below code, but it ouputs the orientation always as:
X: 0.0000 Y: 0.0000 Z: 0.0000
I then run the same code on a SparkFun Pro Micro - ESP32-C3, with the only difference in the code being that it usings `Wire` instead of `Wire1`. And it works fine on the ESP32.

Why does it not work on the Arduino R4?

Code: Select all

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>


Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28, &Wire1);

void setup(void)
{
  Serial.begin(115200);

  while (!Serial) delay(10);
  
  if (!bno.begin())
  {
    Serial.print("No BNO055 detected");
    while (1);
  }

  delay(1000);

  bno.setExtCrystalUse(true);
}

void loop(void)
{
  /* Get a new sensor event */ 
  sensors_event_t event; 
  bno.getEvent(&event);
  
  /* Display the floating point data */
  Serial.print("X: ");
  Serial.print(event.orientation.x, 4);
  Serial.print("\tY: ");
  Serial.print(event.orientation.y, 4);
  Serial.print("\tZ: ");
  Serial.print(event.orientation.z, 4);
  Serial.println("");
  
  delay(100);
}

Note using address 0x29 results in "No BNO055 detected" on both boards, so I know i'm using the right address.

User avatar
dastels
 
Posts: 16382
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by dastels »

The BNO055 is finicky and abuses the I2C spec in places. From the tutorial guide (https://learn.adafruit.com/adafruit-bno ... ion-sensor):
The BNO055 I2C implementation violates the I2C protocol in some circumstances. This causes it not to work well with certain chip families. It does not work well with Espressif ESP32, ESP32-S3, and NXP i.MX RT1011, and it does not work well with I2C multiplexers. Operation with SAMD51, RP2040, STM32F4, and nRF52840 is more reliable.
Couple that with the R4 using a new MCU that still doesn't work with some things. I'm not surprised that this combination is problematic. Look to the Arduino forums for more information.

Dave

User avatar
gammaburst
 
Posts: 1049
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by gammaburst »

dastels, are you Adafruit support? Adafruit's responses to this persistent issue have been unhelpful.

Hi hellodavid, I've seen the same problem. Try this workaround (with my best guess explanation):
viewtopic.php?p=998996

Observations, comments and corrections are welcome.

User avatar
dastels
 
Posts: 16382
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by dastels »

I do support on the forums for them.

As I said, the BNO055 doesn't play nice with the I2C spec and, as I also said, the R4 uses a new MCU. One that Adafruit doesn't support. While it does use the familiar ARM Cortex-M4 core, the MCU itself is new and different: a Renesas RA4M1. In the end it's Arduino's product that's the problem so you should talk to them about it.

Also, gammaburst seems to have a workaround that might help.

Dave

User avatar
gammaburst
 
Posts: 1049
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by gammaburst »

Adafruit's BNO055 advertisement says, "... you can use it with any microcontroller or computer board ..."
https://www.adafruit.com/product/4646

Have you identified a relevant problem with the Arduino R4?

Adafruit should list the BNO055's known problems on its advertisement page. At errata sheet.

User avatar
dastels
 
Posts: 16382
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by dastels »

It's noted in the tutorial guide at https://learn.adafruit.com/adafruit-bno ... ion-sensor:
The BNO055 I2C implementation violates the I2C protocol in some circumstances. This causes it not to work well with certain chip families. It does not work well with Espressif ESP32, ESP32-S3, and NXP i.MX RT1011, and it does not work well with I2C multiplexers. Operation with SAMD51, RP2040, STM32F4, and nRF52840 is more reliable.
I've suggested that this would be a good addition to the product pages as well.

As for the R4, Adafruit neither sells nor supports it the last I heard.

Dave

User avatar
gammaburst
 
Posts: 1049
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055 Qwiic connected to Arduino R4 Wifi

Post by gammaburst »

Please don't spread that bogus warning message from Adafruit's BNO055 guide. It misses the point. The timing violation causes any I2C project to be close to failure, no matter which microcontroller. Some are just barely working, others are just barely failing. When Adafruit suggests certain microcontrollers are "more reliable", they're condoning "just barely working". That's wrong in my book. Instead, Adafruit should explain the problem/risk to the user, and suggest applying a workaround that reduces the timing violation so the microcontroller "works pretty solidly". (I don't know of any workaround that eliminates the BNO's timing violation.) By the way, my experiments suggest it's not the chip type that decides working or non-working, it's the board's I2C bus electrical loading (capacitance, pullups, etc). That's why adding an extra pullup or capacitor can cause a previously non-working project to work pretty solidly (or vice-versa), and why some microcontroller boards are resistant to simple workarounds (they usually have built-in strong pullups). Or perhaps Adafruit can think up a better workaround than mine.

When I asked if you identified a relevant problem with the Arduino R4, I was referring to your statement "it's Arduino's product that's the problem".

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”