Slow UART response iMX7d

Hi,
I am using 6 channels of UART 921600 baud (termios using FD_SET event) on iMX7d 1GB eMMC, and seeing high latency. (probed uart lines, calculated expected and actual time).
Could you please help me find a way to reduce latency or increase kernel tick/timers or any other way.

Thank you
Neeraj

Hi @neeraj.verma

Thanks for writing to the Toradex Community!

I am using 6 channels of UART 921600 baud (termios using FD_SET event) on iMX7d 1GB eMMC, and seeing high latency.

How do you see this latency?
Could you provide some log?
What is your Application? If you need higher communication rate, then you should switch to faster communication as SPI.

Best regards,
Jaski

Hi @jaski.tx,
We have measured time to transmit 10 bytes along with our protocol, should take X ms but it takes almost 2x and time is not consistent, let’s say onetime it takes x ms, another times it takes x+5 ms and so on.
as per the board design we have only UART interfaces to all the motors controller.
I request you to help to make UART real-time, time-bound.
I also read about kernel tick can help in this, could you please let me know how to modify?

Thank you
Neeraj

HI @neeraj.verma

We have measured time to transmit 10 bytes along with our protocol, should take X ms but it takes almost 2x

How did you measure this time? Using oscilloscope?

and time is not consistent, let’s say onetime it takes x ms, another times it takes x+5 ms and so on. as per the board

This is expected, since Linux is not a real-time OS.

as per the board design we have only UART interfaces to all the motors controller. I request you to help to make UART real-time, time-bound.

I think, UART is not an issue, but the OS. Depending on your real-time requirement (maximum time jitter), you should either use real-time patch for Linux or use FreeRTOS on M4 of iMX7.

I also read about kernel tick can help in this, could you please let me know how to modify?

I never heard of this. Could you share any link?

Best regards,
Jaski

  1. Yes, I measured time both from CPU ticks and oscilloscope
  2. Could you please share the procedure for real-time patch
  3. c++ - Low latency serial communication on Linux - Stack Overflow
  4. http://e2e.ti.com/support/legacy_forums/embedded/linux/f/354/t/526244
  5. another link says:
  6. //Trying to set low latency
    
    struct serial_struct kernel_serial_settings;
    ioctl(uart_port, TIOCGSERIAL, &kernel_serial_settings);
    kernel_serial_settings.flags |= ASYNC_LOW_LATENCY;
    ioctl(uart_port, TIOCSSERIAL, &kernel_serial_settings);

Thank you
Neeraj

HI

Yes, I measured time both from CPU ticks and oscilloscope

And what was the result?

Could you please share the procedure for real-time patch

Sure, have a look here.

Best regards,
Jaski

Thank you.

You are welcome.

Best regards,
Jaski