ZeroBorg was not found - Found a device at 40, but it is not a ZeroBorg (ID 00 instead of 40) [solved]

Hi,

I have a little problem with my ZeroBorg. Running e.g the zbJoystick.py example script fails with "ZeroBorg was not found". In addition the exception says "Found a device at 40, but it is not a ZeroBorg (ID 00 instead of 40)":

pi@zeroborg:~/zeroborg $ sudo python zbJoystick.py
Loading ZeroBorg on bus 1, address 40
Found a device at 40, but it is not a ZeroBorg (ID 00 instead of 40)
ZeroBorg was not found
Trying bus 0 instead
Loading ZeroBorg on bus 0, address 40
Traceback (most recent call last):
  File "zbJoystick.py", line 17, in 
    ZB.Init()
  File "/home/pi/zeroborg/ZeroBorg.py", line 268, in Init
    self.Init(False)
  File "/home/pi/zeroborg/ZeroBorg.py", line 238, in Init
    self.bus = smbus.SMBus(self.busNumber)
IOError: [Errno 2] No such file or directory

This was tested on a Raspberry Pi Zero W and a Raspberry Pi 3, both with a fresh setup of Raspbian + update/upgrade + installation as described in "ZeroBorg - Getting started" - same exception on both Pis.

Also both Pis show that there is (only) one connected device on i2c 0x40 - and this is/should be the ZeroBorg. There is nothing physically connected - except the ZeroBorg (via the 6Pin-header).

pi@zeroborg:~/zeroborg $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Additional info: I bought the ZeroBorg basic (KS1) and the 5V DC/DC regulator and soldered the regulator onto the ZeroBorg. Seems to be not the problem - powering both Pis via Rechargeables via the ZeroBorg works perfectly.

So the final question is: What is the problem here? Is my ZeroBorg broken or is it my fault?

Thanks & greetings from Germany
Tom

piborg's picture

Not to worry, we have seen this problem as well and it seems to be just a software issue :)

From what I can tell it looks like recent versions of the Linux kernel for Raspbian (after 4.4.X) have some trouble with the I2C driver. This causes the commands which read data to receive 0s instead of the real values.

We found it could be fixed by setting the kernel to an older version, the most recent working one being 4.4.50. This can be done using rpi-update with the correct code for the 4.4.50 version:

sudo rpi-update 5224108

This issue affects most of our boards at the moment. Hopefully this will get sorted in the future and it will not be necessary to go back to an earlier kernel version.

Let us know if this fixes the problem for you as well.

Thanks a lot! Now everything runs perfectly.
The big red one has now a moving little brother ;)

By the way: Thanks for your great customerservice. A problem-solving-answer within 61 minutes on a public holiday - thats awesome!

thank you so much for the help!! i was so worried that my ZeroBorg board broken for some unknown reason. thankfully you guys have figured it out. i just did sudo apt-get update and sudo apt-get upgrade few hours ago then suddenly after rebooting the ZeroBorg was not found as in the aforementioned error.

i've also posted a query earlier before i saw this post on the same topic. straight away i deleted mine. thanks again piborg!

from Malaysia!

piborg's picture

It seems like this problem is due to a subtle change in behaviour with the I2C bus, rather than a bug. We have a fix which changes how our library talks to the ZeroBorg slightly, solving the issue where the ID is read as 00.

We have finished testing the new logic on the ZeroBorg library, it seems to work well on both the old and new versions of Raspbian ^_^

There are three ways you can go about updating the library on your Raspberry Pi:

1. Update ZeroBorg.py only

This will keep any changes you have made to other scripts intact :)

cd ~/zeroborg
mv ZeroBorg.py ZeroBorg.old
wget -O ZeroBorg.py https://www.piborg.org/downloads/zeroborg/ZeroBorg.txt

2. Re-install the examples

This will loose any changes you have made to scripts and any other scripts in the examples folder, but is much less typing.

cd ~
rm -r zeroborg
bash <(curl https://www.piborg.org/install-zeroborg.txt)

3. Copy / view the new code

This should work in all cases, but is much more manual.

You can view the new version of the library here: Improved ZeroBorg.py script. This should be used to replace any copies of ZeroBorg.py.

You can tell if the script is new or old by looking at the import section (starts around line 30).
Old script:

# Import the libraries we need
import smbus
import types
import time

New script:

# Import the libraries we need
import io
import fcntl
import types
import time

No other scripts need to be changed, all of the same functions are available and work in the same way ^_^

Subscribe to Comments for &quot;ZeroBorg was not found - Found a device at 40, but it is not a ZeroBorg (ID 00 instead of 40) [solved]&quot;