ERROR Connection timed out: select
I am coding a small application that use modbus, I'm using libmodbus
I have a pci card (2 serial port + 1 parallel port) + RS232 <-> RS485 converter
I wired the PC with the slave, tested on windows with modbusPoll : OK
But when using any modbus tools on my ubuntu, it doesn't work
With libmodbus I have "ERROR Connection timed out: select"
I tried to monitor the serial with "statserial" I have
Before the test :
RTS = 1
CTS = 0
DSR = 1
DTR = 1
after test :
RTS = 1
CTS = 1
DSR = 1
DTR = 1
and no activity for TX or RX
Can any one help me, please
Greeting from Tunisia :)
Here is the code of my app
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <modbus.h>
int main(void)
{
int rc;
modbus_t *ctx;
uint16_t tab_reg[10];
int i;
struct timeval byte_timeout;
byte_timeout.tv_sec = 0;
byte_timeout.
struct timeval response_timeout;
response_
response_
ctx = modbus_
if (ctx == NULL) {
fprintf(
return -1;
}
modbus_
modbus_
modbus_
modbus_
modbus_
modbus_
modbus_
if (modbus_
fprintf(
modbus_
return -1;
}
rc = modbus_
if (rc == -1) {
fprintf(
return -1;
}
modbus_
modbus_
return 0;
}
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- libmodbus Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: