Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for orangepi 3b #894

Merged
merged 10 commits into from
Oct 24, 2024
Merged

add support for orangepi 3b #894

merged 10 commits into from
Oct 24, 2024

Conversation

landall
Copy link
Contributor

@landall landall commented Sep 17, 2024

No description provided.

@landall
Copy link
Contributor Author

landall commented Sep 17, 2024

can anyone tell me why the test is not passed?
I do not understand the error message.

@tannewt
Copy link
Member

tannewt commented Sep 18, 2024

The easiest thing to do is run pre-commit locally. It'll automatically fix the formatting. Instructions are here: https://learn.adafruit.com/improve-your-code-with-pylint/check-your-code-with-pre-commit

modify i2c2_m0 to i2c2_m1
add some definition for i2c
@landall
Copy link
Contributor Author

landall commented Sep 23, 2024

The easiest thing to do is run pre-commit locally. It'll automatically fix the formatting. Instructions are here: https://learn.adafruit.com/improve-your-code-with-pylint/check-your-code-with-pre-commit

Fail to install pre-commit in my Win10.

pre-commit run --all-files
[INFO] Installing environment for https://github.com/fsfe/reuse-tool.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\Users\CST\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe', '-mvirtualenv', 'C:\Users\CST\.cache\pre-commit\repo5_yrkgf1\py_env-python3')
return code: 1
stdout:
RuntimeError: failed to build image setuptools because:
Traceback (most recent call last):
File "C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 57, in _install
installer.install(creator.interpreter.version_info)
File "C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\virtualenv\seed\embed\via_app_data\pip_install\base.py", line 37, in install
self._sync(filename, into)
File "C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\virtualenv\seed\embed\via_app_data\pip_install\copy.py", line 13, in _sync
copy(src, dst)
File "C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\virtualenv\util\path_sync.py", line 41, in copy
method(str(src), str(dest))
File "C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\virtualenv\util\path_sync.py", line 52, in copytree
shutil.copy(src_f, dest_f)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 417, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 254, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\CST\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\Local\pypa\virtualenv\wheel\3.10\image\1\CopyPipInstall\setuptools-75.1.0-py3-none-any\pkg_resources\tests\data\my-test-package_zipped-egg\my_test_package-1.0-py3.7.egg'
stderr: (none)

@landall
Copy link
Contributor Author

landall commented Sep 23, 2024

Can anyone replace me to commit this code?
I really cannot handle this checks without any useful information.

@FoamyGuy
Copy link
Contributor

I ran pre-commit and committed the resulting changes.

I'm not sure what the root cause of the error you posted is. If you have the option, and you still want to get it working locally it may be worth trying a newer python version like 3.11 or 3.12.

@landall
Copy link
Contributor Author

landall commented Sep 24, 2024

I ran pre-commit and committed the resulting changes.

I'm not sure what the root cause of the error you posted is. If you have the option, and you still want to get it working locally it may be worth trying a newer python version like 3.11 or 3.12.

thanks very much.
I will try to build a working envirnment later in a clean machine.
Is there any way to print out the wrong lines in github checks page? I can see the hints directly when i commit to some other projects.

@landall
Copy link
Contributor Author

landall commented Sep 24, 2024

The second question: is there any guide when I commit to board / microcontroller definition?
I find the defined vars is different among these files.
I do not know which should be defined in a board/microcontroller files of adafruit_blinka.

@landall
Copy link
Contributor Author

landall commented Sep 25, 2024

Remark:
need reviewing the modification of i2cPorts in rk3566.py.
/board/radxa/radxacm3.py seems to use I2C2_M0 but /board/orangepi/orangepi3b use I2C2_M1.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would want to find a way to make the changes to the rk3566/pin.py file compatible with all devices instead of commenting out the old one for the new one.

@landall
Copy link
Contributor Author

landall commented Oct 9, 2024

I think we would want to find a way to make the changes to the rk3566/pin.py file compatible with all devices instead of commenting out the old one for the new one.

this is a common thing for all rockchip microcontrollers.

‘’‘
i2cPorts = [
(1, I2C1_SCL, I2C1_SDA),
(2, I2C2_SCL_M0, I2C2_SDA_M0),
(3, I2C3_SCL_M0, I2C3_SDA_M0),
]
‘’’

the boards use the same controller do not have the same i2cPorts definition.
each board can select a different I2C2_SCL_M* as their I2C2 Port.

This problem does not only affact OrangePi3B, radxacm3 and RK3566.
It affects almost every boards using a rockchip microcontroller.

Maybe some way to override i2cPorts in board definition files can solve this problem.
for example, add a procedure in microcontroller's pin.py to perform the overriding.

@FoamyGuy
Copy link
Contributor

I noticed in the pins file for the rk3588 that there are sometimes multiple ports listed under the same numbers:

(1, I2C1_SCL_M0, I2C1_SDA_M0),
(1, I2C1_SCL_M4, I2C1_SDA_M4),
(3, I2C3_SCL_M0, I2C3_SDA_M0),
(3, I2C3_SCL_M1, I2C3_SDA_M1),
Maybe the rest of the code already handles this situation without the need for a special case.

@landall can you try just including the new port along with the existing ones without commenting anything out like this:

    (1, I2C1_SCL, I2C1_SDA),
    (2, I2C2_SCL_M0, I2C2_SDA_M0),
    (2, I2C2_SCL_M1, I2C2_SDA_M1),

See if that works on your orangepi 3b device and if so add a commit to uncomment the existing definition and add the new one without removing anything.

stored the wrongly commented lines to define 2 I2C port with the same channel id.
@landall
Copy link
Contributor Author

landall commented Oct 22, 2024

I noticed in the pins file for the rk3588 that there are sometimes multiple ports listed under the same numbers:

(1, I2C1_SCL_M0, I2C1_SDA_M0),
(1, I2C1_SCL_M4, I2C1_SDA_M4),
(3, I2C3_SCL_M0, I2C3_SDA_M0),
(3, I2C3_SCL_M1, I2C3_SDA_M1),

Maybe the rest of the code already handles this situation without the need for a special case.
@landall can you try just including the new port along with the existing ones without commenting anything out like this:

    (1, I2C1_SCL, I2C1_SDA),
    (2, I2C2_SCL_M0, I2C2_SDA_M0),
    (2, I2C2_SCL_M1, I2C2_SDA_M1),

See if that works on your orangepi 3b device and if so add a commit to uncomment the existing definition and add the new one without removing anything.

It works!
I commit it to this pull request now.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@FoamyGuy FoamyGuy merged commit b91d3fc into adafruit:main Oct 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants