AM62L: How to solve the issue of several idle bytes appearing in the transmission through the serial port of Linux AM62X?

Part Number: AM62L

When running Linux-RT on AM62x and using serial port programming in the Linux system, there is a time gap of more than ten microseconds between bytes when sending data, which causes abnormalities in the receiving slave device. I have attached part of my application code in the hope that my issue can receive technical support

  struct termios oldtio = {0};
    struct termios newtio = {0};
    tcgetattr(fd_tx, &oldtio);

    newtio.c_cflag = B3000000 | CS8 | CLOCAL | CREAD;
    newtio.c_iflag = 0; // IGNPAR | ICRNL
    newtio.c_oflag = 0;
    newtio.c_lflag = 0; // ICANON
    newtio.c_cc[VTIME] = 0;
    newtio.c_cc[VMIN] = 1;
    tcflush(fd_tx, TCIOFLUSH);
    tcsetattr(fd_tx, TCSANOW, &newtio);
 
    struct serial_struct ser_tx;
    if (ioctl(fd_tx, TIOCGSERIAL, &ser_tx) == 0)
    {
        ser_tx.flags |= ASYNC_LOW_LATENCY; // 0x2000
        if (ioctl(fd_tx, TIOCSSERIAL, &ser_tx) == 0)
        {
     
        }
        else
        {
            perror("fd_tx TIOCSSERIAL failed");
        }
    }
    else
    {
 
    }


    //  fcntl(fd_tx, F_SETFL, O_NONBLOCK);
    memset(&oldtio, 0, sizeof(oldtio));
    memset(&newtio, 0, sizeof(oldtio));
    tcgetattr(fd_rx, &oldtio);

    newtio.c_cflag = B3000000 | CS8 | CLOCAL | CREAD;
    newtio.c_iflag = 0; // IGNPAR | ICRNL
    newtio.c_oflag = 0;
    // newtio.c_oflag &= ~OPOST; // 
    newtio.c_lflag = 0; // ICANON
    newtio.c_cc[VTIME] = 0;
    newtio.c_cc[VMIN] = 1;
    tcflush(fd_rx, TCIOFLUSH);
    tcsetattr(fd_rx, TCSANOW, &newtio);
 
    struct serial_struct ser_rx;
    if (ioctl(fd_rx, TIOCGSERIAL, &ser_rx) == 0)
    {
        ser_rx.flags |= ASYNC_LOW_LATENCY;
        ioctl(fd_rx, TIOCSSERIAL, &ser_rx); 
    }
    else
    {
        perror("fd_rx TIOCSSERIAL failed");
    }

    // 设置为非阻塞模式
    fcntl(fd_rx, F_SETFL, O_NONBLOCK); 
 
error_code_t UART_Transmit_DMA(int fd, const uint8_t *pData, uint16_t Size)
{

    error_code_t res = 0;

    res = write(fd, pData, Size);

    if (res == Size)
    {
        return 0;
    }

    else if (res == -1)
    {
        //  printf("Size=%d sendres=%d\n", Size, res);
        log_write(0, "........SERIAL_DATA_TRANSMISSION_ERR!........");
    }
    else // res > 0 && res < Size
    {
        log_write(0, "........SERIAL_DATA_TRANSMISSION_MISSING!........num=%d\n", (Size - res));
        //  printf("Size=%d sendres=%d\n", Size, res);
    }

    return SERIAL_DATA_TRANSMISSION_ERR;
}
 
As shown in the figure, I have extracted one of the data points where a significant gap appears between the second and third bytes. This phenomenon may occur randomly several times within hundreds of data frames. Furthermore, this issue becomes more frequent when Linux is running a large number of file stream operations, leading to high load on the am62x.
 
 
Snipaste_2026-03-23_15-11-03.png