RTS toggle


I am trying to implement a RS485 bus using a serial port.

I have seen many other messages about this issue, but none answered and solved, that is why I am opening a new message post.

This is how I tried to implement it:
portb = open( “/com/0”, O_RDWR );
tcgetattr( portb, &portbCfg );
portbCfg.c_iflag = 0;
portbCfg.c_cflag |= CRTSTOGGLE;
cfsetospeed( &portbCfg, speed );
tcsetattr( portb, TCSANOW, &portbCfg );
But it does not work, when I transmit a message using write() function, RTS line does not toggle.

Can anyone help, please?


The problem is solved. I think it was working from the beginning but I had a problem with the hardware. I did not need to change the way the port is opened.

Best regards,