Open ZhiyuanYuanNJ opened 2 weeks ago
It may be related to the device's driver used. I will replace the original manufacturer driver with a CDC driver and the function did not return -1 did not return -1. But I want to know the reason, because this vendor's driver has no problem using it.
Which operating system are you using? Windows 10 x64
Describe the exact steps which reproduce the problem in as many details as possible. For example, the software/equipment which runs the Modbus server, how the clients are connected (TCP, RTU, ASCII) and the source code you are using. Modbus RTU I'm using modbus rtu, my code runs fine on a virtual serial port, but when I change the serial port to an actual TTL level USB serial port, the modbus_receive() function always returns -1.
Enable the debug mode, libmodbus provides a function to display the content of the Modbus messages and it's very convenient to analyze issues (http://libmodbus.org/docs/modbus_set_debug/).
The following is the debug report: .\RemoteGPIOControl.exe : ERROR timed out: select 所在位置 行:1 字符: 1
My Code Process: