Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: RS232 and Tk with threads

by afoken (Chancellor)
on Jan 05, 2022 at 14:53 UTC ( [id://11140173]=note: print w/replies, xml ) Need Help??


in reply to Re^3: RS232 and Tk with threads
in thread RS232 and Tk with threads

The typical limitation is that voltage swing is only +-5 volts where "real" RS-232 requires +-12 volts.

Um, no.

RS232 is specified as +3..15 V for 0 ("space") and -3..-15V for 1 ("mark"), and allows for open circuit voltages of up to ±25 V. The voltage range from -3 V to +3 V is unspecified (neither 0 nor 1). See RS232.

PC hardware originally used MC1488/MC1489 level converters supplied by ±12 V from the PSU, and so had ±12 V levels. Some old laptops are rumored to have used ±5 V levels instead. Modern level converters (like the MAX232 or MAX3232) often use charge pumps powered by the logic supply voltage, resulting in RS232 levels of about ±10 V for a logic supply of +5 V, and ±5 V for a logic supply of +3.3 V. When receiving, PCs usually read any voltage above +3 V as 0 ("space") and anything close to 0 V and below that as 1 ("mark").

All of these variants are expected to interoperate flawlessly, and they do.

Some PC peripherals, especially all serial port mice, and serial port LIRC receivers and simple transmitters, abuse some of the RS232 lines as a power supply. RS232 was never designed for that, and while almost PC serial ports could deliver tens of mA per pin, this is not guaranteed. RS232 is defined by voltages, not current.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^5: RS232 and Tk with threads
by Marshall (Canon) on Jan 05, 2022 at 23:15 UTC
    All of these variants are expected to interoperate flawlessly, and they do.
    Unfortunately, I have seen cases where some of these claimed USB-RS232 devices didn't work. While others did. So obviously the failing devices aren't meeting spec. Exactly why, I am not sure. Sometimes communication was ok with box X but not box Y. The answer was throw unreliable one away and get different one made by somebody else. Somewhere I have a list of "known good" manufacturer's. There is a lot of chatter about this on hobbyist sites.

    Update: from Hardware specific problems

    RS232 ports which are physically mounted in a computer are often powered by three power sources: +5 Volt for the UART logic, and -12 Volt and +12 Volt for the output drivers. USB however only provides a +5 Volt power source. Some USB to RS232 converters use integrated DC/DC converters to create the appropriate voltage levels for the RS232 signals, but in very cheap implementations, the +5 Volt voltage is directly used to drive the output. This may sound strange, but many RS232 ports recognize a voltage above 2 Volt as a space signal, where a voltage of 0 Volt or less is recognized as a mark signal. This is not according to the original standard, because in the original RS232 standard, all voltages between -3 Volt and +3 Volt result in an undefined signal state. The well known Maxim MAX232 series of RS232 driver chips have this non-standard behavior for example. Although the outputs of these drivers swings between -10 Volt and +10 Volt, the inputs recognize all signals swinging below 0 Volt and above 2 Volt as valid signals.

    This non-standard behavior of RS232 inputs makes it even more difficult to select the right RS232 to USB converter. If you connect and test an RS232 to USB converter over a serial line with another device, it might work with some devices, but not with others. This can particularly become a problem with industrial applications. Low-cost computers are often equipped with cheap RS232 drivers and when you test the RS232 to USB converter with such a computer, it might work. But the same converter may fail if you try it in an industrial environment. The chances that RS232 ports from low-cost computers accept signals in the 0..5 Volt range are higher than with industrial equipment which is often specifically designed to be immune for noise.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found