COM Port vs GPIO Header a Compression

Veröffentlicht am Autor JonasHinterlasse einen Kommentar

COM port and GPIO header Compression

Compression

COM ports are mostly used to connect to a controller/device and then use the integrated functions of this device.

GPIO Header are used to connect direct to sensors or to send directly the control signals.

Protocols like I2C,SPI or UART have own dedicated pins on a GPIO header. On COM port connections, the communication runs over the RXC and TRX pins.

This means directly I2C communication over a COM port is not feasible due to the different nature of the protocols. However, you can bridge I2C communication to a COM port using an intermediary device or software that translates between the two protocols. This approach allows you to interface I2C devices with a host computer using a COM port.

In theorie, a COM port can process higher baud rates than a Raspberry Pi GPIO header (115.200 should be enough any way.). How high the baud rate of the COM port connected device is, is depending on the devices that connect over the cable.

COM port that use the RS232 standard have voltage ranges from 3+/- to 15+/- volts. Often are 12 volts used. The Raspberry Pi 3.3 or 5 volts. Because of higher voltage and special shielded cables, COM port cable can be a lot longer. (Not a complete fitting compression, but think about the VGA cable of the past.)

VGA Cable has also a DSub Connector
A VGA Cable also has a DSub Connector.

COM ports/ Serial Connections

COM ports, or Communication Ports, operate on the principle of serial communication, where data is transmitted one bit at a time. This method allows for straightforward data transfer between a computer and peripheral devices. The RS-232 standard defines the electrical characteristics and signal timing for serial communication via COM ports. This contrasts with parallel communication, where multiple bits are sent simultaneously over multiple channels.

The communication can be Synchronous or asynchronous.

Asynchronous

Data transmission is happening without a synchronized clock signal. Instead, start and stop bits are used to signal the beginning and end of a transmission. This method is more flexible and commonly used in applications like RS-232 and UART.

Synchronous

Data transmission is done synchronized, with a clock signal, allowing for higher data rates and more precise timing. This method is used in protocols like SPI (Serial Peripheral Interface) and I2C (Inter-Integrated Circuit).

In the past, COM ports (Communication Ports) were extensively used for serial communication between computers and a variety of peripheral devices: Mice, Joysticks, Keyboards and so on.

COM ports are nowadays predominantly used in industrial automation. For example, are PLCs and CNC machines often connected over COM connectors. A lot of newly produced medical equipment still uses COM connectors, one example are ultrasonic devices which can see in almost every doctor’s office.

One area where these connectors are wildly used are electronic hardware tester and developing companies, they control their test equipment over the COM port or directly use the pins to interface to the devices which are getting tested.

Software

For COM port a lot of software exists since 20 years and longer, some of the software is not replaceable anymore since the source code was getting lost or the programmer how developed the program was getting retired. That said, still every day people use mostly C++, C# or Python to write and read from the COM ports.

An Industrial PC on AliExpress.
Industrial PC

Most of the time D-Sub9 connectors are used nowadays.

D-Sub9 Pinout:

RXD and TXD are the most import one for the communication.

TX (Transmit): Pin used to send data.
RX (Receive): Pin used to receive data.

Additional Pins: May include RTS (Request to Send), CTS (Clear to Send), DTR (Data Terminal Ready), and DSR (Data Set Ready) for flow control and handshaking.

To do a handshake in a situation where the loop back is bypassed, connect CTS to RTS and DTR to DSR. On this example, you see it is a complete and mature system.

Pinout:

1: Data Carrier Detect (DCD)
2: Receive Data (RXD)
3: Transmit Data (TXD)
4: Data Terminal Ready (DTR)
5: Ground (GND)
6: Data Set Ready (DSR)
7: Request to Send (RTS)
8: Clear to Send (CTS)
9: Ring Indicator (RI)

 

Raspberry Pi GPIO

GPIO stands for General-Purpose Input/Output. It refers to digital pins on a microcontroller or computer that can be configured as either inputs or outputs. GPIO pins are versatile and used for various functions in electronics and computing:

Input Mode

In this mode, a GPIO pin can read signals from external devices. For example, it can be used to read the status of a button, switch, or sensor. The pin detects whether the voltage level is high or low.

Output Mode

In this mode, a GPIO pin can send signals to external devices. For instance, it can be used to turn on an LED, control a relay, or send data to other hardware components.

You can compare the GPIO pins with the COM port pins TXD (Transmit Data) and RXD (Receive Data). You can set a GPIO pin via software to transmit or receive.

Hobbyists experiment with electronics, educators teach electronics and programming, engineers develop prototypes and IoT solutions, and makers build custom gadgets and automation systems.

Some RaspberryPi’s are used in industrial applications, often without the use of the full GPIO layout.

Some GPIO pins can be used for digital signals, others may also support analog functions, such as ADC (Analog-to-Digital Converter) or DAC (Digital-to-Analog Converter).

Not all pins on the „GPIO Header“ are GPIO pins.

Additional to the GPIO functionality, some pins serve specific purposes such as providing power (3.3V or 5V), ground connections, or supporting various communication protocols like I2C, SPI, UART, JTAG,PWM,GPCLK.

Pinout:

1: 3.3V
2: 5V
3: I2C SDA (GPIO 2)
4: 5V
5: I2C SCL (GPIO 3)
6: Ground (GND)
7: GPIO 4 (GPCLK0)
8: UART TXD (GPIO 14)
9: Ground (GND)
10: UART RXD (GPIO 15)
11: GPIO 17 (JTAG TDI)
12: GPIO 18 (PCM_CLK)
13: GPIO 27 (JTAG TMS)
14: Ground (GND)
15: GPIO 22 (JTAG TRST)
16: GPIO 23
17: 3.3V
18: GPIO 24
19: SPI MOSI (GPIO 10)
20: Ground (GND)
21: SPI MISO (GPIO 9)
22: GPIO 25
23: SPI SCLK (GPIO 11)
24: SPI CE0 (GPIO 8)
25: Ground (GND)
26: SPI CE1 (GPIO 7)
27: I2C SDA (ID EEPROM) (GPIO 0)
28: I2C SCL (ID EEPROM) (GPIO 1)
29: GPIO 5
30: Ground (GND)
31: GPIO 6
32: GPIO 12 (PWM0)
33: GPIO 13 (PWM1)
34: Ground (GND)
35: GPIO 19 (PCM_FS)
36: GPIO 16 (JTAG TCK)
37: GPIO 26
38: GPIO 20 (PCM_DIN)
39: Ground (GND)
40: GPIO 21 (PCM_DOUT) (JTAG TDO)

I2C Connection on a Pine64 A64
I2C Connection on a „GPIO header“.

Set Up the GPIO on a Pine64 A64

 



Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert