View: 271|Reply: 9

Could not determine default I2C bus for platform

[Copy link]

1

Threads

1

Posts

17

Credits

Newbie

Rank: 1

Credits
17
Post time 2021-11-28 02:51:37 | Show all posts |Read mode
[size=true][size=1.125]I am trying to get up and running with the PiCar Pro Smart Robot 2 in 1 Car. I followed the instructions of the tutorial, but got stuck in section 2.2 Installing components and run web programs.


[size=true][size=1.125]When I try to start the webserver through the browser, I get the error that the site can't be reached. I also tried to run the webServer.py script and received the following error message:


[backcolor=rgba(0, 0, 0, 0.9)]Traceback (most recent call last):
[backcolor=rgba(0, 0, 0, 0.9)]  File "/home/pi/adeept_picarpro/server/webServer.py", line 14, in <module>
[backcolor=rgba(0, 0, 0, 0.9)]    import RPIservo
[backcolor=rgba(0, 0, 0, 0.9)]  File "/home/pi/adeept_picarpro/server/RPIservo.py", line 17, in <module>
[backcolor=rgba(0, 0, 0, 0.9)]    pwm = Adafruit_PCA9685.PCA9685()
[backcolor=rgba(0, 0, 0, 0.9)]  File "/usr/local/lib/python3.9/dist-packages/Adafruit_PCA9685/PCA9685.py", line 74, in __init__
[backcolor=rgba(0, 0, 0, 0.9)]    self._device = i2c.get_i2c_device(address, **kwargs)
[backcolor=rgba(0, 0, 0, 0.9)]  File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 63, in get_i2c_device
[backcolor=rgba(0, 0, 0, 0.9)]    busnum = get_default_bus()
[backcolor=rgba(0, 0, 0, 0.9)]  File "/usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/I2C.py", line 55, in get_default_bus
[backcolor=rgba(0, 0, 0, 0.9)]    raise RuntimeError('Could not determine default I2C bus for platform.')
[backcolor=rgba(0, 0, 0, 0.9)]RuntimeError: Could not determine default I2C bus for platform.



[size=true][size=1.125]How may I get past this issue?

Reply

Use magic Report

0

Threads

2

Posts

6

Credits

Newbie

Rank: 1

Credits
6
Post time 2021-11-28 06:13:05 | Show all posts
im having the exact same issue
Reply

Use magic Report

0

Threads

2

Posts

6

Credits

Newbie

Rank: 1

Credits
6
Post time 2021-11-28 06:14:45 | Show all posts
plz post if u figure it out. nothing on my robot works. not 1 movement feature ive tried them all
Reply

Use magic Report

1

Threads

9

Posts

84

Credits

Registered member

Rank: 2

Credits
84
Post time 2021-11-29 09:04:00 | Show all posts
Edited by 1635212142 at 2021-11-29 09:06 AM

can you do this command on the raspberry pi in your robot and post the results here?
sudo pip3 list
or
sudo pip3 list >> list.txt
the first dumps everything to the screen, the second creates a file "list.txt" with the list in it
Reply

Use magic Report

0

Threads

1

Posts

4

Credits

Newbie

Rank: 1

Credits
4
Post time 2021-11-30 23:59:58 | Show all posts
I have the same problem "Could not determine default I2C bus for platform."
hire is the result of sudo pip lits
pi@raspberrypi:~ $ sudo pip list
Package             Version
------------------- ---------
Adafruit-GPIO       1.0.3
Adafruit-PCA9685    1.0.1
Adafruit-PureIO     1.1.9
appdirs             1.4.4
arandr              0.1.10
astroid             2.5.1
asttokens           2.0.4
automationhat       0.2.0
backcall            0.2.0
beautifulsoup4      4.9.3
blinker             1.4
blinkt              0.1.2
buttonshim          0.0.2
Cap1xxx             0.1.3
cbor2               5.4.2
certifi             2020.6.20
chardet             4.0.0
click               7.1.2
colorama            0.4.4
colorzero           1.1
cryptography        3.3.2
cupshelpers         1.0
cycler              0.10.0
dbus-python         1.2.16
decorator           4.4.2
Deprecated          1.2.13
distro              1.5.0
docutils            0.16
drumhat             0.1.0
envirophat          1.0.0
ExplorerHAT         0.4.2
Flask               1.1.2
Flask-Cors          3.0.10
fourletterphat      0.1.0
gpiozero            1.6.2
guizero             1.1.1
gyp                 0.1
html5lib            1.1
idna                2.10
imutils             0.5.4
ipykernel           5.4.3
ipython             7.20.0
ipython_genutils    0.2.0
isort               5.6.4
itsdangerous        1.1.0
jedi                0.18.0
Jinja2              2.11.3
jupyter-client      6.1.11
jupyter-core        4.7.1
kiwisolver          1.3.1
lazy-object-proxy   0.0.0
logilab-common      1.8.1
luma.core           2.3.1
luma.oled           3.8.1
lxml                4.6.3
MarkupSafe          1.1.1
matplotlib          3.3.4
mccabe              0.6.1
microdotphat        0.2.1
mock                4.0.3
mote                0.0.4
motephat            0.0.3
mpu6050-raspberrypi 1.2
mypy                0.812
mypy-extensions     0.4.3
nudatus             0.0.5
numpy               1.19.5
oauthlib            3.1.0
olefile             0.46
pantilthat          0.0.7
parso               0.8.1
pbr                 5.5.0
pexpect             4.8.0
pgzero              1.2
phatbeat            0.1.1
pianohat            0.1.0
picamera            1.13
pickleshare         0.7.5
piglow              1.2.5
pigpio              1.78
Pillow              8.1.2
pip                 21.3.1
pocketsphinx        0.1.15
prompt-toolkit      3.0.14
psutil              5.8.0
PyAudio             0.2.11
pybase64            1.2.0
pycairo             1.16.2
pycodestyle         2.6.0
pycups              2.0.1
pyflakes            2.2.0
pyftdi              0.53.3
pygame              1.9.6
Pygments            2.7.1
PyGObject           3.38.0
pyinotify           0.9.6
PyJWT               1.7.1
pylint              2.7.2
pyOpenSSL           20.0.1
pyparsing           2.4.7
PyQt5               5.15.2
PyQt5-sip           12.8.1
pyserial            3.5b0
pysmbc              1.0.23
python-apt          2.2.1
python-dateutil     2.8.1
pyusb               1.2.1
pyzmq               20.0.0
QScintilla          2.11.6
qtconsole           5.0.2
QtPy                1.9.0
rainbowhat          0.1.0
reportlab           3.5.59
requests            2.25.1
requests-oauthlib   1.0.0
responses           0.12.1
roman               2.0.0
RPi.GPIO            0.7.0
rpi-ws281x          4.3.1
RTIMULib            7.2.1
scrollphat          0.0.7
scrollphathd        1.2.1
semver              2.10.2
Send2Trash          1.6.0b1
sense-emu           1.2
sense-hat           2.2.0
setuptools          52.0.0
simplejson          3.17.2
six                 1.16.0
skywriter           0.0.7
smbus2              0.4.1
sn3218              1.2.7
soupsieve           2.2.1
SpeechRecognition   3.8.1
spidev              3.5
ssh-import-id       5.10
thonny              3.3.14
toml                0.10.1
tornado             6.1
touchphat           0.0.1
traitlets           5.0.5
twython             3.8.2
typed-ast           1.4.2
typing-extensions   3.7.4.3
uflash              1.2.4
unicornhathd        0.0.4
urllib3             1.26.5
wcwidth             0.1.9
webencodings        0.5.1
websockets          10.1
Werkzeug            1.0.1
wheel               0.34.2
wrapt               1.12.1
Reply

Use magic Report

1

Threads

9

Posts

84

Credits

Registered member

Rank: 2

Credits
84
Post time 2021-12-2 05:51:46 | Show all posts
Thank you.

Finally, I was able to recreate the exact same problem on my machine here.
I did it by using the latest version of Pi Os and cloning their GitHub as per the recommended directions.
There is an error that occurs when you run the setup.py when it's installing OpenCV, and there seems to be some incompatibility with the Adafruit-PCA9685.
I haven't been able to get everything working on the newest Pi Os (lazy, no time, life, they all seem to get in the way)
The easiest fix (for me) was to download the PiCar-Pro Image (even though they do not recommend it).

This one comes with a small but easily fixable issue.
After you get the image installed on your SD card, and it's all setup and running on the Pi,
Remove the rpi-ws281x (for the rgb led).
sudo pip3 remove rpi-ws281x
After that, just reinstall it.
sudo pip3 rpi-ws281x install
(It complains about you using sudo to install, but ignore that.)
It should install 4.3.1?
Then restart the Pi and it should work.
Reply

Use magic Report

0

Threads

2

Posts

10

Credits

Newbie

Rank: 1

Credits
10
Post time 2021-12-9 00:59:45 | Show all posts
Hi, I got the same problem, with the newest Raspberry OS. I don't want to resort to the image file.
The problem seems to be in the Adafruit_GPIO library, which is deprecated but still used here. It resorts to Platform.py trying to find out the Raspberry version in use. That file unfortunately does not recognize the Raspberry PI 4, as it does not check for the BCM2711 chip.
I believe, the Adafruit_GPIO library should be replaced by the Adafruit_Blinka library. What all changes have to be done in the rest of the software I don't know, but that should be a task for adeept.
If anybody knows the steps to switch to Adafruit_Blinka - highly welcome!
Reply

Use magic Report

0

Threads

2

Posts

10

Credits

Newbie

Rank: 1

Credits
10
Post time 2021-12-10 01:55:18 | Show all posts
Edited by 1638982355 at 2021-12-10 01:58 AM

To get over this error I changed line 105 in file /usr/local/lib/python3.9/dist-packages/Adafruit_GPIO/Platform.py

Original:
    elif match.group(1) == 'BCM2835':

Changed:
    elif match.group(1) == 'BCM2711':

Ok, it won't recognize Raspberry 1 or old Raspberry Zero any more. I don't care.Now, with only the Raspberry and no additional hardware, I still get an error message when starting the webServer.pyOSError: [Errno 121] Remote I/O error

I assume the reason is that no board is connected to the I2C bus yet.
The above change in the source code of Platform.py will not be overriden by updates, because the module Adafruit_GPIO is no longer maintained.

Reply

Use magic Report

0

Threads

1

Posts

8

Credits

Newbie

Rank: 1

Credits
8
Post time 2022-1-5 21:41:36 | Show all posts
Hello!
If anyone solved this problem?

I bought RaspTank and started to assembly it this holiday. And I've got the ugly message about "Could not determine default I2C bus for platform."
I have tried to do all that found in Google search. But it was all in vain.
Reply

Use magic Report

0

Threads

1

Posts

4

Credits

Newbie

Rank: 1

Credits
4
Post time 7 day(s) ago | Show all posts
1638982355 replied at 2021-12-10 01:55 AM
To get over this error I changed line 105 in file /usr/local/lib/python3.9/dist-packages/Adafruit_GP ...

Thanks, I am running Bullseye on a pi 4. Based on your fix I modified the code to return 4 in the case of BCM2711.This fixed the "default I2C bus" error for me.

Reply

Use magic Report

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

Points Rules