Banana Pi BPI-R64 open source smart router with MTK MT7622 64 bit chip design

https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt#L292

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L427

it looks like you also enabled spi0 if you use the default dts, try to disable spi0 at

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L497

spi0 already occupy the same pin 65 you want to software program in shell

https://elixir.bootlin.com/linux/v5.0-rc5/source/drivers/soc/mediatek/mtk-scpsys.c#L248

try to change the line from

usleep_range(12000, 12100);

to

msleep(50);

that is just a experiment to test whether power domain is not ready when bluetooth wants to be active

if issue is still, you can try below several times to see if it is always issue or seldom issue.

hciconfig hci0 down
hciconfig hci0 up
hciconfig hci0 down
hciconfig hci0 up

1 Like

How do you get spi0-relationship?

I try gpio56=pin3 spi0 is pin 31,32,36 according to shematic (= gpios 82,64,65)

pin 56 might be occupied by i2c1 if you used the default dts from upstream

you should disable the node before you want to software program that pin

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L139

https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt#L224

1 Like

gpio-issue solved so far…gpio was blocked by activated i2c1…so if the special-function is enabled in dts, the direct gpio-access is blocked

[email protected]:~# GPIO_NO=$((409+56))                                             
[email protected]:~# echo $GPIO_NO                                                   
465                                                                             
[email protected]:~# echo $GPIO_NO > /sys/class/gpio/export                          
[email protected]:~# echo out > /sys/class/gpio/gpio${GPIO_NO}/direction             
[email protected]:~# echo 1 > /sys/class/gpio/gpio${GPIO_NO}/value                   
[email protected]:~# echo 0 > /sys/class/gpio/gpio${GPIO_NO}/value

my led goes on and off :slight_smile:

[email protected]:~# apt-get install bluez
...
[email protected]:~# uname -a                                                                                                                 
Linux bpi-r64 4.19.0-r64-main #70 SMP PREEMPT Sat Feb 9 09:53:04 CET 2019 aarch64 GNU/Linux                                              
[email protected]:~# dmesg | grep hci0                                                                                                        
[email protected]:~# 

[email protected]:~# bluetoothctl                                                                                                             
[NEW] Controller 00:00:46:76:22:01 bpi-r64 [default]                                                                                     
[bluetooth]# power on                                                                                                                    
Changing power on succeeded                                                                                                              
[bluetooth]# scan on                                                                                                                     
Discovery started                                                                                                                        
[CHG] Controller 00:00:46:76:22:01 Discovering: yes                                                                                      
[bluetooth]# [  134.372291] Bluetooth: hci0: last event is not cmd complete (0x0f)
...
[CHG] Device B4:9D:0B:5F:2A:B9 Name: Aquaris X5 Plus
...
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: yes                                                                                     
[CHG] Device B4:9D:0B:5F:2A:B9 Paired: yes                                                                                               
Pairing successful                                                                                                                       
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: no                                                                                      
[CHG] Device B4:9D:0B:5F:2A:B9 Connected: no                                                                                             
[bluetooth]# [  207.332516] Bluetooth: hci0: last event is not cmd complete (0x0f)                                                       
[bluetooth]# exit                                                                                                                        
[DEL] Controller 00:00:46:76:22:01 bpi-r64 [default]                                                                                     
[email protected]:~# 

except of the event-info/warning all is good now

Bluetooth: hci0: last event is not cmd complete (0x0f)

the change seems to create problems detecting mmc-rootfs

sometimes i get this message and boot-prcess hangs

Waiting for root device /dev/mmcblk0p2...

@linkerosa have you an idea regarding preloader and emmc?

Hello, I want to attach an SSD and need SATA 3 speed (ie. 6 Gbps). Which of the boards has all these features: Gigabit Ethernet, USB 3, SATA 3 ? Thx

Update: in the following thread someone wrote “The BPI-R2 has two SATA 3.0 Ports / 6 Gbps and not SATA II” ( SATA Performance + Max Disk Size ). But in many product descriptions only SATA 2 is mentioned, also in the Hardware spec wiki ( http://wiki.banana-pi.org/Banana_Pi_BPI-R2#Documents ) it says “Two SATA 2.0 Port”

What is correct?

Regardless if it is sata 3,you will not reach the speed of 6gbit/s. Why does it matter for you?

Btw. This thread is for r64

Hi, I’m just a newbie, don’t know yet the features of the different boards, I wongly assumed the R64 is the successor to R2; it seems it is rather the W2.

I just wanted evaluate the possibilities of building a backup-box to be used in LAN with multiple client-machines to backup, so the LAN and the storing to the SSD should be as fast as possible as this shall be a “realtime” backup solution, ie. always on, though incremental, and it should serve as many clients as possible. So I assumed getting full SATA III speed, but later learned that it’s not a full SATA III like you remarked too. I need to find a cheap HW for this project. Today I found another one (Rock Pi 4 for $39), it looks promising, but it lacks SATA; has only USB3, and not clear yet if one can use Debian on it. It’s not easy to find the right HW for the project as I’m more a SW guy…

imho most SOCs don’t have native SATA-support…i don’t know how it realized on R2/R64, imho as pcie-sata-bridge, where mini-pcie has limitation to 500Mbit/s, so it is not possible to reach sata2/3-throughput…but please make a new thread if needed

for GPIO, how to disable pwm-mapping?

i get this error for pin7 (gpio101):

[email protected]:~# GPIO_NO=$((409+101)) 
[email protected]:~# echo $GPIO_NO > /sys/class/gpio/export
[  365.604377] mtk-pinctrl 10211000.pinctrl: pin PWM7 already requested by 11006000.pwm; cannot claim for pinctrl_mt7622:510
[  365.615703] mtk-pinctrl 10211000.pinctrl: pin-101 (pinctrl_mt7622:510) status -22
-bash: echo: write error: Invalid argument

but nice that here is a message for blocked access

can i disable it from userspace or only in dts?

it seems it is this section in dts:

only pwm7 seems to be defined, why not the others? maybe we can define pwm1-7 (except 3, i’ve did not found on header)

can i use generic pwm-node and define subnodes for pwm1-7?

something like this (of course i have to define the pwmx_pins):

&pwm {
	pinctrl-names = "default";
	status = "okay";
	pwm1{
		pinctrl-0 = <&pwm1_pins>;
	}
	pwm2{
		pinctrl-0 = <&pwm2_pins>;
	}
	pwm4{
		pinctrl-0 = <&pwm4_pins>;
	}
	...
}

maybe we can define pwm1-7 (except 3, i’ve did not found on header)

Sure! you could add it if you want to do that.

can i use generic pwm-node and define subnodes for pwm1-7? something like this (of course i have to define the pwmx_pins):

You can take a look at i2c/spi nodes to understand how to add “generic pin configuration” (via function/group) in dts

how can i use emmc? it seems the sd-card-preloader does not work for emmc, atf should be loaded after uboot, but i don’t get into uboot

btw. have not get pwm working yet…also no answer from sean

BPI-R64 MT7622 schematic diagram public

1 Like

3D printed case for Banana PI R-64. Link https://www.thingiverse.com/thing:4261948

1 Like
1 Like

gpio-issue solved so far…gpio was blocked by activated i2c1…so if the special-function is enabled in dts, the direct gpio-access is blocked

How did you deactivate i2c?

As pointed by @linkerosa it’s defined in dts

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L139

Here status needs to be set to disabled

But that doesn’t work for PWM. Changing the status to disable I have all the same error

[ 56.553047] mt7622-pinctrl 10211000.pinctrl: pin PWM7 already requested by 11006000.pwm; cannot claim for pinctrl_moore:510 [ 56.564211] mt7622-pinctrl 10211000.pinctrl: pin-101 (pinctrl_moore:510) status -22

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L476

maybe you need this: