Jump to content

Recommended Posts

Posted

Dear community,

 

I am experimenting with MangoPi board, trying to communicate with the CC2530 Zigbee board . To do so, I need an available UART port, the UART0 (/dev/ttyS0, pins 8 and 10) seems to be occupied by the console, but there should be two other UARTs according to the schematic

 

Some info:

 

pi@nezha:~$ uname -a
Linux nezha 5.19.0-rc1-d1 #trunk Fri Jul 22 12:44:22 MSK 2022 riscv64 riscv64 riscv64 GNU/Linux
pi@nezha:~$ setserial -g /dev/ttyS*
/dev/ttyS0: Permission denied
/dev/ttyS2, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS3, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS4, UART: unknown, Port: 0x0000, IRQ: 0
/dev/ttyS5, UART: unknown, Port: 0x0000, IRQ: 0
pi@nezha:~$ dmesg|grep tty
[    0.000000] Kernel command line: root=UUID=09392a76-5b44-4ed0-b8c1-ea71be0c5a91 console=ttyS0,115200n8 cons                ole=tty0 earlycon=sbi cma=96M rootflags=data=writeback rw no_console_suspend consoleblank=0 fsck.fix=yes fsck.                repair=yes net.ifnames=0 bootsplash.bootfile=bootsplash.armbian
[    0.022550] printk: console [tty0] enabled
[    0.036087] printk: console [tty0] printing thread started
[    2.054357] printk: console [ttyS0] disabled
[    2.074657] 2500000.serial: ttyS0 at MMIO 0x2500000 (irq = 207, base_baud = 1500000) is a 16550A
[    2.074952] printk: console [ttyS0] enabled
[    2.097185] 2500400.serial: ttyS1 at MMIO 0x2500400 (irq = 208, base_baud = 1500000) is a 16550A
[    2.097219] printk: console [ttyS0] printing thread started
[    2.121099] serial serial0: tty port ttyS1 registered
[   12.144928] systemd[1]: Created slice Slice /system/serial-getty.
[   18.309394] systemd[1]: Found device /dev/ttyS0.
pi@nezha:~$ ls -l /boot
total 36312
-rwxr-xr-x 1 root root       64 Dec 23 21:18 armbianEnv.txt
-rwxr-xr-x 1 root root    38518 Jul 22 10:21 boot.bmp
-rwxr-xr-x 1 root root   173018 Jul 22 09:44 config-5.19.0-rc1-d1
drwxr-xr-x 3 root root     4096 Jul 22 10:20 dtb
drwxr-xr-x 2 root root     4096 Jul 22 10:19 extlinux
-rwxr-xr-x 1 root root  8399919 Jul 22 09:44 Image
-rwxr-xr-x 1 root root  5087353 Jul 22 09:44 System.map-5.19.0-rc1-d1
-rwxr-xr-x 1 root root 15056913 Jul 22 10:24 uInitrd
-rwxr-xr-x 1 root root  8399919 Jul 22 09:44 vmlinuz-5.19.0-rc1-d1

 

The usual approach seems to be using the armbian-config utlity, unfortunately, the utility does not allow configuring the hardware in the system branch.

 

Screenshot-2022-12-23-224609.png

 

How do I enable the UART1? I tried to create the /boot/armbianEnv.txt file as follows:

 

pi@nezha:~$ cat /boot/armbianEnv.txt
overlays=uart1

 

and the /dev/ttyS1 seems to be created (?) but nothing to be seen in /dev/ttyS*

 

pi@nezha:~$ dmesg|grep ttyS1
[    2.097185] 2500400.serial: ttyS1 at MMIO 0x2500400 (irq = 208, base_baud = 1500000) is a 16550A
[    2.121099] serial serial0: tty port ttyS1 registered

pi@nezha:~$ ls -l /dev/ttyS*
crw--w---- 1 root tty     4, 64 Dec 23 21:18 /dev/ttyS0
crw-rw---- 1 root dialout 4, 66 Dec 23 21:18 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Dec 23 21:18 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 Dec 23 21:18 /dev/ttyS4
crw-rw---- 1 root dialout 4, 69 Dec 23 21:18 /dev/ttyS5

 

Can somebody help please?

I understand the MangoPi is fairly exotic board, but it's lovely RISC5 and we live in times of silicon shortage, so... 

In ideal case, I'd like to swap UART0 and UART1 to get my RX/TX on pins 8 and 10, but enabling UART1 will make me happy as well :)

Apologies for the tag, the MangoPi does not seem to be very popular here, yet.

 

Thank you,  JP 

Posted (edited)

a little update - UART1 is connected to the Bluetooth chip, so it is already in use by the kernel's Bluetooth driver and cannot be used

 

I tried to use overlays to enable UART3, but got an error when using armbian-add-overlay command:
 

Overlays are not supported on D1 based boards.


So, the only option seems to be the armbian-config's System > View/Edit/Compile device tree WIP. This is a little difficult for me to use, I tried to enable the UART3 by changing the status from "disabled" to "okay" and adding pinctrl-0 and pinctrl-names as I found these in other serial definitions:
 

serial@2500c00 {
   compatible = "allwinner,sun20i-d1-uart\0snps,dw-apb-uart";
   reg = <0x2500c00 0x400>;
   reg-io-width = <0x04>;
   reg-shift = <0x02>;
   clocks = <0x02 0x41>;
   resets = <0x02 0x15>;
   dmas = <0x17 0x11 0x17 0x11>;
   dma-names = "rx\0tx";
   fifo-size = <0x100>;
   interrupts = <0x15 0x04>;
   status = "okay";
   pinctrl-0 = <0xff>;
   pinctrl-names = "default";
};


and added the uart3 definition in soc/pinctrl@2000000:
 

uart3-pb-pins {
   pins = "PB6\0PB7";
   function = "uart3";
   phandle = <0xff>;
};


It was applied successfully, but the /dev/ttyS3 was not enabled (as far as I can tell from dmesg):
 

pi@nezha:~$ dmesg | grep serial
[    0.801074] usbcore: registered new interface driver usbserial_generic
[    0.801136] usbserial: USB Serial support registered for generic
[    2.076660] 2500000.serial: ttyS0 at MMIO 0x2500000 (irq = 207, base_baud = 1500000) is a 16550A
[    2.099086] 2500400.serial: ttyS1 at MMIO 0x2500400 (irq = 208, base_baud = 1500000) is a 16550A
[    2.123030] serial serial0: tty port ttyS1 registered
[   12.240970] systemd[1]: Created slice Slice /system/serial-getty.


Maybe someone can point me to a good example of the dts file with UART2/3/4 enabled?

 

Thank you in advance,
JP 

 

 

Edited by jaroslav.psenicka

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines