4

I'm running scripts on a Raspberry Pi 3 hooked up to an Adafruit BNO055 sensor, and occasionally when I run the test script I get this error:

   Traceback (most recent call last):
      File "simpletest.py", line 45, in <module>
        if not bno.begin():
      File "/usr/local/lib/python2.7/dist-packages/Adafruit_BNO055-1.0.2-py2.7.egg/Adafruit_BNO055/BNO055.py", line 385, in begin
      File "/usr/local/lib/python2.7/dist-packages/Adafruit_BNO055-1.0.2-py2.7.egg/Adafruit_BNO055/BNO055.py", line 346, in _read_byte
      File "/usr/local/lib/python2.7/dist-packages/Adafruit_BNO055-1.0.2-py2.7.egg/Adafruit_BNO055/BNO055.py", line 331, in _read_bytes
    RuntimeError: Register read error: 0xee06

I'm unfortunately new to using RPis and don't know how to proceed to fix this. Is this an error with the registry of the Raspberry Pi, or something to do with the sensor?

  • Have you enabled the serial port properly (see this question) and disabled the "Baudrate derived from system clock" feature? – Aurora0001 Jan 7 '18 at 10:19
1

I do not now the reason for this bug but on my setup it seems that if you try to start the script again a few times it will end up working.

A hacky fix is to catch the exception and try again.

Replace these lines:

# Initialize the BNO055 and stop if something went wrong.
if not bno.begin():
    raise RuntimeError('Failed to initialize BNO055! Is the sensor connected?')

# Print system status and self test result.
status, self_test, error = bno.get_system_status()

With something like:

while True:
    try:
        # Initialize the BNO055 and stop if something went wrong.
        if not bno.begin():
            raise RuntimeError('Failed to initialize BNO055! Is the sensor connected?')
        # Print system status and self test result.
        status, self_test, error = bno.get_system_status()
        break
    except Exception as e:
        print("Got error: {}".format(e))
        print("Sleeping 1s before retrying")
        time.sleep(1)
0

You will have to look at the indicated lines in the script to determine the underlying error.

It could be a bug in the script (not reacting properly to a returned status) or an error in the sensor or wiring.

At a guess a bug in the script is more likely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.