From 9c657918b037f7a8803dbb2596f96d8c3b2026c3 Mon Sep 17 00:00:00 2001 From: landall Date: Wed, 18 Sep 2024 03:57:11 +0800 Subject: [PATCH 1/6] add support for orangepi 3b --- .../board/orangepi/orangepi3b.py | 66 +++++++++++++++++++ .../microcontroller/rockchip/rk3566/pin.py | 9 +++ src/board.py | 3 + 3 files changed, 78 insertions(+) create mode 100644 src/adafruit_blinka/board/orangepi/orangepi3b.py diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py new file mode 100644 index 00000000..2ea83212 --- /dev/null +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -0,0 +1,66 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Orangepi 3B.""" + +from adafruit_blinka.microcontroller.rockchip.rk3566 import pin + +# D pin number is ordered by physical pin sequence +# Reference: https://service.robots.org.nz/wiki/Wiki.jsp?page=OrangePi + +# D2 = VCC5V0_SYS +D3 = pin.I2C2_SDA_M1 +# D4 = VCC5V0_SYS +D5 = pin.I2C2_SCL_M1 +# D6 = GND +D7 = pin.GPIO4_C3 # GPIO4_C3/PWM15 +D8 = pin.GPIO0_D1 +# D9 = GND +D10 = pin.GPIO0_D0 +D11 = pin.GPIO3_C6 +D12 = pin.GPIO3_C7 +D13 = pin.GPIO4_A0 +# D14 = GND +D15 = pin.GPIO4_A2 +D16 = pin.GPIO4_A3 +# D17 = Vcc3V3_SYS +D18 = pin.GPIO4_A1 +D19 = pin.SPI3_MOSI_M0 +# D20 = GND +D21 = pin.SPI3_MISO_M0 +D22 = pin.GPIO4_A4 +D23 = pin.SPI3_CLK_M0 +D24 = pin.SPI3_CS0_M0 +# D25 = GND +D26 = pin.GPIO4_A7 +D27 = pin.I2C3_SDA_M0 +D28 = pin.I2C3_SCL_M0 +D29 = pin.GPIO4_A5 +#D30 = GND +D31 = pin.GPIO3_D4 +D32 = pin.GPIO4_C0 +D33 = pin.GPIO3_D7 +# D34 = GND +D35 = pin.GPIO3_D0 +D36 = pin.GPIO3_D5 +D37 = pin.GPIO3_D3 +D38 = pin.GPIO3_D2 +# D39 = GND +D40 = pin.GPIO3_D1 + +# UART +#UART4_TX = pin.GPIO1_B0 +#UART4_RX = pin.GPIO1_A7 + +# SPI +SPI3_MISO = pin.SPI3_MISO_M0 +SPI3_MOSI = pin.SPI3_MOSI_M0 +SPI3_CLK = pin.SPI3_CLK_M0 +SPI3_CS0 = pin.SPI3_CS0_M0 + +# Default SPI +MOSI = SPI3_MOSI +MISO = SPI3_MISO +SCLK = SPI3_CLK +CS = SPI3_CS0 + diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py index 1a8952b8..5b51baf6 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py @@ -93,6 +93,15 @@ GPIO3_D3 = Pin((3, 27)) GPIO3_D4 = Pin((3, 28)) GPIO3_D5 = Pin((3, 29)) +GPIO3_D6 = Pin((3, 30)) +GPIO3_D7 = Pin((3, 31)) + +# GPIO4 +GPIO4_A0 = Pin((4, 0)) +GPIO4_A1 = Pin((4, 1)) +GPIO4_A2 = Pin((4, 2)) +GPIO4_A3 = Pin((4, 3)) + GPIO4_A4 = Pin((4, 4)) GPIO4_A5 = Pin((4, 5)) GPIO4_A6 = Pin((4, 6)) diff --git a/src/board.py b/src/board.py index 88ae1da9..d1a8be5b 100644 --- a/src/board.py +++ b/src/board.py @@ -134,6 +134,9 @@ elif board_id == ap_board.ORANGE_PI_3: from adafruit_blinka.board.orangepi.orangepi3 import * +elif board_id == ap_board.ORANGE_PI_3B: + from adafruit_blinka.board.orangepi.orangepi3b import * + elif board_id == ap_board.ORANGE_PI_4: from adafruit_blinka.board.orangepi.orangepi4 import * From 0539b27e2a2b84a101d61fd8ee8bde462747af4b Mon Sep 17 00:00:00 2001 From: landall Date: Tue, 24 Sep 2024 03:47:23 +0800 Subject: [PATCH 2/6] i2c support modify i2c2_m0 to i2c2_m1 add some definition for i2c --- .../board/orangepi/orangepi3b.py | 23 +++++++++++++++++-- .../microcontroller/rockchip/rk3566/pin.py | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py index 2ea83212..a8e1109b 100644 --- a/src/adafruit_blinka/board/orangepi/orangepi3b.py +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -49,8 +49,27 @@ D40 = pin.GPIO3_D1 # UART -#UART4_TX = pin.GPIO1_B0 -#UART4_RX = pin.GPIO1_A7 +UART2_TX_M0 = pin.GPIO0_D1 +UART2_RX_M0 = pin.GPIO0_D0 + +UART7_TX_M2 = pin.GPIO4_A2 +UART7_RX_M2 = pin.GPIO4_A3 + +UART3_TX_M0 = pin.GPIO1_A1 +UART3_RX_M0 = pin.GPIO1_A0 + +UART9_TX_M2 = pin.GPIO4_A4 +UART9_RX_M2 = pin.GPIO4_A5 + +# I2C +I2C2_SCL_M1 = pin.I2C2_SCL_M1 +I2C2_SDA_M1 = pin.I2C2_SDA_M1 +I2C3_SCL_M0 = pin.I2C3_SCL_M0 +I2C3_SDA_M0 = pin.I2C3_SDA_M0 + +# Default I2C +SCL = I2C2_SCL_M1 +SDA = I2C2_SDA_M1 # SPI SPI3_MISO = pin.SPI3_MISO_M0 diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py index 5b51baf6..5554d5eb 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py @@ -178,7 +178,8 @@ # ordered as i2cId, SCL, SDA i2cPorts = [ (1, I2C1_SCL, I2C1_SDA), - (2, I2C2_SCL_M0, I2C2_SDA_M0), + #(2, I2C2_SCL_M0, I2C2_SDA_M0), + (2, I2C2_SCL_M1, I2C2_SDA_M1), (3, I2C3_SCL_M0, I2C3_SDA_M0), (4, I2C4_SCL_M0, I2C4_SDA_M0), (5, I2C5_SCL_M0, I2C5_SDA_M0), From 9d833e0a0403dc60e16f3f3b75259a73c80de4f4 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 23 Sep 2024 18:32:04 -0500 Subject: [PATCH 3/6] code format --- src/adafruit_blinka/board/orangepi/orangepi3b.py | 3 +-- src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py index a8e1109b..7ec49ade 100644 --- a/src/adafruit_blinka/board/orangepi/orangepi3b.py +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -36,7 +36,7 @@ D27 = pin.I2C3_SDA_M0 D28 = pin.I2C3_SCL_M0 D29 = pin.GPIO4_A5 -#D30 = GND +# D30 = GND D31 = pin.GPIO3_D4 D32 = pin.GPIO4_C0 D33 = pin.GPIO3_D7 @@ -82,4 +82,3 @@ MISO = SPI3_MISO SCLK = SPI3_CLK CS = SPI3_CS0 - diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py index 5554d5eb..e95f390e 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py @@ -178,7 +178,7 @@ # ordered as i2cId, SCL, SDA i2cPorts = [ (1, I2C1_SCL, I2C1_SDA), - #(2, I2C2_SCL_M0, I2C2_SDA_M0), + # (2, I2C2_SCL_M0, I2C2_SDA_M0), (2, I2C2_SCL_M1, I2C2_SDA_M1), (3, I2C3_SCL_M0, I2C3_SDA_M0), (4, I2C4_SCL_M0, I2C4_SDA_M0), From 380b4e9c3d12554b2915a813de1942ec0519dd56 Mon Sep 17 00:00:00 2001 From: landall Date: Tue, 22 Oct 2024 15:21:10 +0800 Subject: [PATCH 4/6] Update pin.py stored the wrongly commented lines to define 2 I2C port with the same channel id. --- src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py index e95f390e..bfb30138 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py @@ -178,7 +178,7 @@ # ordered as i2cId, SCL, SDA i2cPorts = [ (1, I2C1_SCL, I2C1_SDA), - # (2, I2C2_SCL_M0, I2C2_SDA_M0), + (2, I2C2_SCL_M0, I2C2_SDA_M0), (2, I2C2_SCL_M1, I2C2_SDA_M1), (3, I2C3_SCL_M0, I2C3_SDA_M0), (4, I2C4_SCL_M0, I2C4_SDA_M0), From e61bb98155e8c77c201573bbe347a259b3d2474f Mon Sep 17 00:00:00 2001 From: landall Date: Thu, 24 Oct 2024 05:32:16 +0800 Subject: [PATCH 5/6] Update Copyright for orangepi3b.py --- src/adafruit_blinka/board/orangepi/orangepi3b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py index 7ec49ade..2c2e379e 100644 --- a/src/adafruit_blinka/board/orangepi/orangepi3b.py +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# SPDX-FileCopyrightText: 2024 cst_zf for Adafruit Industries # # SPDX-License-Identifier: MIT """Pin definitions for the Orangepi 3B.""" From 38fa646294a9e8c628b12a8f6f3d803d31992f98 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Thu, 24 Oct 2024 15:09:40 -0500 Subject: [PATCH 6/6] update copyright --- src/adafruit_blinka/board/orangepi/orangepi3b.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py index 2c2e379e..ff4eee04 100644 --- a/src/adafruit_blinka/board/orangepi/orangepi3b.py +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 cst_zf for Adafruit Industries +# SPDX-FileCopyrightText: 2024 cst_zf # # SPDX-License-Identifier: MIT """Pin definitions for the Orangepi 3B."""