Jump to content

Pine64-LTS getting all serial ports to work.


Patrick Peters

Recommended Posts

I am currently using the Armbian 20.02 release and doing some tests with the serial ports of a

Pine64-LTS board. I noticed that i could not get all the serial ports to work. I needed to make a

couple of changes in order to get them all working. Maybe i did something wrong and my changes

were not needed, but i still would like to list them here in order to help other users who are

having problems with the serial ports.

 

When first starting up the armbian release i used the armbian-config tool to enable the uart 1,

uart 2, uart 3 and uart4. I rebooted but noticed not all ports where present. I noticed a message

in the dmesg log showing ttyS4 error -28. After some research (zcat /proc/config.gz) i noticed the

kernel was compiled with only max 4 serial ports -> CONFIG_SERIAL_8250_NR_UARTS=4 

Sadly this meant i had to recompile the kernel since this item can't be increased with a

kernel parameter setting.

 

After recompiling the kernel with CONFIG_SERIAL_8250_NR_UARTS=16 and

CONFIG_SERIAL_8250_RUNTIME_UARTS=5 i rebooted the system with the new kernel and

this time got the last uart 4 (addressed by 1c29000.serial) initialized (no more error -28).

I did noticed a new problem. The uart 1 (addressed by 1c28400.serial) was initialized by

the kernel as /dev/ttyS1 but after looking in the /dev directory there was no /dev/ttyS1

I did some more research and thought this was due to the bluetooh hci_uart or other

bluetooth items. So i blacklisted the modules by creating files in

/dev/modprobe.d/<module name>.conf containing the line 'blacklist <module name>'.

This stopped the bluetooth modules from loading but still the /dev/ttyS1 got lost.

I thought this was probably due to some issue in the dtb file so i converted the

/boot/dtb/allwinner/sun50i-a64-pine64-lts.dtb file to a dts file so i could read what was

going on (using the dtc command):

 

dtc -I dtb -O dts -o sun50i-a64-pine64-lts.dts sun50i-a64-pine64-lts.dtb

 

In the dts file i noticed the uart 1 (addressed by 1c28400.serial) also contained a bluetooth

part:

 

serial@1c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = < 0x1c28400 0x400 >;
                        interrupts = < 0x00 0x01 0x04 >;
                        reg-shift = < 0x02 >;
                        reg-io-width = < 0x04 >;
                        clocks = < 0x02 0x44 >;
                        resets = < 0x02 0x2f >;
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = < 0x32 0x33 >;
                        phandle = < 0x76 >;

                        bluetooth {
                                compatible = "realtek,rtl8723bs-bt";
                                reset-gpios = < 0x34 0x00 0x04 0x01 >;
                                device-wake-gpios = < 0x34 0x00 0x05 0x00 >;
                                host-wake-gpios = < 0x34 0x00 0x06 0x00 >;
                                firmware-postfix = "pine64";
                        };
                };

I removed the complete bluetooth part, so this part looked like:

serial@1c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = < 0x1c28400 0x400 >;
                        interrupts = < 0x00 0x01 0x04 >;
                        reg-shift = < 0x02 >;
                        reg-io-width = < 0x04 >;
                        clocks = < 0x02 0x44 >;
                        resets = < 0x02 0x2f >;
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = < 0x32 0x33 >;
                        phandle = < 0x76 >;
                };

 

I first made a backup of the original dtb file:

 

cp /boot/dtb/allwinner/sun50i-a64-pine64-lts.dtb /boot/dtb/allwinner/sun50i-a64-pine64-lts.dtb-orig

 

I then converted the altered dts file back into a dtb format with the help of the following command:

 

dtc -I dts -O dtb -o sun50i-a64-pine64-lts.dtb sun50i-a64-pine64-lts.dts

 

I rebooted the system and this time i did got all 5 serial ports working and also available via /dev/ttyS* device nodes.

 

dmesg log (serial lines)
[    2.877614] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 30, base_baud = 1500000) is a U6_16550A
[    2.929097] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 31, base_baud = 1500000) is a U6_16550A
[    2.952307] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 32, base_baud = 1500000) is a U6_16550A
[    2.975520] 1c28c00.serial: ttyS3 at MMIO 0x1c28c00 (irq = 33, base_baud = 1500000) is a U6_16550A
[    2.998728] 1c29000.serial: ttyS4 at MMIO 0x1c29000 (irq = 34, base_baud = 1500000) is a U6_16550A
ls -al /dev/ttyS*
crw-rw---- 1 root dialout 4, 64 Feb 25 12:54 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Feb 25 11:42 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 Feb 25 11:42 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 Feb 25 11:42 /dev/ttyS3
crw-rw---- 1 root dialout 4, 68 Feb 25 11:42 /dev/ttyS4

 

I do not know who is maintaining these parts of Armbian but would like to propose to remove the bluetooth item

from the default DTB file and create an overlay for enabling bluetooth. Possibly with the help of armbian-config

to enable and disable it. Also the kernel should have at least the amount of uarts enabled to make use of it

without recompiling it.

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines