How to use ttyS1 and ttyS2 on MikroTik RBM33G?


MikroTik router board M33G have 3 serial interfaces: one RS232 on via standard 9-pin D-sub connector and two on the pin-header on the board.
My intention is to use second serial interface on the board via pin-head to UART - RS485 convertor for communication with other devices via Modbus RTU.
My problem is when I trying communicate via ttyS1 with libmodbus library, I've got: I/O error.
Communication via ttyS0 is without errors.
Is there some missing UART driver for ttyS1 and ttyS2 in OpenWrt or where can by problem?


According to Mikrotik wiki,

For RBM33G additional serial header can be attached on GPIO pins U3_RXD, GND, U3_TXD, and 3V3

For whatever reason they are talking about single port.

I also see that at least one UART is occupied by GPIO in DTS, I think it might be ttyS2.

gpio {
			ralink,group = "uart2", "wdt";
			ralink,function = "gpio";

Is there some way to bring this pins back to UART?

GPIO ports 9,10,11,12 all belong to uart2 group and used to control PCIe and USB connector power, so you should not remove this group from gpio.

At the same time, uart3 is disabled in mt7621.dtsi and should be enabled in RBM's dts file before use.

uartlite3: uartlite3@e00 {
			compatible = "ns16550a";
			reg = <0xe00 0x100>;

			clock-frequency = <50000000>;

			interrupt-parent = <&gic>;
			interrupts = <GIC_SHARED 28 IRQ_TYPE_LEVEL_HIGH>;

			reg-shift = <2>;
			reg-io-width = <4>;

			pinctrl-names = "default";
			pinctrl-0 = <&uart3_pins>;

			status = "disabled";

It's working, thank you AndrewZ :slightly_smiling_face:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.