1640606722 Publish time 2022-1-28 19:47:08

i2c error

https://www.adeept.com/forum/static/image/common/arw_r.gifhave 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

Adeept_Devin Publish time 2022-5-5 17:42:43

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/new-old-functionality-with-raspberry-pi-os-legacy/

1667074577 Publish time 2022-10-30 05:44:40

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 trueand it was developed in 2016. Please solve the issue for us. Thank you very much.

Adeept_Devin Publish time 2022-12-7 17:27:39

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

1672944269 Publish time 2023-1-6 02:53:06

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
Pages: [1]
View full version: i2c error