0

Error when trying to run BNO055 simpletest.py
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Error when trying to run BNO055 simpletest.py

by jamiestewart on Sat Aug 26, 2017 3:52 am

Product BNO055 simpletest.py
Host Beaglebone black wireless
Error
debian@beaglebone:~/Adafruit_Python_BNO055/examples$ sudo python simpletest.py
Traceback (most recent call last):
File "simpletest.py", line 46, in <module>
if not bno.begin():
File "build/bdist.linux-armv7l/egg/Adafruit_BNO055/BNO055.py", line 382, in begin
File "build/bdist.linux-armv7l/egg/Adafruit_BNO055/BNO055.py", line 358, in _config_mode
File "build/bdist.linux-armv7l/egg/Adafruit_BNO055/BNO055.py", line 416, in set_mode
File "build/bdist.linux-armv7l/egg/Adafruit_BNO055/BNO055.py", line 302, in _write_byte
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 114, in write8
File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 236, in write_byte_data
IOError: [Errno 110] Connection timed out

Checks
debian@beaglebone:~/Adafruit_Python_BNO055/examples$ sudo python -c "import Adafruit_BBIO.GPIO as GPIO; print GPIO"
<module 'Adafruit_BBIO.GPIO' from '/root/.python-eggs/Adafruit_BBIO-1.0.3-py2.7-linux-armv7l.egg-tmp/Adafruit_BBIO/GPIO.so'>

Version
debian@beaglebone:~/Adafruit_Python_BNO055/examples$ cat /etc/debian_version
8.7
debian@beaglebone:~/Adafruit_Python_BNO055/examples$ uname -a
Linux beaglebone 4.4.54-ti-r93 #1 SMP Fri Mar 17 13:08:22 UTC 2017 armv7l GNU/Linux

Would you know the cause of the error

thanks
Jamie
Attachments
BNO055.txt
(5.91 KiB) Downloaded 70 times

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Sat Aug 26, 2017 11:41 am

Please attach a photo of the wiring and the simpletest.py file.

Also, it would be helpful to see the output of strace. Please run this:

sudo strace -f -o /tmp/strace-python-simpletest.txt python simpletest.py

and attach strace-python-simpletest.txt in your reply.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Sun Aug 27, 2017 2:51 am

Thank you for your prompt response
I have attached
simpletest.py file extension changed to .txt to allow attachment
Wireing.jpg I got a circuit board made to attach BNO055 to Beaglebone
strace-python-simpletest.txt this the file generated by strace -f -o /tmp/strace-python-simpletest.txt python simpletest.py

Thanks
Jamie
Attachments
strace-python-simpletest.txt
strace -f -o /tmp/strace-python-simpletest.txt python simpletest.py
(395.26 KiB) Downloaded 78 times
simpletest.txt
simpletest.py file extension changed to .txt to allow attachment
(4.05 KiB) Downloaded 66 times
Wireing.jpg
I got a circuit board made to attach BNO055 to Beaglebone
Wireing.jpg (985.2 KiB) Viewed 1159 times

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Sun Aug 27, 2017 11:23 pm

I can't quite tell from photo. Is P9_19 connected to SCL? Is P9_20 connected to SDA?

Please verify that these pins are configured for i2c with the config-pin command:
config-pin -q p9.19
config-pin -q p9.20


Then use the i2cdetect utility to see if the device appears on the i2c bus:
sudo i2cdetect -y -r 1

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Mon Aug 28, 2017 4:22 am

>> Is P9_19 connected to SCL? Is P9_20 connected to SDA?
Yes Sir

:/home/debian/Adafruit_Python_BNO055# config-pin -q p9.19
Pin is not modifyable: P9_19 i2c2_scl
:/home/debian/Adafruit_Python_BNO055# config-pin -q p9.20
Pin is not modifyable: P9_20 i2c2_sda


:/home/debian/Adafruit_Python_BNO055# sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I think is on 2
:/home/debian/Adafruit_Python_BNO055# sudo i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Because when I remove the board (Cape) address 28 disapears
:/home/debian/Adafruit_Python_BNO055# sudo i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

And when I plug back in the board (cape) address 28 reappears
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

When I dump the data for address 0x28
I get
/home/debian/Adafruit_Python_BNO055
root@beaglebone:/home/debian/Adafruit_Python_BNO055# i2cdump 2 0x28
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2, address 0x28, mode byte
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: a0 fb 32 0f 11 03 15 00 00 00 00 00 00 00 00 00 ??2????.........
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 0f 00 00 00 00 80 ff 10 00 00 ......?....?.?..
40: 00 24 00 00 40 00 00 00 00 00 00 00 40 00 00 00 .$..@.......@...
50: 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 ....@...........
60: 00 00 00 00 00 00 00 00 00 e0 01 00 00 00 00 00 .........??.....
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................

Thanks for taking the time to troubleshoot this

thanks
Jamie

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Mon Aug 28, 2017 4:58 am

OK, it does appear that the library is looking for address 0x28:
Adafruit_BNO055/BNO055.py Line 31

And it appears the i2c linux utilities can communicate with 0x28 based on your output.

From the strace log you posted from running Python:
14225 open("/dev/i2c-1", O_RDWR|O_LARGEFILE) = 3
14225 fstat64(3, {st_mode=S_IFCHR|0660, st_rdev=makedev(89, 1), ...}) = 0
14225 ioctl(3, 0x703, 0x28) = 0
14225 write(3, "\7\0", 2) = -1 ETIMEDOUT (Connection timed out)
14225 ioctl(3, 0x703, 0x28) = 0
14225 write(3, "=\0", 2) = -1 ETIMEDOUT (Connection timed out)


I'd like to check if this is the same device path that i2cdump is accessing.

Please run:
strace -f -o /tmp/strace-i2cdump.txt i2cdump 2 0x28

And attach the output file.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Tue Aug 29, 2017 3:10 am

Output from screen

strace -f -o /tmp/strace-i2cdump.txt i2cdump 2 0x28
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2, address 0x28, mode byte
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: a0 fb 32 0f 11 03 15 00 00 00 00 00 00 00 00 00 ??2????.........
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
30: 00 00 00 00 00 00 0f 00 00 00 00 80 ff 10 00 00 ......?....?.?..
40: 00 24 00 00 40 00 00 00 00 00 00 00 40 00 00 00 .$..@.......@...
50: 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 ....@...........
60: 00 00 00 00 00 00 00 00 00 e0 01 00 00 00 00 00 .........??.....
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................
f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................

File attached

thanks
Jamie
Attachments
strace-i2cdump.txt
(25.74 KiB) Downloaded 59 times

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Tue Aug 29, 2017 3:47 am

I see from the strace output of i2cdump that:
3344 open("/dev/i2c-2", O_RDWR) = 3
3344 ioctl(3, 0x705, 0xbebc80ac) = 0
3344 ioctl(3, 0x703, 0x28) = 0


I think the issue is that the library is opening the wrong i2c device path.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Wed Aug 30, 2017 2:54 am

Is there a way to specify the correct I2C buss
Looking at the BNO055.py I cannot see a variable specifying the I2C buss

# I2C addresses
BNO055_ADDRESS_A = 0x28
BNO055_ADDRESS_B = 0x29
BNO055_ID = 0xA0

Thanks for your continued support

thanks
Jamie

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Wed Aug 30, 2017 6:00 am

Looking further
they must be place it is specified

Code: Select all | TOGGLE FULL SIZE
else:
            # Use I2C if no serial port is provided.
            # Assume we're using platform's default I2C bus if none is specified.
            if i2c is None:
                import Adafruit_GPIO.I2C as I2C
                i2c = I2C
            # Save a reference to the I2C device instance for later communication.
            self._i2c_device = i2c.get_i2c_device(address, **kwargs)


Would you know where that would be

thanks
Jamie

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Wed Aug 30, 2017 12:04 pm

It looks like busnum could be passed:
Adafruit_Python_GPIO/Adafruit_GPIO/I2C.py
Code: Select all | TOGGLE FULL SIZE
def get_i2c_device(address, busnum=None, i2c_interface=None, **kwargs)


Another option would be to change
Adafruit_GPIO/I2C.py Line 39
Code: Select all | TOGGLE FULL SIZE
def get_default_bus():


I should be able to try that out tonight.

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Thu Aug 31, 2017 12:47 am

This seems to do the trick:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/Adafruit_Python_BNO055$ git diff
diff --git a/Adafruit_BNO055/BNO055.py b/Adafruit_BNO055/BNO055.py
index 2d1ac82..8215847 100644
--- a/Adafruit_BNO055/BNO055.py
+++ b/Adafruit_BNO055/BNO055.py
@@ -242,7 +242,7 @@ class BNO055(object):
                 import Adafruit_GPIO.I2C as I2C
                 i2c = I2C
             # Save a reference to the I2C device instance for later communication.
-            self._i2c_device = i2c.get_i2c_device(address, **kwargs)
+            self._i2c_device = i2c.get_i2c_device(address, busnum=2, **kwargs)
 
     def _serial_send(self, command, ack=True, max_attempts=5):
         # Send a serial command and automatically handle if it needs to be resent
diff --git a/examples/simpletest.py b/examples/simpletest.py
index 229267c..c17839d 100644
--- a/examples/simpletest.py
+++ b/examples/simpletest.py
@@ -31,10 +31,10 @@ from Adafruit_BNO055 import BNO055
 # Create and configure the BNO sensor connection.  Make sure only ONE of the
 # below 'bno = ...' lines is uncommented:
 # Raspberry Pi configuration with serial UART and RST connected to GPIO 18:
-bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
+#bno = BNO055.BNO055(serial_port='/dev/ttyAMA0', rst=18)
 # BeagleBone Black configuration with default I2C connection (SCL=P9_19, SDA=P9_20),
 # and RST connected to pin P9_12:
-#bno = BNO055.BNO055(rst='P9_12')
+bno = BNO055.BNO055(rst='P9_12')


Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/Adafruit_Python_BNO055$ sudo strace -f -e open python ./examples/simpletest.py 2>&1 |grep /dev/i2c
open("/dev/i2c-2", O_RDWR|O_LARGEFILE)  = 3

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Thu Aug 31, 2017 12:56 am

I've forked the repo and pushed the busnum=2 change if you'd like to try it:
https://github.com/pdp7/Adafruit_Python_BNO055

Code: Select all | TOGGLE FULL SIZE
commit 548077b9dc3d7d97f73ead2f582c14405bc451ff
Author: Drew Fustini <drew@pdp7.com>
Date:   Thu Aug 31 04:51:18 2017 +0000

    default to beaglebone instead of raspberry pi

 examples/simpletest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit 71e26fcb6412a9600761ee9df378a0ac8960d84a
Author: Drew Fustini <drew@pdp7.com>
Date:   Thu Aug 31 04:50:11 2017 +0000

    Use busnum=2 as BeagleBone is using /dev/i2c-2
   
    Refer to adafruit forum post:
    https://forums.adafruit.com/viewtopic.php?f=49&t=122596&p=613170#p613170

 Adafruit_BNO055/BNO055.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Re: Error when trying to run BNO055 simpletest.py

by jamiestewart on Thu Aug 31, 2017 8:32 am

Thank you very much
Working now

debian@beaglebone:~/Adafruit_Python_BNO055/examples$ sudo python simpletest.py
System status: 5
Self test result (0x0F is normal): 0x0F
Software version: 785
Bootloader version: 21
Accelerometer ID: 0xFB
Magnetometer ID: 0x32
Gyroscope ID: 0x0F

Reading BNO055 data, press Ctrl-C to quit...
Heading=0.00 Roll=0.00 Pitch=0.00 Sys_cal=0 Gyro_cal=0 Accel_cal=0 Mag_cal=0
Heading=359.94 Roll=-0.06 Pitch=5.06 Sys_cal=0 Gyro_cal=3 Accel_cal=0 Mag_cal=0
Heading=359.94 Roll=-0.06 Pitch=5.06 Sys_cal=0 Gyro_cal=3 Accel_cal=0 Mag_cal=0

thanks
Jamie

jamiestewart
 
Posts: 14
Joined: Tue Jan 24, 2017 4:16 am

Re: Error when trying to run BNO055 simpletest.py

by drewfustini on Thu Aug 31, 2017 3:06 pm

Great to hear!

drewfustini
 
Posts: 944
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.