reliable rs-232

Pegasus Mc Cleaft ken at mthelicon.com
Sun Apr 11 09:53:47 UTC 2010


On Saturday 10 April 2010 13:41:33 Grzegorz Daniluk wrote:
> Hi everybody,
> I have a question regarding rs-232 under FreeBSD.
> I need to write an application for FreeBSD to operate an industrial
> controller via rs-232. The trick is that it should have very good long
> term stability (reliably operation over years). It should be able to
> detect and correct (e.g by reconfiguration of rs-232 port parameters)
> when rs-232 hangs or changes its transmission parameters as a result of
> electrical interference/disturbances etc. First thought is to simply
> close and reopen rs-232 port every given time interval, so even if
> something 'strange' happens the failure would be fixed after finite time
> period. But maybe there is smarter way of doing that. Maybe some special
> fault-tolerant rs-232 kernel drivers ?
> Any help appreciated, maybe someone has other helpful advieces regarding
> reliable rs-232 programming ini general ?

Hi Grzegorz, 
        
        I dont think you are going to find anything that is classified as 
fault 
tolerant RS-232.  My experience with 232 in industrial environments has been 
met with various levels of success. In small controlled conditions it works 
OK, but you are limited to speed and distance. Further, the single ended 
nature of 232 and the high input impedance of the receivers make it not the 
best choice for electrical interference rejection. If you have control of the 
electrical specifications, you might be better off using RS-422 as it is 
designed differentially and with a low impedance, so it works well in 
electrically nasty environments. All the better if you can opto-isolate the 
line drivers/receivers on the transmission line side of the interface. 

        In one application, I designed a RS-232 to fibre-optic interface using 
S/Pdif transceivers and a 555 as a PWM generator/detector. This worked 
wonderfully for electrical isolation between the PC and the CNC motion 
controller I was interfacing to. I have seen similar things sold as a ready 
made brick that you could just plug in and use. 

        Making the machine and PC "Fail to a safe condition" is not something 
you 
should design into the rs-232 interface directly, in my opinion. You should 
have a upper layer protocol bouncing between the two points and if this 
protocol times-out, then you should assume the interface of the remote device 
has failed and take action in your software (on both sides). In the case of 
the fibre connection, I added in addition to the protocol checks, a carrier 
detect circuit where if the link failed between the two machines, it dropped 
out a relay that was wired to the E-Stop circuit. 

        I hope some of this is helpfull... 

Peg


More information about the freebsd-questions mailing list