Inquiry about delay when received from RS485 port
Posted: 16 Oct 2023, 03:45
I have created a program to communicate with another device using serial communication via RS485 and run it on the RevPi.
Summary of the program
The program is written in C and uses a select function to repeatedly detect and read incoming messages from another device.
Please let me know if there is a solution to the following problem.
・It takes about 20ms for a received message from another device to be updated in the device file, which is a larger delay than expected.
・It takes about 20 ms before the select function detects the reception.
・When reading immediately after reception is detected, all data (100 bytes) sent from another device is in the device file, and the message written from the device driver to the device file at one time is larger than expected.
・Is the received data buffered in the device driver?
Environment
・RevPiConnectSE (RevPi Buster Lite (01/2023) (ID: 6568))
・Port used: RS485 (dev/ttyUSB0)
・Baud rate: 562500
Summary of the program
The program is written in C and uses a select function to repeatedly detect and read incoming messages from another device.
Please let me know if there is a solution to the following problem.
・It takes about 20ms for a received message from another device to be updated in the device file, which is a larger delay than expected.
・It takes about 20 ms before the select function detects the reception.
・When reading immediately after reception is detected, all data (100 bytes) sent from another device is in the device file, and the message written from the device driver to the device file at one time is larger than expected.
・Is the received data buffered in the device driver?
Environment
・RevPiConnectSE (RevPi Buster Lite (01/2023) (ID: 6568))
・Port used: RS485 (dev/ttyUSB0)
・Baud rate: 562500