Is a standard devc-ser8250 can work with RS-485 interface?
It is using motherboard Advantech PCA-6773 with UART-16450. Port COM2 work in RS-485 mode.
Should work
I had a 4 port serial card with interrupt share , with one of the ports using RS-485, it worked for me. Have a loopback cable set up and test it out !.
Warning some RS-485 card required the CTS line to be activated to take owner ship of the serial line. The QNX driver doesn’t automaticly handles this. You either need to create a custom version of the driver or handle CTS yourself (which can be tricky).
Some RS-485 card will however have the circuit that does this automaticaly.
int fd = open(“dev/ser2”,O_RDWR);
// This code work correctly
write(fd,Command,sizeof(Command));
//set the RTS to enable reading from serial port with RS- 485
data = _CTL_RTS_CHG | _CTL_RTS;
devctl (fd, DCMD_CHR_SERCTL, &data, sizeof(data), NULL);
[color=red] //This code don’t work. There is no errors, but data from serial port
//not reading.
read(fd,cReplyBuffer,sizeof(cReplyBuffer));
Anybody know why?
Maybe I’m not correct, but you don’t need to set RTS - driver do this for you.
It isn’t work if I set RTS and unset DTS and if I don’t set RTS.
Maybe I’m incorrectly set the flags or it is need to set other flags?
I see some sourcess (not my):
Open port;
Set RTS - like you do - _CTL_RTS_CHG | _CTL_RTS;
write command;
Unset RTS - _CTL_RTS_CHG | 0;
Read data from port.
This should be work!
How to read the state of register of COM-port?