MT7621 : Failed to enable UART 2 and 3

Hello Guys,

Firstly, I want to enable the remaining Two UART in the kernel mt7621.dtsi file and develop RS232/RS485 Driver code.

Could you please locate the kernel location, in which I can work and build it as per requirement?

The reason why I am asking this question is because I am finding three locations of mt7621.dtsi. Please see below.

Moreover,

I tried to enable UART2 and UART3 in mt7621.dtsi file in all above locations shown in the figure by updating the section below.

uartfull1: uartfull@d00 {
compatible = "ns16550a";
reg = <0xd00 0x100>;

clocks = <&sysclock50M>;
clock-frequency = <50000000>;

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

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

/* MS Change */

//no-loopback-test;
current-speed = <9600>;
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
//status = "disabled";

/* MS Change */
};

uart2_pins: uart2 {
uart2 {
mtk,group = "uart2";
mtk,function = "uart2";
};
};


But I will receive "write error I/O" and "Read error I/O" while transferring data over UART. is it mean these two pins are used in the kernel?

I am connecting my USB to UART Module at PIN 7 and 8 of connector J10 of Unielec Devkit {unielec u7621-06}.

Can you guys please help me with this problem?

Best regards,
Milav Soni

You will probably be better off creating your own device DTS.

I think the first file is 'the right one', although you must also include the serial.ko (I think that's what it is called) in the image also. This can be included when you create your own device definition in the .mk file. You could copy/paste any other similar device. ( Look at the .mk files and see what other devices include, in terms of .ko files. )

Then enable UART as above, then include the serial.ko or appropriate driver for UART usage.

You don't need to touch .dtsi, all the changes should be made in the specific device file.

Both uartlite2 and uartlite3 are defined in mt7621.dtsi but they are disabled there. What you need to do is enable them in your device specific .dts

Then in mt7621_unielec_u7621-06.dtsi "uart2" is included into gpio list, so in your device specific .dts you need to mimic this section but with uart2 excluded.

However...
mt7621 pin group uart2 consists of:

pin 9 (io9)
pin 10 (io10)
pin 11 (io11)
pin 12 (io12)

Pins 10-12 are in use by the LEDs according to the device page and mt7621_unielec_u7621-06.dtsi

2 Likes

He seems to be using some custom OpenWrt SDK anyway. Wrong forum?

2 Likes

Well spotted!

Thank you.

I enable it in device specific dts file and it is working.

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