0

BNO055 does not run on Raspberry Pi4
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

BNO055 does not run on Raspberry Pi4

by klaushaas on Wed Nov 25, 2020 1:17 pm

Hi everyone,

I upgraded my Raspberry 3 B+ system to a Raspberry Pi 4B.

My BNO055 sensor was running well on my 3 B+, but I am really struggling to make it run on the Pi 4B.



- I first tried the same libraries which I used on the 3 B+ ("Adafruit_BNO055", without circuitpython) - did not work.

-I tried to connect via UART and use the "newer" Adafruit Circuitpython package -> it always gives me an this error:
Code: Select all | TOGGLE FULL SIZE
UART Read Error: 7
. Sometimes it also gives an error saying "Bad Chip ID"; it expects a0, but my Chip_ID is apparently 0

-I tried to connect via I2C and with Adafruit Circuitpython package -> gives me that error:
Code: Select all | TOGGLE FULL SIZE
no I2C device at address: 28
(running i2cdetect in the terminal also doesn't show any connected device)

The hardware is all fine, since it still works on my old Raspberry.


Best regards
//Klaus

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by dastels on Wed Nov 25, 2020 1:26 pm

Does i2cdetect show other I2C devices that you can connect?
Did you verify the wiring?
Did you verify that I2C is enabled?

Dave

dastels
 
Posts: 7525
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Wed Nov 25, 2020 1:48 pm

Hi Dave,

Thanks for your reply - I have not tried yet to detect other i2c devices as I don't have any to test right now. Anyway, I focus more on making it work with UART.

I just made it work for a few seconds, but then the UART error would show up again all the time. This never happens with my RPi 3B+, even when I try to move the sensor and the wires (so the soldering connections are actually fine).

See attached pic:
Capture.JPG
Capture.JPG (205.37 KiB) Viewed 215 times


Apparently one time it's a "read" error and then a "write" error.
The error just appears randomly - did not make any changes in between.

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Wed Nov 25, 2020 1:56 pm

And then, after waiting a while (without other changes) this error would show up:
Capture.JPG
Capture.JPG (85.4 KiB) Viewed 215 times

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by dastels on Wed Nov 25, 2020 4:42 pm

Your mention of I2C distracted me from your use of UART mode.

From your screen captures, it seems that comm settings are correct (baud rate and such) . Odd. The additional speed of the Pi 4 might be an issue... but I don't see how offhand.

What code are you running? I could give it a try.

Dave

dastels
 
Posts: 7525
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Wed Nov 25, 2020 5:18 pm

Just this one:

Code: Select all | TOGGLE FULL SIZE
import time
import board
import serial
import adafruit_bno055

uart = serial.Serial("/dev/serial0", 115200, timeout=5,writeTimeout=5) #I just added the additional arguments 2 - 4 -> no changes
bno = adafruit_bno055.BNO055_UART(uart)
time.sleep(5)
heading,roll,pitch=bno.euler
print(bno)
print(uart)

for i in range(0,10000):
   
    heading,roll,pitch=bno.euler
    print(roll,pitch)
    time.sleep(0.001)


furthermore, here is a list of my packages and its versions (with "pip3 list"):
Code: Select all | TOGGLE FULL SIZE
Adafruit-BBIO                    1.2.0     
Adafruit-Blinka                  5.8.0     
adafruit-circuitpython-bno055    5.2.2     
adafruit-circuitpython-busdevice 5.0.1     
adafruit-circuitpython-register  1.9.1     
Adafruit-GPIO                    1.0.3     
Adafruit-PlatformDetect          2.22.1     
Adafruit-PureIO                  1.1.7     
.....
pyserial                         3.4 
....   



EDIT: If I only read Acceleration or Temp instead of Euler - the problem still appears

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by dastels on Wed Nov 25, 2020 8:37 pm

Hmm... the 1mS delay might be too short. You might be hammering the serial connection to much and causing some overflow or dropped data. Try making the delay bigger. I'd start by overcompensating and setting it to 1S.

Dave

dastels
 
Posts: 7525
Joined: Tue Oct 20, 2015 3:22 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Thu Nov 26, 2020 5:47 am

Already tried that before - no changes.

I tried valuesfrom 0.001 up to 1 sec. :(

I also tried a factory reset of the RPi 4... without success.

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Thu Nov 26, 2020 6:42 am

klaushaas wrote:Just this one:

Code: Select all | TOGGLE FULL SIZE
import time
import board
import serial
import adafruit_bno055

uart = serial.Serial("/dev/serial0", 115200, timeout=5,writeTimeout=5) #I just added the additional arguments 2 - 4 -> no changes
bno = adafruit_bno055.BNO055_UART(uart)
time.sleep(5)
heading,roll,pitch=bno.euler
print(bno)
print(uart)

for i in range(0,10000):
   
    heading,roll,pitch=bno.euler
    print(roll,pitch)
    time.sleep(0.001)


furthermore, here is a list of my packages and its versions (with "pip3 list"):
Code: Select all | TOGGLE FULL SIZE
Adafruit-BBIO                    1.2.0     
Adafruit-Blinka                  5.8.0     
adafruit-circuitpython-bno055    5.2.2     
adafruit-circuitpython-busdevice 5.0.1     
adafruit-circuitpython-register  1.9.1     
Adafruit-GPIO                    1.0.3     
Adafruit-PlatformDetect          2.22.1     
Adafruit-PureIO                  1.1.7     
.....
pyserial                         3.4 
....   



EDIT: If I only read Acceleration or Temp instead of Euler - the problem still appears



Comment: Actually the code in this post is not 100% the same as in the terminal screenshot above, in case you wonder. However, I only changed some output print-lines (e.g. offsets). Changing it does not solve the problem though.

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by adafruit2 on Thu Nov 26, 2020 12:52 pm

we really recommend you just go with I2C - the Pi 4 has clock stretch support, so you dont have to slow down the i2c port
you can use i2cdetect to find out if the device is detected on i2c

adafruit2
Site Admin
 
Posts: 20277
Joined: Fri Mar 11, 2005 7:36 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Thu Nov 26, 2020 3:45 pm

Hi - I implemented the i2c interface with clock stretching (10kHz) - then I get this error (no device detected with i2cdetect):

Code: Select all | TOGGLE FULL SIZE
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 172, in __probe_for_device
    self.i2c.writeto(self.device_address, b"")
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 116, in writeto
    return self._i2c.writeto(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
    self._i2c_bus.write_bytes(address, buffer[start:end])
  File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_PureIO/smbus.py", line 308, in write_bytes
    self._device.write(buf)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 178, in __probe_for_device
    self.i2c.readfrom_into(self.device_address, result)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 106, in readfrom_into
    return self._i2c.readfrom_into(address, buffer, stop=stop)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 56, in readfrom_into
    readin = self._i2c_bus.read_bytes(address, end - start)
  File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_PureIO/smbus.py", line 179, in read_bytes
    return self._device.read(number)
OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_par.py", line 7, in <module>
    bno = adafruit_bno055.BNO055_I2C(i2c)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bno055.py", line 672, in __init__
    self.i2c_device = I2CDevice(i2c, address)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 68, in __init__
    self.__probe_for_device()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 180, in __probe_for_device
    raise ValueError("No I2C device at address: %x" % self.device_address)
ValueError: No I2C device at address: 28

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by adafruit2 on Thu Nov 26, 2020 3:52 pm

if it doesnt appear with i2cdetect then you wont be able to talk to it. check your wiring

adafruit2
Site Admin
 
Posts: 20277
Joined: Fri Mar 11, 2005 7:36 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Thu Nov 26, 2020 4:15 pm

Neither the RPi 3 B+ nor the Pi 4 B detect the sensor with i2cdetect -y 1 ... are there any settings which I would need to consider?

Still - UART works fine (only) on the RPi 3 B+

EDIT: I also measured the resistance between the neighbouring pins on the BNO055. They are apparently well isolated from each other. Except one pair: I measure 1500 Ohms between GND and SDA. Is that normal?

EDIT 2: I tried to connect a MPU5060 sensor to the i2c => It works.

klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Re: BNO055 does not run on Raspberry Pi4

by adafruit2 on Thu Nov 26, 2020 5:30 pm

post a photo of your wiring

adafruit2
Site Admin
 
Posts: 20277
Joined: Fri Mar 11, 2005 7:36 pm

Re: BNO055 does not run on Raspberry Pi4

by klaushaas on Fri Nov 27, 2020 12:10 pm


klaushaas
 
Posts: 17
Joined: Wed Nov 25, 2020 1:06 pm

Please be positive and constructive with your questions and comments.