Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] RS232 standard and pins in DB9 connector

Status
Not open for further replies.

joniengr

Full Member level 5
Joined
Nov 3, 2018
Messages
244
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
2,153
Hi,

I guess we can establish UART communication by only pin 2 (Rx), 3 (Tx) and 5 (GND) in DB 9 connector. I guess we can also implement the Cyclic Redundancy Check (CRC) with only these three pins which is like ex-or operation with coefficient of known polynomial. I am wondering what the other pins are for ?
 

00kam

Member level 2
Joined
Dec 17, 2020
Messages
46
Helped
8
Reputation
16
Reaction score
5
Trophy points
8
Activity points
279
Hello
no thing else in DB9 pins are used in UART because UART means (universal Asynchronous receive transmission) it just needs setting the parameters (start bit ,baud rate, the parity,stop bit, check sum)

kamal
 

00kam

Member level 2
Joined
Dec 17, 2020
Messages
46
Helped
8
Reputation
16
Reaction score
5
Trophy points
8
Activity points
279
What is check sum?
Yes
Many serial protocols use checksum (additional bytes added at the end of the data string) to check the data integrity, as errors might occur during data transmission. There are many types of checksum, from the simplest uses
it is used in UASRT communication RS232 protocol but neglected in UART

kamal
 

c_mitra

Advanced Member level 5
Joined
Nov 13, 2012
Messages
3,518
Helped
874
Reputation
1,750
Reaction score
843
Trophy points
1,393
Activity points
27,265
it just needs setting the parameters (start bit ,baud rate, the parity,stop bit, check sum)
Checksum is not in the list of parameters to be configured in the control byte - but that depends on the chip used.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,586
Helped
4,781
Reputation
9,579
Reaction score
4,560
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
124,317
Going back to post #1 - ALL the pins have a function, it is already a sub-set of DB25 to eliminate non-essential signals. There are many references to the pin usage on the internet.

It is true that a minimal serial link can be established with only TX, RX and GND but that assumes software handshaking is used and no 'alert' (RI) signal is needed. The other signals are to announce the devices are ready to communicate and to allow or suspend the data flow.

The CRC is an entirely software issue. It is an accumulation of the data bytes fed through a polynomial equation to produce a checksum which is then transmitted after the data. The receiving device also carries out the calculation and if the two numbers don't match it flags an error has occurred.

Brian.
 

joniengr

Full Member level 5
Joined
Nov 3, 2018
Messages
244
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
2,153
Hello
no thing else in DB9 pins are used in UART because UART means (universal Asynchronous receive transmission) it just needs setting the parameters (start bit ,baud rate, the parity,stop bit, check sum)

kamal
This was my original question, is it possible to implement complete UART protocol (start bit ,baud rate, the parity,stop bit, check sum) with only pin 2 (Rx), 3 (Tx) and 5 (GND) in DB 9 connector ? If yes then I guess the DB 9 connector can also be used for other protocol as well, for example RS-485 that uses only pin 8 and pin 9.
--- Updated ---

Yes
Many serial protocols use checksum (additional bytes added at the end of the data string) to check the data integrity, as errors might occur during data transmission. There are many types of checksum, from the simplest uses
it is used in UASRT communication RS232 protocol but neglected in UART

kamal
The checksum (additional bytes that added at the end of the data string for data integrity) has also to be sent through pin 2 (Rx), pin 3 (Tx) and there is no other pin other then pin 5 (GND) that we need to use to implement UART, right ? In total only three pins, i.e, 2, 3 and 5
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,586
Helped
4,781
Reputation
9,579
Reaction score
4,560
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
124,317
Minimally, yes just the three pins can be used.
You can use the other pins for other purposes but it would not comply to any standard so you would have to be sure that the equipment couldn't be mixed with incompatible connections. For example, all the pins except RI are normally connected in a USB - UART adapter but if you plugged your cable in to one of them you would potentially be exceeding the ratings of both connected devices.

I confess, I use a DB9 here on a PIC based control box where it normally has an ESP8266 module inside the plug shell to send serial by WiFi but it can be unplugged and a Pickit programmer module inserted instead to reprogram the PIC.

Brian.
 

joniengr

Full Member level 5
Joined
Nov 3, 2018
Messages
244
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
2,153
Going back to post #1 - ALL the pins have a function, it is already a sub-set of DB25 to eliminate non-essential signals. There are many references to the pin usage on the internet.

It is true that a minimal serial link can be established with only TX, RX and GND but that assumes software handshaking is used and no 'alert' (RI) signal is needed. The other signals are to announce the devices are ready to communicate and to allow or suspend the data flow.

The CRC is an entirely software issue. It is an accumulation of the data bytes fed through a polynomial equation to produce a checksum which is then transmitted after the data. The receiving device also carries out the calculation and if the two numbers don't match it flags an error has occurred.

Brian.
What is software handshaking in UART ?
--- Updated ---

One more question, how UART is differ from RS 232 ? Are they same terms or have different meanings ?
 
Last edited:

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,736
Helped
1,794
Reputation
3,596
Reaction score
1,754
Trophy points
1,393
Location
USA
Activity points
58,427

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,998
Helped
1,094
Reputation
2,198
Reaction score
1,078
Trophy points
1,393
Location
California, USA
Activity points
27,364
RS-232 is a STANDARD that defines voltage levels, signals, etc. A UART is a DEVICE that handles serial communications, parallel-to-serial conversion, etc. They are totally different. You can connect a UART to an interface that uses RS-232, RS-422, RS-485, etc.

Software handshaking is NOT in the UART; it is in, SURPRISE!, the software. One example is XON/XOFF protocol. In the XON/XOFF protocol a receiver can transmit an XOFF byte (0x13) which tells the transmitter to stop sending data. To restart data transmission, the receiver would transmit an XON byte (0x11) telling the transmitter it's ok to send data.
 

00kam

Member level 2
Joined
Dec 17, 2020
Messages
46
Helped
8
Reputation
16
Reaction score
5
Trophy points
8
Activity points
279
Checksum is not in the list of parameters to be configured in the control byte - but that depends on the chip used.
checksum byte(s) is neglected like parity bit. parity by default is "non"(no even and neither odd) checksum is bytes (two byte) is sent at the end of the data string as in the" RTU mode" and "ASCII mode" protocol. which is called "CRC CHECK" instead of including it "checksum " with UART techniques. which chip includes check sum byte(s)?
kamal
--- Updated ---

This was my original question, is it possible to implement complete UART protocol (start bit ,baud rate, the parity,stop bit, check sum) with only pin 2 (Rx), 3 (Tx) and 5 (GND) in DB 9 connector ? If yes then I guess the DB 9 connector can also be used for other protocol as well, for example RS-485 that uses only pin 8 and pin 9.
--- Updated ---



The checksum (additional bytes that added at the end of the data string for data integrity) has also to be sent through pin 2 (Rx), pin 3 (Tx) and there is no other pin other then pin 5 (GND) that we need to use to implement UART, right ? In total only three pins, i.e, 2, 3 and 5
Yes in total only three pins, i.e, 2, 3 and 5 are used when your device supports UART techniques (that means your device(MCU) has a built -in UART)
 
Last edited:

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,586
Helped
4,781
Reputation
9,579
Reaction score
4,560
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
124,317
checksum byte(s) is neglected like parity bit. parity by default is "non"(no even and neither odd) checksum is bytes (two byte) is sent at the end of the data string as in the" RTU mode" and "ASCII mode" protocol. which is called "CRC CHECK" instead of including it "checksum " with UART techniques. which chip includes check sum byte(s)?
Incorrect!
Checksums are almost always used when moving data. The exception is very short data such as single lines of text. Almost every protocol uses them as a way of detecting error and initiating the process of requesting it is sent again.

Parity has nothing at all to do with CRC or checksums, it is an additional bit added to make the total number of '1's in a single data byte an odd or even number. It is the simplest of error checking mechanisms but is very limited in what it can find as multiple bit errors can 'cancel' each other out.

A CRC is one kind of checksum and it can be any number of bytes long although single and two byte CRCs are by far the most common.

Barry explained software handshaking in post #11, it send specific codes along the data path to stop and resume the data flow. The obvious drawback to that is those codes may be part of the actual data so further protection against false handshaking may be needed. They are added to the data as it is sent so it can cause other problems it makes the data block bigger than anticipated.

Brian.
 

c_mitra

Advanced Member level 5
Joined
Nov 13, 2012
Messages
3,518
Helped
874
Reputation
1,750
Reaction score
843
Trophy points
1,393
Activity points
27,265
Barry explained software handshaking in post #11, it send specific codes along the data path to stop and resume the data flow. The obvious drawback to that is those codes may be part of the actual data so further protection against false handshaking may be needed. They are added to the data as it is sent so it can cause other problems it makes the data block bigger than anticipated.
Barry explained software handshaking in post #11, it send specific codes along the data path to stop and resume the data flow. The obvious drawback to that is those codes may be part of the actual data so further protection against false handshaking may be needed. They are added to the data as it is sent so it can cause other problems it makes the data block bigger than anticipated.
Right.

The settings are in the controller, no of bits, start bit, parity stop bit etc are in the controller and not set by the pins.

Yes, XON/XOFF can be used (widely used but good for text strings) as software control instead of data set ready / data terminal ready that are hardware signals implemented via signal pins.

In the early days, these were widely used with telephone modems (pin 9 in DB9 shell is called RING INDICATOR) and almost all the pins were needed. But I have not seen all the 25 pins being used in D connector with 25 pins). High speed communication is very difficult with software XON/XOFF.
 

reza147

Junior Member level 3
Joined
May 9, 2013
Messages
25
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,283
Activity points
1,506
Hello
Each serial device is designed to do something at different times.
RS232, RS485, RS422 and USB.

Interface RS232 typically has 9 pins for data transfer. 2 pins for sending and receiving, 1 pin for ground, 1 pin for announcing, and the rest for handling and checking the accuracy of the data.

In the RS232 you can transfer data with only 3 pins. But using handshake pins helps you to transfer more securely. On the other hand, almost all industrial equipment uses handshake pins.

For example: When you send data to the other device, the other device must know that this data is correct? And there is no noise between the path and no invalid data? Therefore, it checks this data with handshake pins. But if you do not have a handshake pin, the two devices are connected without being sure of the accuracy of the data.
Also, if the device in front has a handshake pins and uses it, then you should also use it.

Another example: you want to send data to the device in front, but you do not know if the traffic is light or heavy! If you use the handshake PIN, they will check the traffic of the opposite device, and if the traffic is not heavy, they will send the data, otherwise they will wait for the line traffic to lighten.
(That is, it checks the device in front to see if it is ready to receive data?)

The announcement pin (RI) is used for modems or telephone operations.

Even the USB interface uses the same two lines to check the correct data and the opposite device.
 

00kam

Member level 2
Joined
Dec 17, 2020
Messages
46
Helped
8
Reputation
16
Reaction score
5
Trophy points
8
Activity points
279
Right.

The settings are in the controller, no of bits, start bit, parity stop bit etc are in the controller and not set by the pins.

Yes, XON/XOFF can be used (widely used but good for text strings) as software control instead of data set ready / data terminal ready that are hardware signals implemented via signal pins.

In the early days, these were widely used with telephone modems (pin 9 in DB9 shell is called RING INDICATOR) and almost all the pins were needed. But I have not seen all the 25 pins being used in D connector with 25 pins). High speed communication is very difficult with software XON/XOFF.
YES (start bit ,baud rate, data length (7,or 8 bit ) stop bit ) are in the controller setting that has (USART-bult-in function ) many manufactured controllers comes with already setting (8 bit data length) so the setting get short only (start ,baud,stop) regarding checksum byte(s). there is no dependant(no setting) of checksum on the chip. the checksum mainly used in ASCII mode and RTU mode protocol

"Many serial protocols use checksum (additional bytes added at the end of the data string) to check the data integrity, as errors might occur during data transmission. There are many types of checksum, from the simplest uses of it in Modula or BCC to sophisticated CRC calculation. Using Modula as an example, we learn that before data transmission, the sender adds all command bytes together then mod it by 255 (decimal) to get an additional byte. This is to be added at the end of the command string. When the receiver receives the command string, it will first check the added byte to see whether data remain unchanged or not. If that is the case, it will accept the data, and if not, it will ask the sender to resend the data. "

kamal
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,750
Helped
4,181
Reputation
8,364
Reaction score
4,116
Trophy points
113
Activity points
123,328
Hi,

I see a lot of nonsense written here in this thread.
To prevent from spreading this wrong informations maybe it's better to close this thread...let's se

--> I recommend to read reliable informations.

Some comments:
"Handshaking" has nothing to do with data validation.

1 pin for announcing, and the rest for handling and checking the accuracy of the data.
I can see no pin (indeed you mean"signal") in RS232 that can check "accuracy".
What comes closest to a simple validity check is the "parity bit" that may be sent. It is an UART signal (not directly related to RS232), but surely it is no "pin".
RS232 does not include "validity checks". It may be an interface thing (parity) or a protocol thing (CRC).

Handshaking is done with flow control signals (pins, RFR/CTS) or with protocol (XON/XOFF).
It is used (for example) that the receiver tells the sender whether it is ready to accept data ... or busy.

On the other hand, almost all industrial equipment uses handshake pins.
MODBUS and PROFIBUS are widely used in industry. They don't use handshake pins.
Please give examples of serial industrial busses that use handshake pins.

Klaus
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,586
Helped
4,781
Reputation
9,579
Reaction score
4,560
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
124,317
Well said Klaus!

The same wrong information is being repeated by people who will not read our replies.

Brian.
 

c_mitra

Advanced Member level 5
Joined
Nov 13, 2012
Messages
3,518
Helped
874
Reputation
1,750
Reaction score
843
Trophy points
1,393
Activity points
27,265
It is an UART signal (not directly related to RS232), but surely it is no "pin".
RS232 does not include "validity checks".
Many people are not understanding the subtle differences (between the UART and RS232). It is not really their faults, even the Wikipedia article does not fully describe the DB25 signal pins as it was originally designed. The same is true about the voltage levels: originally it was intended to be +/-25V, IBM in the first PC used +/- 12V (I think -12V supply in the IBM PC power supply is only used for this purpose but I may be mistaken) and then using the DE9 connector.

Original RS232 had a secondary or standby channel but it has been completely forgotten. But my memory may be rusted.
--- Updated ---

I think the major problem comes from calling the 3-wire serial communication ports as RS232 ports.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top