Bug 239390 - Cannot enable UART ports on Pine64-LTS platform
Summary: Cannot enable UART ports on Pine64-LTS platform
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 12.0-RELEASE
Hardware: arm64 Any
: --- Affects Only Me
Assignee: freebsd-arm mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-22 23:38 UTC by Kaya Saman
Modified: 2019-07-30 23:41 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kaya Saman 2019-07-22 23:38:16 UTC
Hi, I am trying to enable the UART ports on my Pine64-LTS board however, after trying all the suggestions that people gave in the Arm mailing list nothing had any effect.

The suggestions given to me were to use overlays. I attempted this but get error messages:

failed to apply overlay: FDT_ERR_NOTFOUND

The files do exist:

ls /boot/msdos/dtb/overlays
sun50i-a64-sid.dtbo	sun50i-a64-timer.dtbo	sun50i-a64-uart4.dtbo
sun50i-a64-ths.dtbo	sun50i-a64-uart2.dtbo


ls /boot/dtb/overlays
sun50i-a64-sid.dtbo	sun50i-a64-timer.dtbo	sun50i-a64-uart4.dtbo
sun50i-a64-ths.dtbo	sun50i-a64-uart2.dtbo


Additionally I have tried to add the following directly to the .dts files:

/* On Pi-2 connector */
&uart2 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart2_pins>;
        status = "okay";
};


The files I have tried to enable the UART ports in are these:

/usr/src/sys/gnu/dts/arm64/allwinner -

sun50i-a64-pine64.dts
sun50i-a64-sopine-baseboard.dts

Unfortunately nothing is working and there isn't a direct pin64-lts.dts file either.


What more information could I provide here in order to get the UART's to function?
Comment 1 Kaya Saman 2019-07-29 13:23:54 UTC
I can confirm that Overlays work fine in 13.0-CURRENT and that the uart ports are functioning. It seems that this issue only affects 12.0-RELEASE.
Comment 2 Kaya Saman 2019-07-30 10:06:35 UTC
I've done some more testing on the uart ports. It seems I jumped the gun earlier by saying that they function. Maybe I should re-iterate that statement to that they do function but not properly.

The devices with .init and .lock files get created in /dev on 13-CURRENT but it seems that there is no communication between the OS and the attached devices.

I am using an RS232 level shifter between the 3V TTL signal of the uart ports and the 'full swing' serial devices connected. There are signals being received as I have verified this with an LED on the TTL side.

One example is my Garmin 18x GPS receiver which I had functioning fine using a USB to Serial adapter. I was able to get both PPS and NMEA sentences working in both GPSD and NTP.

Using the uart port however, in this case UART4:

ls /dev |grep cuau4
cuau4
cuau4.init
cuau4.lock

ls /dev | grep ttyu4
ttyu4
ttyu4.init
ttyu4.lock

nothing is seen at all.

Even using applications like cu, tip, Minicom with the correct port set and baud rate etc.. there is still nothing displayed.

sysctl -a |grep uart4
hw.clock.bus-uart4.enable_cnt: 2
hw.clock.bus-uart4.childrens: 
hw.clock.bus-uart4.parents: apb2 
hw.clock.bus-uart4.parent: apb2
hw.clock.bus-uart4.frequency: 24000000
hw.clock.apb2.childrens: bus-i2c0 bus-i2c1 bus-i2c2 bus-src bus-uart0 bus-uart1 bus-uart2 bus-uart3 bus-uart4 
dev.ccu_a64ng.0.clocks: pll_cpux pll_audio pll_video0 pll_ve pll_ddr0 pll_periph0_2x pll_periph1_2x pll_video1 pll_gpu pll_hsic pll_de pll_ddr1 apb2 nand mmc0 mmc1 mmc2 ts ce spi0 spi1 spdif dram de tcon1 deinterlace csi-sclk csi-mclk ve hdmi mbus gpu ahb1 ahb2 cpux i2s0mux i2s1mux i2s2mux axi apb1 apb thsdiv osc12M pll_periph0 pll_periph1 pll_audio-2x pll_audio-4x pll_audio-8x pll_video0-2x bus-mipi-dsi bus-ce bus-dma bus-mmc0 bus-mmc1 bus-mmc2 bus-nand bus-dram bus-emac bus-ts bus-hstimer bus-spi0 bus-spi1 bus-otg bus-ehci0 bus-ehci1 bus-ohci0 bus-ohci1 bus-ve bus-tcon0 bus-tcon1 bus-deinterlace bus-csi bus-hdmi bus-de bus-gpu bus-msgbox bus-spinlock bus-codec bus-spdif bus-pio bus-ths bus-i2s0 bus-i2s1 bus-i2s2 bus-i2c0 bus-i2c1 bus-i2c2 bus-src bus-uart0 bus-uart1 bus-uart2 bus-uart3 bus-uart4 bus-dbg ths usb-phy0 usb-phy1 usb-hsic usb-hsic-12M usb-ohci0 usb-ohci1 dram-ve dram-csi dram-deinterlace dram-ts csi-misc ac-dig ac-dig-4x avs hdmi-ddc


I'm just wondering what more information I could provide on this to help getting the ports fully functioning?
Comment 3 Kaya Saman 2019-07-30 23:41:25 UTC
Unexpectedly today I tested with Armbian - Debian version and managed to activate the UART ports via the overlays already part of the image.

I compared the uart overlays to what was given to me in the mailing list and they were similar though the Armbian version had more information inside.

As a test I decided to use the Armbian overlays in FreeBSD 13-CURRENT. The procedure was to grab uart1-4 dts files from here: https://github.com/armbian/sunxi-DT-overlays/tree/master/sun50i-a64

and put them in /usr/src/sys/dts/arm64/overlays/

After running "make" in the dir I copied the .dtso files from /tmp dir into /boot/dtb/overlays/
then added the information to /boot/loader.conf in the overlay section:

fdt_overlays= ... 
sun50i-a64-uart1,sun50i-a64-uart2,sun50i-a64-uart3,sun50i-a64-uart4

From there reboot then test using minicom.

For sure the NMEA sentences started appearing on the terminal. Then I performed a test for my LCD connected to uart2 and also that functioned as in characters appeared on it; as lcdproc still needs a driver for the Newhaven display however, overall I think it was a success! :-)

So I think the above files just need to be provided with the image Pine64-LTS image then I think this bug will be fixed ;-)