BNO085 Reports: Activity Classification working?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Wardnb
- Posts: 3
- Joined: Wed Mar 24, 2021 7:56 pm
Re: BNO085 Reports: Activity Classification working?
I'll test again, but I continually triggered these errors until I changed this setting. I thought it was the i2c bus, so I tried to get it working on hart, but like others, could get it working. Tried this on an rp4 and rp0 w.
- garid3000
- Posts: 1
- Joined: Fri May 07, 2021 1:03 am
Re: BNO085 Reports: Activity Classification working?
I was using Adafruit's bno08x library. With my RPi3 there was no errors,
BUT with my RPi4, I was getting the same errors you had got.
(Actually, I found your question while I was searching one of the error number 123.)
So far, I found this link, and put following line to /boot/config.txt
For me, it seems like it's still working.
Running for couple of minutes, (Previously I was getting errors in couple of seconds)
Hope this information helps you as it helped me.
BUT with my RPi4, I was getting the same errors you had got.
(Actually, I found your question while I was searching one of the error number 123.)
So far, I found this link, and put following line to /boot/config.txt
Code: Select all
dtparam=i2c_arm_baudrate=400000
Running for couple of minutes, (Previously I was getting errors in couple of seconds)
Hope this information helps you as it helped me.
- jbartates
- Posts: 1
- Joined: Tue Jul 06, 2021 12:49 am
Re: BNO085 Reports: Activity Classification working?
Ive set the baud rate as described in the documentation but I'm still running into this error.
Typically a Key Error of 123 after about 10 seconds of running the simpletest.py code.
Typically a Key Error of 123 after about 10 seconds of running the simpletest.py code.
- jps2000
- Posts: 811
- Joined: Fri Jun 02, 2017 4:12 pm
Re: BNO085 Reports: Activity Classification working?
The BNO085 is sending data on the I2C bus at a rate defined in the setup. In case it can not finish because too much data to send it resends everything.
This may lead to data loss.
Do not activate reports not needed.
The interrupt pin indicates with L level that the BNO needs attention to read all the data. So it is good to measure the pin with a scope to see if there is enough free time (H level)
Max I2c clock rate is 400kHz acc to spec but I found that even 1000000 still works. So more headroom for data transfer.
This may lead to data loss.
Do not activate reports not needed.
The interrupt pin indicates with L level that the BNO needs attention to read all the data. So it is good to measure the pin with a scope to see if there is enough free time (H level)
Max I2c clock rate is 400kHz acc to spec but I found that even 1000000 still works. So more headroom for data transfer.
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
Okay, I'm getting the same problem when running the example file bno08x_more_reports.py.
I have been chasing it down and this is what I have learned:
I have been chasing it down and this is what I have learned:
- Prior to editing the file /etc/config.txt, the example file crashes immediately on a RaspberryPi 3B+ running Raspberry Pi OS.
- The same file runs without errors after adding the following line to /boot/config.txt and then rebooting.
Code: Select all
dtparam=i2c_arm_baudrate=400000
- On a Raspberry Pi 4 with 8GB RAM running Ubuntu-Mate 20.04, the file crashes immediately.
Ubuntu doesn't have a /boot/config.txt file, so I put one in with the same i2c lines as were used in the Raspberry Pi OS, then rebooted, but still with the same result. Apparently, Ubuntu doesn't read this config file.
- mikeysklar
- Posts: 18028
- Joined: Mon Aug 01, 2016 8:10 pm
Re: BNO085 Reports: Activity Classification working?
@DBLanding,
/etc/modprobe.d/i2c_bcm2708.conf
Does this do it for you?
/etc/modprobe.d/i2c_bcm2708.conf
Code: Select all
options i2c_bcm2708 baudrate=400000
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
No, this doesn't solve the problem for me. After creating the file: /etc/modprobe.d/i2c_bcm2708.conf with the single line: options i2c_bcm2708 baudrate=400000, I continue to get the same type of errors. I even tried rebooting but with no improvement.
Code: Select all
ubuntu@robot:~/catkin_ws$ roslaunch ros_bno08x bno08x.launch
... logging to /home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/roslaunch-robot-2317.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://robot:37255/
SUMMARY
========
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.13
NODES
/
ros_bno08x (ros_bno08x/talker.py)
ROS_MASTER_URI=http://raspi4:11311/
process[ros_bno08x-1]: started with pid [2325]
Traceback (most recent call last):
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 88, in <module>
bno08x_node()
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 33, in bno08x_node
bno.enable_feature(BNO_REPORT_ACCELEROMETER)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 989, in enable_feature
self._process_available_packets(max_packets=10)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 794, in _process_available_packets
new_packet = self._read_packet()
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/i2c.py", line 128, in _read_packet
self._update_sequence_number(new_packet)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 845, in _update_sequence_number
self._sequence_number[channel] = seq
IndexError: list assignment index out of range
[ros_bno08x-1] process has died [pid 2325, exit code 1, cmd /home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py __name:=ros_bno08x __log:=/home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1.log].
log file: /home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1*.log
[ros_bno08x-1] restarting process
process[ros_bno08x-1]: started with pid [2332]
Traceback (most recent call last):
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 88, in <module>
bno08x_node()
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 44, in bno08x_node
accel_x, accel_y, accel_z = bno.acceleration
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 601, in acceleration
self._process_available_packets()
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 797, in _process_available_packets
self._handle_packet(new_packet)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 855, in _handle_packet
raise error
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 850, in _handle_packet
_separate_batch(packet, self._packet_slices)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 361, in _separate_batch
required_bytes = _report_length(report_id)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 350, in _report_length
return _AVAIL_SENSOR_REPORTS[report_id][2]
KeyError: 123
[ros_bno08x-1] process has died [pid 2332, exit code 1, cmd /home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py __name:=ros_bno08x __log:=/home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1.log].
log file: /home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1*.log
[ros_bno08x-1] restarting process
process[ros_bno08x-1]: started with pid [2339]
Traceback (most recent call last):
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 88, in <module>
bno08x_node()
File "/home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py", line 44, in bno08x_node
accel_x, accel_y, accel_z = bno.acceleration
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 601, in acceleration
self._process_available_packets()
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 797, in _process_available_packets
self._handle_packet(new_packet)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 855, in _handle_packet
raise error
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 850, in _handle_packet
_separate_batch(packet, self._packet_slices)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 361, in _separate_batch
required_bytes = _report_length(report_id)
File "/usr/local/lib/python3.8/dist-packages/adafruit_bno08x/__init__.py", line 350, in _report_length
return _AVAIL_SENSOR_REPORTS[report_id][2]
KeyError: 123
[ros_bno08x-1] process has died [pid 2339, exit code 1, cmd /home/ubuntu/catkin_ws/src/ros_bno08x/src/talker.py __name:=ros_bno08x __log:=/home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1.log].
log file: /home/ubuntu/.ros/log/9840b540-2e65-11ec-86e7-63fe80f3cb4b/ros_bno08x-1*.log
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
@mikeysklar,
I neglected to clarify that I get these errors with Ubuntu 20.04 LTS, not Raspberry Pi OS. Also, I get them on both Raspberry PI 3B+ and Raspberry Pi4.
Doug
I neglected to clarify that I get these errors with Ubuntu 20.04 LTS, not Raspberry Pi OS. Also, I get them on both Raspberry PI 3B+ and Raspberry Pi4.
Doug
- gammaburst
- Posts: 1102
- Joined: Thu Dec 31, 2015 12:06 pm
Re: BNO085 Reports: Activity Classification working?
I tried running "bno08x_more_reports.py" on my Raspberry Pi Pico, and it was unstable.
I made a few modifications, and now it runs smoothly. Perhaps my mods will help your project.
I began with the CircuitPython example:
https://github.com/adafruit/Adafruit_Ci ... reports.py
I needed to rearrange the I2C pins, and I noticed that that "frequency=800000" exceeds the "400 kHz maximum" requirement of the BNO085 data sheet, so I changed this line:
i2c = busio.I2C(board.SCL, board.SDA, frequency=800000)
to this:
i2c = busio.I2C(board.GP15, board.GP14, frequency=400000)
The project now starts-up sometimes but not always. So I added some code near the top that sends a reset pulse to the BNO085 "RST" pin. Now the project starts-up every time:
import digitalio
rst = digitalio.DigitalInOut(board.GP16) # connect to BNO's RST pin
rst.direction = digitalio.Direction.OUTPUT
rst.value = False
time.sleep(0.001); # at least 10 nanoseconds
rst.value = True
time.sleep(0.100); # at least 94 milliseconds
The project now starts-up and runs for a little while (seconds or minutes), but then crashes with a KeyError message. I've seen similar trouble with many other BNO I2C projects. As a test, I attached a short wire to SDA, grabbed the wire with two fingers, and the project crashed immediately. I know how to fix this! I added an extra pullup resistor (approximately 2K to 3K ohms) from SDA to 3.3V, and the instability disappeared. The project now runs smoothly.
Photo of my Pico + BNO085 + mods:
viewtopic.php?f=60&t=184213&p=894312#p894312
Some explanation of my pullup resistor mod:
viewtopic.php?f=60&t=182881&start=15#p889629
Maybe those mods will help your project too.
I made a few modifications, and now it runs smoothly. Perhaps my mods will help your project.
I began with the CircuitPython example:
https://github.com/adafruit/Adafruit_Ci ... reports.py
I needed to rearrange the I2C pins, and I noticed that that "frequency=800000" exceeds the "400 kHz maximum" requirement of the BNO085 data sheet, so I changed this line:
i2c = busio.I2C(board.SCL, board.SDA, frequency=800000)
to this:
i2c = busio.I2C(board.GP15, board.GP14, frequency=400000)
The project now starts-up sometimes but not always. So I added some code near the top that sends a reset pulse to the BNO085 "RST" pin. Now the project starts-up every time:
import digitalio
rst = digitalio.DigitalInOut(board.GP16) # connect to BNO's RST pin
rst.direction = digitalio.Direction.OUTPUT
rst.value = False
time.sleep(0.001); # at least 10 nanoseconds
rst.value = True
time.sleep(0.100); # at least 94 milliseconds
The project now starts-up and runs for a little while (seconds or minutes), but then crashes with a KeyError message. I've seen similar trouble with many other BNO I2C projects. As a test, I attached a short wire to SDA, grabbed the wire with two fingers, and the project crashed immediately. I know how to fix this! I added an extra pullup resistor (approximately 2K to 3K ohms) from SDA to 3.3V, and the instability disappeared. The project now runs smoothly.
Photo of my Pico + BNO085 + mods:
viewtopic.php?f=60&t=184213&p=894312#p894312
Some explanation of my pullup resistor mod:
viewtopic.php?f=60&t=182881&start=15#p889629
Maybe those mods will help your project too.
- mikeysklar
- Posts: 18028
- Joined: Mon Aug 01, 2016 8:10 pm
Re: BNO085 Reports: Activity Classification working?
@DBLanding,
Have you been using the using the 32-bit version or 64-bit?
Can you try putting the 20.10 release on a different SD card?
https://ubuntu-mate.org/download/armhf/groovy/
Have you been using the using the 32-bit version or 64-bit?
Can you try putting the 20.10 release on a different SD card?
https://ubuntu-mate.org/download/armhf/groovy/
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
Thanks for your suggestion @gammaburst, but my frequency is already set to 400000 Hz.
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
@mikeysklar asked whether I have installed the 32 bit or 64 bit version.
I installed the 64 bit version of Ubuntu 20.04.3 LTS. I also have installed ROS Noetic, which requires Ubuntu 20.04 LTS (not 20.10)
I installed the 64 bit version of Ubuntu 20.04.3 LTS. I also have installed ROS Noetic, which requires Ubuntu 20.04 LTS (not 20.10)
- gammaburst
- Posts: 1102
- Joined: Thu Dec 31, 2015 12:06 pm
Re: BNO085 Reports: Activity Classification working?
Did you try the pullup resistor modification?
It cures most BNO085/BNO055 instability problems.
It cures most BNO085/BNO055 instability problems.
- DBlanding
- Posts: 21
- Joined: Sun Mar 14, 2021 7:45 am
Re: BNO085 Reports: Activity Classification working?
I did try the pullup resistor (2.7K) as @gammaburst suggested, but it didn't solve the problem for me. Typically the process runs for a matter of seconds, then ends with a KeyError and restarts.
- gammaburst
- Posts: 1102
- Joined: Thu Dec 31, 2015 12:06 pm
Re: BNO085 Reports: Activity Classification working?
Sorry the resistor didn't work for you. It's my best BNO fix-it trick.
Please be positive and constructive with your questions and comments.