You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to read BNO08x data via UART on a Single Board Computer running Ubuntu 22.04. The problem is that the driver fails during initialization and I think I tracked the error down to a faulty init routine in __init__.py:
definitialize(self) ->None:
"""Initialize the sensor"""for_inrange(3):
self.hard_reset()
self.soft_reset()
try:
ifself._check_id():
breakexceptBaseExceptionase: # pylint:disable=bare-exceptprint(e)
time.sleep(0.5)
else:
raiseRuntimeError("Could not read ID")
My test program is bno08x_simpletest_uart.py with some setup changes (baudrate 3000000, adjusted serial port and debug=True):
# SPDX-FileCopyrightText: 2020 Bryan Siepert, written for Adafruit Industries## SPDX-License-Identifier: Unlicenseimporttimeimportadafruit_bno08xfromadafruit_bno08x.uartimportBNO08X_UARTimportboard# pylint:disable=wrong-import-orderimportbusio# pylint:disable=wrong-import-order#uart = busio.UART(board.TX, board.RX, baudrate=3000000, receiver_buffer_size=2048)# uncomment and comment out the above for use with Raspberry Piimportserialuart=serial.Serial("/dev/ttyS4", 3000000)
# for a USB Serial cable:# import serial# uart = serial.Serial("/dev/ttyUSB0", baudrate=115200)bno=BNO08X_UART(uart, reset=None, debug=True)
bno.enable_feature(adafruit_bno08x.BNO_REPORT_ACCELEROMETER)
bno.enable_feature(adafruit_bno08x.BNO_REPORT_GYROSCOPE)
bno.enable_feature(adafruit_bno08x.BNO_REPORT_MAGNETOMETER)
bno.enable_feature(adafruit_bno08x.BNO_REPORT_ROTATION_VECTOR)
...
Now when I run the program it stops with an error Could not read ID (full debug output below). Note that I have printed out the actual exception coming from self.check_id() as it would not have been visible in the original program (in the above printed initialize method). So I found this exception to be Didn't find packet end thrown in uart.py in the _read_packet method:
What I believe happens is that the soft_reset method in uart.py is sending out a couple of packets which somehow cause the check_id method to fail. Further, when the check_id method sends out the command to read the product id, the response is read by the soft_reset in the next turn of the for loop. So the response will never be available in the check_id method. Thus, this whole init method fails. The simplest way to solve this is to comment out this line:
Hi all
I'm trying to read BNO08x data via UART on a Single Board Computer running Ubuntu 22.04. The problem is that the driver fails during initialization and I think I tracked the error down to a faulty init routine in
__init__.py
:My test program is
bno08x_simpletest_uart.py
with some setup changes (baudrate 3000000, adjusted serial port and debug=True):Now when I run the program it stops with an error
Could not read ID
(full debug output below). Note that I have printed out the actual exception coming fromself.check_id()
as it would not have been visible in the original program (in the above printedinitialize
method). So I found this exception to beDidn't find packet end
thrown inuart.py
in the_read_packet
method:Adafruit_CircuitPython_BNO08x/adafruit_bno08x/uart.py
Line 138 in cfefd94
What I believe happens is that the
soft_reset
method inuart.py
is sending out a couple of packets which somehow cause thecheck_id
method to fail. Further, when thecheck_id
method sends out the command to read the product id, the response is read by thesoft_reset
in the next turn of the for loop. So the response will never be available in thecheck_id
method. Thus, this whole init method fails. The simplest way to solve this is to comment out this line:Adafruit_CircuitPython_BNO08x/adafruit_bno08x/__init__.py
Line 523 in cfefd94
The question is: What is this
soft_reset
good for? Is it safe to disable?Thank you for any advice.
The text was updated successfully, but these errors were encountered: