View: 1896|Reply: 4

i2c error

[Copy link]

2

Threads

3

Posts

28

Credits

Newbie

Rank: 1

Credits
28
Post time 2022-1-28 19:47:08 | Show all posts |Read mode
  have the raspberry pi and I play around with the raspberrypi tank from adeept.
Here is the official github link
https://github.com/adeept/adeept_raspta ... ts-program

When I want to start the server with
sudo python3 adeept_rasptank/server/webServer.py

I get this error

File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 55, in get_default_bus
raise RuntimeError('Could not determine default I2C bus for platform.')
RuntimeError: Could not determine default I2C bus for platform.


I have enabled i2c interface

with i2cdetect -l i get this

pi@raspberrypi:~/adeept_rasptank/server $ i2cdetect -l
i2c-1 i2c bcm2835 (i2c@7e804000) I2C adapter
Reply

Use magic Report

0

Threads

51

Posts

189

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
189
Post time 2022-5-5 17:42:43 | Show all posts
It may be that the Raspberry Pi version compatibility problem causes the dependent library to fail to be installed successfully. Please download and install Raspberry Pi OS (Legacy).
Raspberry Pi OS (Legacy) download address: https://www.raspberrypi.com/software/operating-systems/
You need to find Raspberry Pi OS (Legacy) in the link and download the image file.
Raspberry Pi official description of the Raspberry Pi OS (Legacy):
https://www.raspberrypi.com/news ... berry-pi-os-legacy/
Reply

Use magic Report

0

Threads

2

Posts

6

Credits

Newbie

Rank: 1

Credits
6
Post time 2022-10-30 05:44:40 | Show all posts
Adeept_Devin replied at 2022-5-5 05:42 PM
It may be that the Raspberry Pi version compatibility problem causes the dependent library to fail t ...

I bought robot arm and had the same issue. Someone in the forum mentioned it is because Adafruit_PCA9685 doesn't support Raspberry pi 4 version. I think it is true  and it was developed in 2016. Please solve the issue for us. Thank you very much.
Reply

Use magic Report

0

Threads

51

Posts

189

Credits

Administrator

Rank: 9Rank: 9Rank: 9

Credits
189
Post time 2022-12-7 17:27:39 | Show all posts
If an error occurs: could not determine default i2c bus for platform
It may be caused by the incompatibility between the Raspberry Pi image file and some dependent libraries.
Please download and burn Raspberry Pi OS (Legacy) according to the content "Method one" in the link below, then configure SSH and WiFi, and run the setup.py program after downloading the product code.

Link: https://www.adeept.com/learn/tutorial-378.html
Reply

Use magic Report

0

Threads

1

Posts

6

Credits

Newbie

Rank: 1

Credits
6
Post time 2023-1-6 02:53:06 | Show all posts
Looked into the python code and found the issue in the Platform.py library file within the pi_version() routine (copied it here):

def pi_version():
    """Detect the version of the Raspberry Pi.  Returns either 1, 2 or
    None depending on if it's a Raspberry Pi 1 (model A, B, A+, B+),
    Raspberry Pi 2 (model B+), or not a Raspberry Pi.
    """
    # Check /proc/cpuinfo for the Hardware field value.
    # 2708 is pi 1
    # 2709 is pi 2
    # 2835 is pi 3 on 4.9.x kernel
    # Anything else is not a pi.
    with open('/proc/cpuinfo', 'r') as infile:
        cpuinfo = infile.read()
    # Match a line like 'Hardware   : BCM2709'
    match = re.search('^Hardware\s+:\s+(\w+)$', cpuinfo,
                      flags=re.MULTILINE | re.IGNORECASE)
    if not match:
        # Couldn't find the hardware, assume it isn't a pi.
        return None
    if match.group(1) == 'BCM2708':
        # Pi 1
        return 1
    elif match.group(1) == 'BCM2709':
        # Pi 2
        return 2
    elif match.group(1) == 'BCM2835':
        # Pi 3 / Pi on 4.9.x kernel
        return 3
    else:
        # Something else, not a pi.
        return None

Seems that if Pi 4 CPU version would be added here (in my case BCM2711) , the problem could be easily solved. Tried to change the code but got "permission denied" when trying to save.
Would really perfer to avoid a complete re-imaging as the rest (SSH, WIFI) works perfectly well and much more convinient with the latest image version provided on the Raspberry PI homepage.

Would it be possible for me to do these proposed changes somehow directly in this Platform.py file instead? Many thanks
Reply

Use magic Report

You have to log in before you can reply Login | Sign Up

Points Rules