BLE Modules Interfaces (UART/SPI/ IIC): What’s the Difference?
What are the uart/iic/spi interfaces of Bluetooth module? What’s the difference? To understand these, we must first understand the parallel interface and serial interface of data transmission.
|Parallel interface||serial interface|
|definition||Parallel interface is the parallel port that transmits data in parallel, and the data is transmitted through the parallel line, so the data transmission speed can be improved, but the length of the parallel transmission line is easily limited, because the length increases, the interference will increase, and the data will be easy to make mistakes.||Parallel interface is what we often call serial port, which means that data is transmitted bit by bit on a limited number of IOS in sequence. There are many such interfaces, generally including UART, IIC, SPI, can, USB (most interfaces of Bluetooth module), etc. as long as the interface is serial transmission, it is a kind of serial port. It is worth mentioning that in the early days, people used to call UART port serial port, so when we say serial port, we generally refer to UART interface. Bluetooth module interfaces are mostly serial interfaces|
|advantage||Less data lines are used, which can save communication costs in long-distance communication.||Because multiple bits of data can be transmitted together, the transmission speed is very fast|
|shortcoming||Because only one bit of data can be transmitted at a time, the transmission speed is relatively low.||There are as many data lines as there are bits in the memory, so a large number of data lines are required and the cost is very high.|
UART / spi / IIC differences
UART（Universal Asynchronous Receiver/Transmitter）interface
That is, universal asynchronous transceiver, serial interface is the most commonly used communication technology of single chip microcomputer, which is usually used for the communication between single chip microcomputer and computer, and between single chip microcomputer and single chip microcomputer
SPI(Serial Peripheral Interface) interface
SPI is a serial peripheral interface, a synchronous serial data transmission standard, and a high-speed, full duplex, synchronous communication bus, which is widely used in many devices.
IIC integrated circuit bus, also known as I2C, is a two-wire serial bus structure, which is used to connect microcontrollers and their peripheral devices. The main advantages of IIC bus are simplicity and effectiveness.
- Difference 1. UART is two lines, one sending and one receiving. It can communicate in full duplex, and the number of lines is relatively small. The data is transmitted asynchronously, so the timing requirements of both sides are relatively strict, and the communication speed is not very fast. It is most used in multi-computer communication.
- Difference 2. Compared with UART above, SPI interface has an additional synchronization clock line. The disadvantage of UART above is its advantage. The timing requirements of communication parties are not strict. Different devices can be easily combined, and the communication speed is very fast. It is generally used for high-speed data communication between internal components of products, such as large capacity memory.
- Difference 3. IIC interface is also a two-wire interface. It transmits data between two wires through complex logical relationships. The communication speed is not high, and the program is relatively complex.
Note: SPI and UART can achieve full duplex, but I2C cannot; The speed of I2C is a little slower than SPI, and the protocol is a little more complex than SPI, but the connection is also less than standard SPI.