This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5729: UART3 is slow in user applicaion

Part Number: AM5729

Dear Champs,

My customer wants to use UART3(UART3 == /dev/ttyS2) in the usespace application to output debug information, but it is very slow than UART1 used for linux kernel debug information.

They set the terminal as below and output message using write command of file descriptor through UART3 serial console.

int nFD_Log;

struct termios ta;

 

tcgetattr(0, &ta);

ta.c_iflag = ICRNL|IXON|IXOFF;

ta.c_oflag = OPOST|ONLCR;

ta.c_cflag = CS8|CREAD|(B115200&CBAUD);

ta.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN;

ta.c_cc[VINTR] = CTRL('C');

ta.c_cc[VQUIT] = CTRL('\\');

ta.c_cc[VERASE] = CTRL('H');

ta.c_cc[VKILL] = CTRL('?');

ta.c_cc[VEOF] = CTRL('D');

ta.c_cc[VMIN] = '\001';

ta.c_cc[VSTART] = CTRL('Q');

ta.c_cc[VSTOP] = CTRL('S');

ta.c_cc[VSUSP] = CTRL('Z');

ta.c_cc[VREPRINT] = CTRL('R');

ta.c_cc[VDISCARD] = CTRL('O');

ta.c_cc[VWERASE] = CTRL('W');

ta.c_cc[VLNEXT] = CTRL('V');

tcsetattr(0, TCSANOW, &ta);

ioctl(0, TIOCEXCL, (struct sttyb *)NULL);

setbuf(stdout, NULL);

 

if ((nFD_Log = open("/dev/ttyS2", O_WRONLY | O_NOCTTY)) == -1) {

return -1;

}

 

tcgetattr(nFD_Log, &ta);

ta.c_iflag = 0;

ta.c_oflag = 0;

ta.c_cflag &= ~(CS7|PARENB|CBAUD);

ta.c_cflag |= (CS8|CBAUD& B115200);

ta.c_lflag &= ~(ICANON|ISIG|ECHO);

tcsetattr(g_nFD_Log, TCSANOW, &ta);

ioctl(nFD_Log, TCFLSH, NULL);

 

char acLogBuf[256] = { 0, };

write(nFD_Log, acLogBuf, 256);

 

close(nFD_Log);

Should they use DMA to make fast in UART3 output?

If so, could you please guide me how they can use DMA for UART3?

Thanks and Best Regards,

SI.

  • Hi SI,

    Can you tell me the SDK version they are using?

    Best Regards,
    Keerthy

  • They are using Linux SDK v6.3.

    Thanks and Best Regards,

    SI.

  • Hi SI,

    So the same application runs faster when using UART1 but is slower using UART3.

    Can you share the exact numbers? Also UART driver is the same for UARt1 & UART3. So question of DMA enhancing speed
    is a bit odd.

    Best Regards,
    Keerthy

  • Hi Keerthy,

    Sorry for your confusion. UART1 is used in the kernel to print out debug message. UART1 is not used in the Userspace.

    Is there anything to make slow to use UART in the userspace?

    Thanks and Best Regards,

    SI.

  • Hi SI,

                    uart1: serial@4806a000 {
                            compatible = "ti,dra742-uart", "ti,omap4-uart";
                            reg = <0x4806a000 0x100>;
                            interrupts-extended = <&crossbar_mpu GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
                            ti,hwmods = "uart1";
                            clock-frequency = <48000000>;
                            status = "disabled";
                            dmas = <&sdma_xbar 49>, <&sdma_xbar 50>;
                            dma-names = "tx", "rx";
                    };

                    uart2: serial@4806c000 {
                            compatible = "ti,dra742-uart", "ti,omap4-uart";
                            reg = <0x4806c000 0x100>;
                            interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
                            ti,hwmods = "uart2";
                            clock-frequency = <48000000>;
                            status = "disabled";
                            dmas = <&sdma_xbar 51>, <&sdma_xbar 52>;
                            dma-names = "tx", "rx";
                    };

                    uart3: serial@48020000 {
                            compatible = "ti,dra742-uart", "ti,omap4-uart";
                            reg = <0x48020000 0x100>;
                            interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
                            ti,hwmods = "uart3";
                            clock-frequency = <48000000>;
                            status = "disabled";
                            dmas = <&sdma_xbar 53>, <&sdma_xbar 54>;
                            dma-names = "tx", "rx";
                    };

    Both UART1 & UART3 have dma enabled. So no difference w.r.t enabling dma.

    Even the clock frequency is the same. So from driver perspective both are having
    same features enabled.

    One more point by default all am572x have UART3 as the console UART.
    Is the customer board having UART1 as console(Linux debug)?

    Regards,
    Keerthy