当前位置:网站首页>[communication protocol] UART, I2C, SPI review

[communication protocol] UART, I2C, SPI review

2022-06-10 10:51:00 Madaha 23

Tips : When the article is finished , Directories can be generated automatically , How to generate it, please refer to the help document on the right

Catalog

Preface : Communication basis

One 、UART(Universal Asynchronous Receiver/Transmitter)

Two 、I2C

3、 ... and .SPI

summary


Preface : Communication basis

Before understanding the communication protocol , First of all, we need to understand the basics of communication

        1. Parallel and serial

                Parallel communication : Multi track data cable , Transfer data side by side , There's a lot of interference , Take up more resources

                serial communication : A data cable , One bit One bit Send data , Little interference , Less resources

        2. Simplex and duplex

                Simplex : One way transmission of data , The transmission direction cannot be changed

                Duplex :1. Half duplex : Both sides of communication can transmit data to each other , But it cannot be transmitted at the same time ( Do not send and receive at the same time )

                            2. full duplex : Both sides of communication can transmit data to each other at the same time ( Send and receive at the same time )

        3. Baud rate (bit per second)

                Serial communication rate , Company bps, That is... Transmitted per second bit digit

         4. Synchronous and asynchronous

                asynchronous communication : The clocks of communication parties are not synchronized , Generally, data is transmitted according to character frame (5-8 position ) Send data in bits , Low efficiency , For low-speed communication

                Synchronous communication : Communication dual engine clock synchronization , According to the beat of the clock , Send in block bits , More efficient , The structure is more complicated , For high-speed communication

Tips : The following is the main body of this article , The following cases can be used for reference

One 、UART(Universal Asynchronous Receiver/Transmitter)

        1. Interface mode : Half duplex / full duplex asynchronous communication , Single double three wire

        2. Communication process : The bus is idle , At high level

                              Communication begins : Send data in character frame format , Start low and then start high

                              Character frame :1bit Start bit +5~8bit Data bits +1bit Parity bit ( not essential )+1bit or 2bit Stop bit

                                              Start bit : Pull the bus down , On behalf of communication start

                                              Stop bit : Pull the bus up , Represents the end of the communication  

        3. characteristic : The electrical interface is not unified , Poor anti-interference ability , Short communication distance

        4.RS232 And RS485 standard

            annotation :RS232 And RS485 It's just a rule UART Electrical interface standard of , It hasn't changed UART Sending and receiving timing

             RS232:

                Electrical protocol : Logic “1”:-5~-15V, Logic “0”:+5~+15V

                Interface :DB-9( The actual time is three wire system :RXD,TXD,GND), full duplex

                 characteristic : Short transmission distance 15m, High level value is easy to burn out the circuit , Prone to common mode interference , Poor anti noise ability

             RS485:

                 Electrical protocol :  Logic “1”:2~ 6V, Logic “0”:-2~-6V , Differential line signal transmission ( That is, the voltage difference between the two lines 0/1)

                Interface : Two wire system , Bus topology , Half duplex

                characteristic : Allows the bus to connect multiple transceivers , Form similar I2C Device network

                            Anti noise , Long transmission distance 1500m

        

                

Two 、I2C

        1. Interface mode : Half duplex , Sync , Two wire system (SDA,SCLK)

        2. Communication process : The host sends the start signal ,

                              Host send 7bit Slave address +1bit Transmission relation bit of

                              The addressed slave sends ACK Reply back to the host

                              The transmitter sends a byte of data

                              The receiver accepts data , And send the ACK The reply

                               ....

                              When the communication is complete , The host sends a stop signal

                    Idle :SDA,SCLK pull up

                    Start signal : The host initiates ,SCLK At high level ,SDA From high to low

                    Byte transfer : First high then low

                     ACK The reply : Every time a byte is transferred , The receiver sends to 1bit The answer signal of It's a frame 9bit

                      The data transfer :SCLK During low level , The transmitter is SDA send out 1bit data , period SDA Allowable change

                                        SCLK During high level , The receiver is in SDA Read 1bit data , period SDA No change is allowed

                      Stop signal : The host initiates ,SCLK During high level ,SDA From low to high

                        

              3. characteristic : Low communication distance , Low transmission rate , Can mount multiple devices , Multi host bus , With anti-collision detection , Arbitration function

             

3、 ... and .SPI

        1. Interface mode : Full duplex synchronization ,

                                 At least four wires (SCLK,MOSI(Maste Ouput Slave Input),MISO,CS(Chip Slect))

        2. Communication process :

                1. Addressing : The host sends to the transmitter CS The signal

                2. The data transfer : Byte transmission , First pass the high position, then the position

                3. No response signal is required , Start the next byte transfer directly

                4. Sending data : At the edge of the clock line , send data

                5. Receive data : Next edge , The receiver reads data

        


summary

Tips : Here is a summary of the article :
for example : That's what we're going to talk about today , This article only briefly introduces pandas Use , and pandas Provides a large number of functions and methods that enable us to process data quickly and conveniently .

原网站

版权声明
本文为[Madaha 23]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101025416704.html