Skip to content

RS485 / Modbus serial performance troubleshooting ​

This guide explains how to measure Revo 2 RS485 / Modbus query times, inspect Linux serial latency settings, and compare raw serial I/O with the SDK to locate performance bottlenecks.

Identify the rate ​

MetricMeaning
Query durationHost call time until a response arrives; may include lock waits, driver buffering, transmission, device processing, and scheduling
Single-hand read rateSuccessful consecutive queries per second to one hand
Per-hand dual-read rateEach hand's valid response rate when alternating requests on one bus
Control-loop rateActual rate of complete read, compute, and write cycles
ROS topic rateMessages received by a subscriber; measure bus transactions separately

For example, two sequential reads taking 2 ms each require about 4 ms before control writes and other overhead. A 100 Hz loop has a 10 ms budget. Measure the complete loop rather than extrapolating from peak single-hand reads. If an API submits writes asynchronously, returning from the call confirms submission; the later bus operation may still make reads wait.

ROS update_rate is a target; Overrun means the loop exceeded its time budget. JointTrajectoryController state publication, Action monitoring, and /joint_states reception rates do not directly measure serial control-frame transmission.

Verify the runtime, port, and device ​

Match the device model, firmware, slave address, baud rate, and query content before comparing results. Record the SDK version and native library path used by each program. Python environments, ROS workspaces, and standalone C++ programs can use different libraries; recheck the loaded path after changing environment variables or using sudo.

Replace /dev/ttyUSB0 with the actual serial port in these Linux commands:

bash
serial_port=/dev/ttyUSB0
readlink -f "$serial_port"
udevadm info --query=property --name="$serial_port"
readlink -f "/sys/class/tty/${serial_port##*/}/device/driver"

Driver-link hierarchy varies. If a command returns no information, inspect udevadm info --attribute-walk --name="$serial_port". Use this information to record the test environment.

  • /dev/ttyUSB* usually denotes USB serial, but does not necessarily mean FTDI.
  • /dev/ttyAMA* usually denotes a hardware UART; verify the driver.
  • Host receive latency depends on the serial driver, buffering, and scheduling. Keep the device, query content, and baud rate matched when comparing interfaces.

FTDI latency timer and hardware UARTs ​

An FTDI USB serial latency_timer commonly starts at 16 ms. It affects when buffered receive data is delivered; transaction time also includes transmission and device processing. Read the effective value after the program opens the port:

bash
cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer

The Linux SDK attempts to enable ASYNC_LOW_LATENCY when opening a serial port. Supported FTDI drivers may change the timer to 1 ms; verify the readback. If enable_low_latency failed is logged, check driver support and permissions. Verify the effect using both the parameter readback and measured query times.

For manual setup, stop other serial access, run the following command, then start the program and verify the value again. The host needs setserial, and the driver must support the ioctl:

bash
sudo setserial /dev/ttyUSB0 low_latency

Hardware UARTs normally do not expose FTDI's latency_timer. Consult the driver documentation for FIFO, DMA, receive timeout, and RS485 direction settings. The effect of ASYNC_LOW_LATENCY depends on the driver and should be checked through query timing.

Compare raw serial and SDK queries ​

The public examples include raw Python/C++ serial benchmarks. Both raw implementations avoid the SDK and Modbus libraries but still send valid Modbus RTU requests. An SDK C++ comparison is included. Verify the supported Revo2 registers, addresses, and baud rate before use.

  1. Stop other port users. Test one hand on the same port and baud rate, then alternate between two hands. Serialize complete request/response transactions on a shared bus.
  2. Run raw Python, raw C++, and the SDK separately. Match the actual native library and effective low-latency settings, including changes made during SDK initialization.
  3. The raw tools can independently set and read back the driver flag with --low-latency. Keep warnings in the test conditions if the driver does not support it.
  4. Record successes, failures, median, P95, maximum, and individual durations. Separate startup, warm-up, logging, and deliberate sleeps from steady-state timing. Stop on a timeout or validation error and restart after ensuring that no requests remain outstanding.
  5. After matching read-only conditions, compare dual-hand reads/writes, control loops, and ROS message rates. Read-only operation, holding a pose, and moving trajectories are distinct workloads.

Use the target device's slave ID in each request and calculate the CRC from the frame contents. Validate the response address, function, length, and CRC. Modbus RTU has no transaction sequence number, so ensure no requests from a previous run remain outstanding.

ObservationNext check
Both raw implementations are fast, SDK is slowLoaded library, SDK initialization, locks, reads, and scheduling
All three are slowShared driver, link, and device conditions; compare a known-good USB-RS485 adapter on the same host and hand
Raw Python and C++ differSerial configuration, buffering, read behavior, and measurement boundaries
Pure reads are fast, application is slowRead/write durations, lock waits, actual control-frame counts, asynchronous write queues, and loop budget

Save test results ​

Keep the following information with the CSV measurements so that the test can be repeated or shared with technical support:

  • Commands, program and SDK versions, and the loaded native library path.
  • Device model, firmware, serial driver, baud rate, slave addresses, and low-latency settings.
  • Single- or dual-hand operation, read-only or read/write workload, and test duration.
  • Run logs including startup information and errors, successful query counts, and duration distributions.
Help