adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
439 stars 327 forks source link

Please add support for the OrangePiCM4 #753

Open nerdathome opened 6 months ago

nerdathome commented 6 months ago

I have 2 versions of the OrangePi CM4 found here: http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-CM4-1.html running on their image of Debian. 1 has 2GB RAM w/ 32GB EMMC and the other has 8GB RAM w/ 64GB EMMC. The below is from the 8GB model:

Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM Model name: Cortex-A55 Model: 0 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): - Cluster(s): 1 Stepping: r2p0 CPU(s) scaling MHz: 23% CPU max MHz: 1800.0000 CPU min MHz: 408.0000 BogoMIPS: 48.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcp op asimddp Vulnerabilities:
Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Retbleed: Not affected Spec store bypass: Not affected Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Not affected Srbds: Not affected Tsx async abort: Not affected

$ cat /proc/device-tree/compatible rockchip,rk3566-orangepi-cm4rockchip,rk3566

$ cat /proc/device-tree/model Rockchip RK3566 Orange Pi CM4 Board

Carrier board is the 2.5" version of this from GeekWorm: https://geekworm.com/collections/nas-storage/products/naspi-cm4-m2.

nerdathome commented 6 months ago

$ python3 bin/detect.py Board Detection Test Check that the Chip and Board IDs match your board and that this it is correctly detecting whether or not it is a Linux board. Chip id: RK3566 Board id: None

nerdathome commented 6 months ago

I've followed https://learn.adafruit.com/adding-a-single-board-computer-to-platformdetect-for-blinka?view=all and now have detect.py working:

$ python3 ~/repos/Adafruit_Python_PlatformDetect/bin/detect.py Board Detection Test

Check that the Chip and Board IDs match your board and that this it is correctly detecting whether or not it is a Linux board.

Chip id: RK3566 Board id: ORANGE_PI_CM4

Linux Detection

Is this an embedded Linux system? True

Raspberry Pi Boards

Is this a Pi 3B+? False Is this a Pi 4B? False Is this a 40-pin Raspberry Pi? False Is this a Raspberry Pi Compute Module? False

Other Boards

Is this a Siemens Simatic IOT2000 Gateway? False Is this a 96boards board? False Is this a BeagleBone board? False Is this a Giant board? False Is this a Coral Dev board? False Is this a MaaXBoard? False Is this a SiFive board? False Is this a PYNQ board? False Is this a Rock Pi board? False Is this a NanoPi board? False Is this a Khadas VIM3 board? False Is this a Clockwork Pi board? False Is this a Seeed Board? False Is this a UDOO board? False Is this an ASUS Tinker board? False Is this an STM32MP1 board? False Is this a generic Linux PC? False Is this an OS environment variable special case? False Orange Pi detected.

nerdathome commented 6 months ago

I'm now getting this error:

Traceback (most recent call last): File "~/repos/geekworm/oled/monitor.py", line 4, in import digitalio

File "/usr/local/lib/python3.11/dist-packages/digitalio.py", line 97, in from adafruit_blinka.microcontroller.rockchip.rk3566.pin import Pin

File "/usr/local/lib/python3.11/dist-packages/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py", line 182, in if board in ("ODROID_M1S"): ^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'in ' requires string as left operand, not NoneType

Does this mean the scripts think the only board with an RK3566 is an ODROID_M1s? And since an Orange Pi CM4 has a different pin out the pin.py script fails? And if so, do I just need to add an "else if" exit for the OrangePi_CM4 & copy the RaspberryPi CM4 gpio pin out code block?