[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Releasing RTS in RS485 mode



Hi,

I have problems getting /dev/ttyS3 to release the RTS soon enough in 
RS485 mode. The RTS are used to control the direction of the
communication on the RS485 driver.

Specs:
devboard_lx
Linux 2.4.19 with axis patches
Mark/Space parity patches from Tamas Szabo ( Thank you very much Tamas, 
your patches are working great! )
115200 baud

For enabling rs485 mode I've done the following:

struct rs485_ctrl ctrl485;
memset(&ctrl485, 0, sizeof(ctrl485));
ctrl485.rts_on_send = 0;
ctrl485.rts_after_send = 1;
ctrl485.delay_rts_before_send = 0;
status = ioctl(cb->fd, TIOCSERSETRS485, &ctrl485);

And when I want to transmit I do the following:

struct rs485_wrt io485;
io485.outc_size = len;
io485.outc = cmd;
status = ioctl(cb->fd, IOCSERWRRS485, &io485);

Using an oscilloscope I've measured some timings.

On the first picture (twobytes.gif) you see two bytes (55h and AAh)
with no parity. The time from the last stopbit until the RTS line
is released is more than 120 us.

Then I connected my devboard_lx to another device and sometimes
I was able to read the proper data from the device but sometimes
it failed, because the direction of the RS485 driver was changes
too late.

I captured a good (ok.gif) and a bad (fail.gif) situation.

Is there anything I can do? Am I doing something wrong?

Steen

GIF image

GIF image

GIF image