Bluetooth low energy interface tws earbuds for running
Bluetooth low energy interface tws earbuds for running
3-wire UART
The 3-wire UART is a bit more complicated than the UART described earlier, in that it does away with the hardware flow control lines in its design, but takes some bit errors into account. If the link between your host and controller exceeds a few millimeters, and they are in a noisy electrical environment, then using a 3-wire UART is perfect. <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a>
For the 3-wire UART operating mode, it uses the channel to identify different packets, which is somewhat similar to the previously described UART division of packet types. Channel number 0x1 identifies commands, 0x2 identifies data, and 0x4 identifies events. In addition, the 3-wire UART defines two additional channels for link establishment and acknowledgement: 0xF for link establishment and 0x0 for acknowledgement. Note that in a 3-wire UART, the channel number is only 4 bits long. <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a>
3-wire UART mainly has 3 modes: port link establishment port active state port low voltage state
The link establishment channel is used to confirm the operation mode, configuration parameters and automatic detection of the baud rate of the peer device. To achieve automatic baud rate detection, the method used is to select different baud rates in turn to send link establishment information, and then determine which baud rate has received the response from the peer device. The three-way handshake protocol is used to establish the link between the two devices. In the process of link establishment, the size of the reliable sliding window, whether to use cyclic redundancy check (CRC) and whether to use frame error software flow control are also set. <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a> <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a>
Data transmission in the active state is reliable. All data packets are encapsulated into frames, and each frame has a sequence number (sequencenumber) and an acknowledgement number (acknowledgementnumber). These numbers are all 3 bits long, and they enable simultaneous transmission of multiple data packets. This feature is quite useful for fast UARTs.
When the data packet is divided into frames, it follows the SLIP (Serial Line IP Protocol) protocol, which is defined in RFC1055. SLIP stipulates that each frame uses 0xC0 (one byte) as the start mark and end mark. If OxC0 appears in a data packet, use 0xDB0xDC (two bytes) instead. Since 0xDB is an escape sequence, it also needs to be converted to 0xDB0xDD (two bytes). If framing software flow control is used, the XON and XOFF bytes also need to be converted to 0xDB0xDE and 0xDB0xDF, respectively. The header of each frame consists of the length of the packet and the header checksum. The header checksum is used to confirm whether the header information is correct or not. If it is not correct, then refuse to receive the entire data packet; according to the retransmission mechanism, the peer device will automatically retransmit the data packet. The maximum number of bytes of the payload is 4095 and is checked using CRC (Cyclic Redundancy Check). The 3-wire UART uses a 16-bit CRC-CCITT (generating polynomial) algorithm, which is exactly the same as the 16-bit CRC CCITT used by classic Bluetooth baseband packets. In addition, if the CRC check of a data packet fails, then the data packet is ignored, and the peer device will resend the entire data packet. <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a> <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a>
The connection state can be switched to the low power mode by sending sleep information. In this mode, the UART is normally off, and the transmitted data packet cannot be guaranteed to be received in its entirety. If there is a data packet to send, it takes some time to wait for the peer device to wake up the UART hardware. In order to implement an efficient wake-up mechanism, before sending HCI information to the peer device, a short period of wake-up information is first sent to it. Once the other party replies to the waken message, it will switch to the active state. At this point, the device can send any data packet. If a device only has a UART interface, and this UART interface does not provide robustness against errors, then using a 3-wire UART is the right choice.
<a style="opacity:0.0;color:#ffffff">tws earbuds for running</a> <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a> <a style="opacity:0.0;color:#ffffff">tws earbuds for running</a>