garywang
(gary)
September 20, 2017, 12:54pm
14
Hi Frank
The uImage(with dtb) is in partition 1 and modules of kernel is in partition 2 of SD card, there is a script for you reference.
mount /dev/mmcblk0p1 /mnt/
cp SD/BPI-BOOT/bananapi/bpi-r2/linux/* /mnt/bananapi/bpi-r2/linux/
umount /mnt
mount /dev/mmcblk0p2 /mnt/
cp SD/BPI-ROOT/* /mnt/ -rf
umount /mnt
frank-w
(Frank W.)
September 20, 2017, 3:28pm
15
copied uimage to boot and modules to root-partition
seems not to work:
Filesystem: FAT16 "BPI-BOOT "
Boot from SD
reading bananapi/bpi-r2/linux/uEnv.txt
771 bytes read in 10 ms (75.2 KiB/s)
Loaded environment from uEnv.txt
Banana Pi bpi-r2 chip: mt7623n Service: linux
reading bananapi/bpi-r2/linux/uImage
8132578 bytes read in 1062 ms (7.3 MiB/s)
reading bananapi/berryboot.img
** Unable to read file bananapi/berryboot.img **
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
Image Name: Linux-4.4.70-BPI-R2-Kernel
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 8132514 Bytes = 7.8 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
Starting kernel ...
then it stops…no more messages
do i have to change uboot, too? had kernel 4.4.43 before (default for jessie-lite-image).
full log attached:
uart_kernel.log (18.0 KB)
garywang
(gary)
September 21, 2017, 11:06am
16
Did you change the code of BPI-R2-bsp, if yes, can you please share me the differences?
And I assume you’re using the latest code of BPI-R2-bsp from github.
frank-w
(Frank W.)
September 21, 2017, 11:07am
17
only added block for uart0/1 to dtsi and set them to “&uart2{status=“okay”;}” in bpi-r2.dts
have run “git pull” before build…maybe that’s enough
enabled_uart0 1.zip (14.7 KB)
garywang
(gary)
September 21, 2017, 12:18pm
18
Can you please try to change the order of uart controller in mt7623.dtsi:
uart2
uart0
uart1
uart3
frank-w
(Frank W.)
September 21, 2017, 1:10pm
19
seems that fixed that:
root@bpi-iot-ros-ai:~# uname -r
4.4.70-BPI-R2-Kernel
now i must enable uart0/1 in debian…currently i have no ttyAMAx
root@bpi-iot-ros-ai:~# find /sys/ -name 'serial*'
/sys/fs/cgroup/systemd/system.slice/system-serial\x2dgetty.slice/[email protected]
/sys/bus/pci/drivers/serial
/sys/bus/platform/devices/serial8250
/sys/bus/platform/drivers/serial8250
/sys/bus/platform/drivers/serial8250/serial8250
/sys/devices/platform/11230000.mmc/mmc_host/mmc1/mmc1:0001/serial
/sys/devices/platform/1a1c0000.usb/usb1/serial
/sys/devices/platform/1a1c0000.usb/usb2/serial
/sys/devices/platform/serial8250
/sys/devices/platform/1a240000.usb/usb3/serial
/sys/devices/platform/1a240000.usb/usb4/serial
/sys/devices/platform/11240000.mmc/mmc_host/mmc0/mmc0:0007/serial
/sys/firmware/devicetree/base/serial@11002000
/sys/firmware/devicetree/base/serial@11003000
/sys/firmware/devicetree/base/serial@11004000
i assume that the last 3 devices are my serial ports (remember such numbers from dtsi…)
uart0: serial@11002000 { };
uart1: serial@11003000 { };
From bootlog:
[ 4.737895] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 31, base_baud = 1625000) is a ST16650V2
[ 4.767828] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 32, base_baud = 1625000) is a ST16650V2
on that kernel net is not working right ;( interface exists, but no transmission possible (only own ip-stack),
=> found out that eth0 and eth1 are swapped with kernel-upgrade (eth0=lan-switch, eth1=wan-port)
also poweroff is not working
=> found nothing related in kernel-config
how can i set kernel-parameters (modules, build-in) like “make menuconfig” with the right config-file?
=> option 4 in build.sh, needs “libncurses-dev” to be installed
frank-w
(Frank W.)
September 27, 2017, 9:15am
20
connected an arduino (with levelshifter) to GPIO Pin 8/10 (should be uart0=11002000=ttyS1)
set speed via stty -F /dev/ttyS1 9600 raw
cat /dev/ttyS1
nothing happens
now using minicom (9600 8n1,flow:off) with ttys2 and i’ve got the input from arduino (keepalives every 60 seconds), why ttyS2??
seems that i have an error in my notes…looked in schematics again.
summary:
pin 8/10 = uart1 (tx/rx) = 11003000 = ttyS2
pin 11/13 = uart0 (tx/rx) = 11002000 = ttyS1
read works, but i can not send via minicom/bash
#!/bin/bash
DEV=/dev/ttyS2
while read line; do
echo "["$(date "+%Y-%m-%d %H:%M:%S")"] from Arduino: "$line
done < <(cat $DEV)
here i see my keepalives…if i try to send via
echo "AT" >/dev/ttyS2
i get no response (my arduino sends back “AT”-Strings)…arduino is connected also via usb to my workstation, if i send same string via ardiono-console, i see the response in the console and my script-output…so there is a problem with sending to the device (same construction works with raspi [script+send on another terminal via echo])
seems gpio (also uart) are not set to high-level…further debug here: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/issues/17
frank-w
(Frank W.)
October 18, 2017, 10:47am
21
got GPIO working, infos here
no idea currently about uart-tx, can anybody confirm, that is not working (maybe i doing something wrong)
frank-w
(Frank W.)
October 23, 2017, 2:55pm
22
is it enough to add the uart0/1 blocks to mt7623.dtsi and set the status to ok in bpi dts? anything needded for sending, because tx is not working?
frank-w
(Frank W.)
December 15, 2017, 4:00pm
23
tried this also with 4.14…also no TX (sending), and got uart1 not working (no device)
any idea?
Rene
(Rene Hegewald)
December 19, 2017, 7:47am
24
Hello Gary,
can you please talk to the Hardware Engineers, where the position is of TP47,48 on the Board :-).
Thanks a lot,
René
garywang
(gary)
December 19, 2017, 8:37am
25
Hi Rene
Above image shows the position of both TP48 and TP47
frank-w
(Frank W.)
December 20, 2017, 1:37pm
26
any idea about uart-tx? have the same problem in 4.14, too
linkerosa
(dorabmon)
December 21, 2017, 3:07am
27
what uart port does you use? i have tested uart0 and it works fine whose pinout from the 11,13 on the 40 pins out.
frank-w
(Frank W.)
December 21, 2017, 6:18am
28
Tried both (8/10,11/13)
both are enabled, but Uart1 not found in 4.14
pin 8/10 = uart1 (tx/rx) = 11003000 = ttyS2
pin 11/13 = uart0 (tx/rx) = 11002000 = ttyS1
How did you test it? I use an arduino nano with level-shifter which sends keepalives (which i receive) and sends back what it receive (got no resonse if i send)
linkerosa
(dorabmon)
December 21, 2017, 9:14am
29
uart0, uart1, uart2 all work in my setup with kernel 4.15 rc1. for uart3, i will test it . but it seems having not pin out for it on the board. the way i test is using loopback.
frank-w
(Frank W.)
December 21, 2017, 9:49am
30
loopback = wire rx to tx?
found out, that the problem seems to be the arduino…have my circuit placed on raspberry, where it works before…
if usb is connected to pc, serial is only receiving from it…if i power arduino via cellular-powersupply, it works with raspberry…
can you please look in my dts(i) why uart1 (11003000) not found in system? also tried to put uart2 in dts before others like i’ve done in dtsi, but without luck
Rene
(Rene Hegewald)
December 21, 2017, 1:39pm
31
@garywang …
can you please help with the following error messages:
[ 0.925251] mt6577-uart: probe of 11003000.serial failed with error -28
[ 9214.026213] mt6577-uart 11003000.serial: Unbalanced pm_runtime_enable!
[ 9214.026262] mt6577-uart: probe of 11003000.serial failed with error -28
[ 9497.466453] mt6577-uart 11003000.serial: Unbalanced pm_runtime_enable!
Thanks a lot,
René
frank-w
(Frank W.)
December 21, 2017, 1:48pm
32
seems that in kernel 4.14 the fallback-driver mt6577 is used, which can only control 2 uarts
if i disable uart0 then uart1 is found
[14:37] root@bpi-r2:~# dmesg | grep tty
[ 0.000000] Kernel command line: board=bpi-r2 console=earlyprintk fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait service0
[ 0.230738] console [ttyS0] disabled
[ 0.250928] 11004000.serial: ttyS0 at MMIO 0x11004000 (irq = 195, base_baud = 1625000) is a ST16650V2
[ 0.918903] console [ttyS0] enabled
[ 0.943324] 11003000.serial: ttyS1 at MMIO 0x11003000 (irq = 196, base_baud = 1625000) is a ST16650V2
nice now here is 11003000 aka uart1
here the /sys-tree if all uart are enabled in dts:
[14:30] root@bpi-r2:~# find /sys -name '*serial*'
/sys/devices/platform/11003000.serial
/sys/devices/platform/11230000.mmc/mmc_host/mmc1/mmc1:0001/serial
/sys/devices/platform/11240000.mmc/mmc_host/mmc0/mmc0:0007/serial
/sys/devices/platform/1a240000.usb/usb3/serial
/sys/devices/platform/1a240000.usb/usb4/serial
/sys/devices/platform/11004000.serial
/sys/devices/platform/1a1c0000.usb/usb1/serial
/sys/devices/platform/1a1c0000.usb/usb2/serial
/sys/devices/platform/11002000.serial
/sys/devices/platform/serial8250
/sys/devices/platform/11005000.serial
/sys/firmware/devicetree/base/serial@11004000
/sys/firmware/devicetree/base/aliases/serial2
/sys/firmware/devicetree/base/serial@11003000
/sys/firmware/devicetree/base/serial@11005000
/sys/firmware/devicetree/base/serial@11002000
/sys/fs/cgroup/systemd/system.slice/setserial.service
/sys/fs/cgroup/systemd/system.slice/system-serial\x2dgetty.slice
/sys/fs/cgroup/systemd/system.slice/system-serial\x2dgetty.slice/[email protected]
/sys/fs/cgroup/systemd/system.slice/etc-setserial.service
/sys/bus/platform/devices/11003000.serial
/sys/bus/platform/devices/11004000.serial
/sys/bus/platform/devices/11002000.serial
/sys/bus/platform/devices/serial8250
/sys/bus/platform/devices/11005000.serial
/sys/bus/platform/drivers/mt6577-uart/11004000.serial
/sys/bus/platform/drivers/mt6577-uart/11002000.serial
/sys/bus/platform/drivers/serial8250
/sys/bus/platform/drivers/serial8250/serial8250
/sys/bus/pci/drivers/exar_serial
/sys/bus/pci/drivers/serial
4.4.x seems to use mt2712
Linux bpi-r2 4.4.107-BPI-R2-Kernel #13 SMP Thu Dec 21 13:36:53 CET 2017 armv7l
[14:53] root@bpi-r2:~# find /sys -name '*serial*'
/sys/fs/cgroup/systemd/system.slice/etc-setserial.service
/sys/fs/cgroup/systemd/system.slice/setserial.service
/sys/fs/cgroup/systemd/system.slice/system-serial\x2dgetty.slice
/sys/fs/cgroup/systemd/system.slice/system-serial\x2dgetty.slice/[email protected]
/sys/bus/pci/drivers/serial
/sys/bus/platform/devices/11004000.serial
/sys/bus/platform/devices/11003000.serial
/sys/bus/platform/devices/serial8250
/sys/bus/platform/devices/11002000.serial
/sys/bus/platform/drivers/serial8250
/sys/bus/platform/drivers/serial8250/serial8250
/sys/bus/platform/drivers/mt2712-uart/11004000.serial
/sys/bus/platform/drivers/mt2712-uart/11003000.serial
/sys/bus/platform/drivers/mt2712-uart/11002000.serial
/sys/devices/platform/11230000.mmc/mmc_host/mmc1/mmc1:0001/serial
/sys/devices/platform/11004000.serial
/sys/devices/platform/11003000.serial
/sys/devices/platform/1a1c0000.usb/usb1/serial
/sys/devices/platform/1a1c0000.usb/usb2/serial
/sys/devices/platform/serial8250
/sys/devices/platform/1a240000.usb/usb3/serial
/sys/devices/platform/1a240000.usb/usb4/serial
/sys/devices/platform/11002000.serial
/sys/devices/platform/11240000.mmc/mmc_host/mmc0/mmc0:0007/serial
/sys/firmware/devicetree/base/serial@11002000
/sys/firmware/devicetree/base/serial@11003000
/sys/firmware/devicetree/base/serial@11004000
@garywang can you explain, where mt2712 is loaded for uart?
maybe here
../BPI-R2-4.4/linux-mt/drivers/tty/serial/8250/8250_mtk.c:796: { .compatible = "mediatek,mt2712-uart" },
../BPI-R2-4.4/linux-mt/drivers/tty/serial/8250/8250_mtk.c:804: .name = "mt2712-uart",
but i’ve not found 8250 in the related dts(i) for bpi-r2
linkerosa
(dorabmon)
December 21, 2017, 2:38pm
33
The cause for you guys only can let 2 uarts enabled is I guessed you only allow 2 ports for 8250 driver. You have to configure again with menuconfig.
1 Like