cbrake / linux-serial-test

Linux Serial Test Application
302 stars 154 forks source link

Improve RS485 testing #23

Closed MaxKrummenacher closed 4 years ago

MaxKrummenacher commented 4 years ago

Thanks for the great tool.

yegorich commented 4 years ago

@MaxKrummenacher while at it, could you implement the full range of rs485 options as described in https://github.com/cbrake/linux-serial-test/issues/18?

MaxKrummenacher commented 4 years ago

@yegorich Isn't that mostly implemented now?

RTS on send (bool)
RTS after send (bool)

I cannot see a usecase for having these both set or both cleared. With the patch 'make rts polarity a parameter' you would get the option of setting one of the two and have the other one cleared.

RTS delay before send (int)

That is not yet implemented if I see it correctly.

RTS delay after send (int)

This one is what you can set with the -q option, with 0 being a valid value.

Receive during sending data (bool)

That one I switched unconditionally on, I cannot see why one wants to use the linux-serial-test tool without this. Do you have a good reason for this?

yegorich commented 4 years ago

@MaxKrummenacher I was just listing all options available in the structure. But you're right, the only missing feature is delay specification.

MaxKrummenacher commented 4 years ago

@yegorich

One could extend the -q parameter as follows: -q 0 : Enable rs485 with the transmitter switched on right before TX and switched off right after. -q 1 : Add a delay of one bit time after TX finished before disabling the transmitter. And new: -q 1.2 : Add a delay of two bit times after the transmitter is enabled before starting TX and add a delay of one bit time after TX finished before disabling the transmitter.

This would not change the API with currently used command lines. I send a merge request with that implemented. #24