0

Use Bno085 with bno08x_simpletest.py fail.
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Use Bno085 with bno08x_simpletest.py fail.

by Wols on Wed Jul 28, 2021 5:57 am

Since no any new thinking about BNO085 with UART : viewtopic.php?f=19&t=181558
I buy a Adafruit MCP2221A Breakout to try BNO085 i2c.
But it still fail...I can't get any data from BNO085 and it return error any one can help?

The board I use : MCP2221
The sample code I use : https://github.com/adafruit/Adafruit_Ci ... pletest.py
The Error message I got.
1627465586614.jpg
1627465586614.jpg (272.58 KiB) Viewed 100 times

Wols
 
Posts: 5
Joined: Wed Mar 31, 2021 4:20 am

Re: Use Bno085 with bno08x_simpletest.py fail.

by Wols on Wed Jul 28, 2021 6:49 am

Wols wrote:Since no any new thinking about BNO085 with UART : viewtopic.php?f=19&t=181558
I buy a Adafruit MCP2221A Breakout to try BNO085 i2c.
But it still fail...I can't get any data from BNO085 and it return error any one can help?

The board I use : MCP2221
The sample code I use : https://github.com/adafruit/Adafruit_Ci ... pletest.py
The Error message I got.
1627465586614.jpg


Sice I use this code, which show on adafruit/Adafruit_CircuitPython_BNO08x/readme, instead bno08x_simpletest.py
Code: Select all | TOGGLE FULL SIZE
import board
import busio
from adafruit_bno08x.i2c import BNO08X_I2C
from adafruit_bno08x import BNO_REPORT_ACCELEROMETER

i2c = busio.I2C(board.SCL, board.SDA)
bno = BNO08X_I2C(i2c)
bno.enable_feature(BNO_REPORT_ACCELEROMETER)

while True:
    accel_x, accel_y, accel_z = bno.acceleration  # pylint:disable=no-member
    print("X: %0.6f  Y: %0.6f Z: %0.6f  m/s^2" % (accel_x, accel_y, accel_z))

It only use Accelerometer, and it work now.
I think there has some little thing i should config in bno08x_simpletest.py
I will keep trying.

Wols
 
Posts: 5
Joined: Wed Mar 31, 2021 4:20 am

Re: Use Bno085 with bno08x_simpletest.py fail.

by adafruit_support_carter on Wed Jul 28, 2021 3:39 pm

Try running the simpletest again but change this line:
Code: Select all | TOGGLE FULL SIZE
i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)

to this:
Code: Select all | TOGGLE FULL SIZE
i2c = busio.I2C(board.SCL, board.SDA)

adafruit_support_carter
 
Posts: 21142
Joined: Tue Nov 29, 2016 2:45 pm

Re: Use Bno085 with bno08x_simpletest.py fail.

by Wols on Thu Jul 29, 2021 11:56 am

Still same error :'(
Code: Select all | TOGGLE FULL SIZE
# SPDX-FileCopyrightText: 2020 Bryan Siepert, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import time
import board
import busio
from adafruit_bno08x import (
    BNO_REPORT_ACCELEROMETER,
    BNO_REPORT_GYROSCOPE,
    BNO_REPORT_MAGNETOMETER,
    BNO_REPORT_ROTATION_VECTOR,
)
from adafruit_bno08x.i2c import BNO08X_I2C

i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)
bno = BNO08X_I2C(i2c)

bno.enable_feature(BNO_REPORT_ACCELEROMETER)
bno.enable_feature(BNO_REPORT_GYROSCOPE)
bno.enable_feature(BNO_REPORT_MAGNETOMETER)
bno.enable_feature(BNO_REPORT_ROTATION_VECTOR)

while True:

    time.sleep(0.5)
    print("Acceleration:")
    accel_x, accel_y, accel_z = bno.acceleration  # pylint:disable=no-member
    print("X: %0.6f  Y: %0.6f Z: %0.6f  m/s^2" % (accel_x, accel_y, accel_z))
    print("")

    print("Gyro:")
    gyro_x, gyro_y, gyro_z = bno.gyro  # pylint:disable=no-member
    print("X: %0.6f  Y: %0.6f Z: %0.6f rads/s" % (gyro_x, gyro_y, gyro_z))
    print("")

    print("Magnetometer:")
    mag_x, mag_y, mag_z = bno.magnetic  # pylint:disable=no-member
    print("X: %0.6f  Y: %0.6f Z: %0.6f uT" % (mag_x, mag_y, mag_z))
    print("")

    print("Rotation Vector Quaternion:")
    quat_i, quat_j, quat_k, quat_real = bno.quaternion  # pylint:disable=no-member
    print(
        "I: %0.6f  J: %0.6f K: %0.6f  Real: %0.6f" % (quat_i, quat_j, quat_k, quat_real)
    )
    print("")

Error message
Code: Select all | TOGGLE FULL SIZE
  File "c:\Users\canic\Desktop\code\BNO085\BNO085_ada_i2c_mcp2221.py", line 27, in <module>
    accel_x, accel_y, accel_z = bno.acceleration  # pylint:disable=no-member
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_bno08x\__init__.py", line 601, in acceleration
    self._process_available_packets()
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_bno08x\__init__.py", line 789, in _process_available_packets
    while self._data_ready:
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_bno08x\i2c.py", line 148, in _data_ready
    header = self._read_header()
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_bno08x\i2c.py", line 94, in _read_header
    i2c.readinto(self._data_buffer, end=4)  # this is expecting a header
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_bus_device\i2c_device.py", line 67, in readinto
    self.i2c.readfrom_into(self.device_address, buf, start=start, end=end)
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\busio.py", line 149, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\i2c.py", line 23, in readfrom_into
    self._mcp2221.i2c_readfrom_into(address, buffer, start=start, end=end)
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 319, in i2c_readfrom_into
    self._i2c_read(0x91, address, buffer, start, end)
  File "C:\Users\canic\AppData\Local\Programs\Python\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\mcp2221.py", line 289, in _i2c_read
    raise RuntimeError("I2C read error: max retries reached.")
RuntimeError: I2C read error: max retries reached.

Wols
 
Posts: 5
Joined: Wed Mar 31, 2021 4:20 am

Re: Use Bno085 with bno08x_simpletest.py fail.

by adafruit_support_carter on Thu Jul 29, 2021 1:19 pm

Not sure. The BNO085 is a tricky sensor. And the MCP2221 has its own quirks. So the combo just seems to not be working. Opened an issue for this here:
https://github.com/adafruit/Adafruit_Ci ... /issues/28

adafruit_support_carter
 
Posts: 21142
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.