[RK3328-SOM-EVB] Using UART1

Started by cybernox, August 29, 2025, 12:19:11 PM

Previous topic - Next topic

cybernox

I'm working with the RK3328 SOM (RK3328-SOM-EVB) and official bookworm downloaded from https://images.olimex.com/release/RK3328-SOM/RK3328-SOM-bookworm-minimal-20241127-120000.img.7z

I'm trying to enable UART1 but it's not working.

Here's what I have tried so far:

Enabled UART1 using armbian-config → rebooted, but the UART did not appear.

Created a custom Device Tree overlay targeting /serial@ff120000 and set the pinmux for GPIO3_A4/6 to function 5 → rebooted, but the UART still does not appear.

I created a dts inspired by the pinout in the datasheet
/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3328";

    fragment@0 {
        target-path = "/serial@ff120000";
        __overlay__ {
            status = "okay";
        };
    };

    fragment@1 {
        target = <&pinctrl>;
        __overlay__ {
            uart1_pins: uart1_pins {
                rockchip,pins = <
                    3 4 5  /* TX -> GPIO3_A4, mode 5 */
                    3 6 5  /* RX -> GPIO3_A6, mode 5 */
                >;
                function = "uart";
            };
        };
    };
};

Then compiled

dtc -@ -I dts -O dtb -o /boot/dtb/rockchip/rk3328-uart1-olimex.dtbo rk3328-uart1-olimex.dts

added mine in the file /boot/armbianEnv.txt

fdt_overlays=rockchip-rk3328-uart1-olimex

instead of the standard one that was

fdt_overlays=rockchip-rk3328-uart1

but nothing...

various diagnostic commands returns always the same result

ls /sys/firmware/devicetree/base | grep serial@

output:

serial@ff110000
serial@ff120000
serial@ff130000

executed:

cat /sys/firmware/devicetree/base/serial@ff120000/status

Output: disabled

Instead

cat /sys/firmware/devicetree/base/serial@ff130000/status

give me the result okay (I suppose that this is the serial console uart, tested and working)

The command

dmesg | grep ttyS

return always

[    0.000000] Kernel command line: root=UUID=3440d0ff-bb26-49a0-92cb-65352124c942 rootwait rootfstype=ext4 splash=verbose console=ttyS2,1500000  consoleblank=0 loglevel=1 ubootpart=ec32f700-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
[    0.865993] printk: console [ttyS2] disabled
[    0.866687] ff130000.serial: ttyS2 at MMIO 0xff130000 (irq = 21, base_baud = 1500000) is a 16550A
[    0.866814] printk: console [ttyS2] enabled
[    6.976456] systemd[1]: Expecting device dev-ttyS2.device - /dev/ttyS2...
[    9.592381] systemd[1]: Found device dev-ttyS2.device - /dev/ttyS2.

Output shows only ff130000.serial: ttyS2 (console/debug).

Despite these attempts, /dev/ttyS* does not show UART1, and the status of serial@ff120000 remains disabled.

Could you please confirm:
Which node corresponds to UART1 on the Olimex RK3328 SOM?
The correct pinmux/function settings for GPIO3_A4 (TX) and GPIO3_A6 (RX) for UART1.
Any known issues or additional steps needed to enable UART1 under Armbian?

Thank you very much for your help!

LubOlimex

#1
You can change configuration from the device tree files. Probably easier to edit using the Armbian tools. First notice that there are only 3 UARTs in this chip. Refer to page 414 of this document:

https://rockchip.fr/Rockchip%20RK3328%20TRM%20V1.1%20Part1.pdf

UART0 is used for the Ethernet, so you can't use it.

UART1 is free to use.

UART2 is the serial debug UART.

To enable the free UART1:

1. Do armbian-config
2. Go to system
3. Select DTC
4. In the nano editor press ctrl + W (to search) and find:

serial@ff120000 {

In the line where it says status = "disabled" change it to "okay"

5. Save and exit with ctrl + X and confirm to save the changes and to reboot the board. The serial should be enabled after reboot. I tested with simple wire between RX and TX of UART1 to see if I get echo - I do.
Technical support and documentation manager at Olimex

cybernox

I slightly modified the procedure because the armbian-config you included in the bookworm distribution doesn't have the DTC entry.
So I decompiled the rk3328-som.dtb file with the command

sudo dtc -I dtb -O dts -o rk3328-som.dts /boot/dtb/rockchip/rk3328-som.dtb

than edited the serial node serial@ff120000 switching from "disabled" to "okay"

sudo nano rk3328-som.dts

recompiled the dts and updated the /boot/armbianEnv.txt file for using the modified version changing the line

fdtfile=rockchip/rk3328-som-mod.dtb
instead of
fdtfile=rockchip/rk3328-som.dtb

sudo dtc -I dts -O dtb -o /boot/dtb/rockchip/rk3328-som-mod.dtb rk3328-som.dts
sudo nano /boot/armbianEnv.txt
sudo reboot

Now, when I boot

sudo dmesg | grep ttyS*
[    0.000000] Kernel command line: root=UUID=3440d0ff-bb26-49a0-92cb-65352124c942 rootwait rootfstype=ext4 splash=verbose console=ttyS2,1500000  consoleblank=0 loglevel=1 ubootpart=ec32f700-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u   cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
[    0.856367] ff120000.serial: ttyS1 at MMIO 0xff120000 (irq = 21, base_baud = 1500000) is a 16550A
[    0.858993] ff130000.serial: ttyS2 at MMIO 0xff130000 (irq = 22, base_baud = 1500000) is a 16550A
[    0.859126] printk: console [ttyS2] enabled
[    7.750167] systemd[1]: Created slice system-getty.slice - Slice /system/getty.
[    7.780739] systemd[1]: Created slice system-serial\x2dgetty.slice - Slice /system/serial-getty.
[    7.841357] systemd[1]: Expecting device dev-ttyS2.device - /dev/ttyS2...
[   10.293542] systemd[1]: Found device dev-ttyS2.device - /dev/ttyS2.


seems that the ttyS1 i recognized. I can open the port without errors but when I try to send out a string nothing exit from the TX pin. I used a digital oscilloscope to see if any signal i s present but the pin stay at high fixed level (3.3V)

Any suggestion?

cybernox


LubOlimex

#4
The instructions I published above were for the buster image, where DTC edit is possible via the armbian-config. Maybe test with the buster image instead. The archive "RK3328-SOM-buster-20220122-002412.img.7z" can be found at the ftp.

Maybe armbian changed the way to edit DTC in the latest releases

Edit: I will investigate further when I have the time. Thanks for pointing the serial 1 is serial@ff120000 I have edited my previous post.
Technical support and documentation manager at Olimex

LubOlimex

The fact that it works with the old image means it is software issue in the new image.

I tried this one here:

https://forum.armbian.com/topic/16100-rockpi-e-enabling-uart1-and-otg-using-custom-dt-overlays/

After reboot I see serial1 but it won't work probably something from the old image dts should be copied too. Maybe because the pinout is different.
Technical support and documentation manager at Olimex