Single-wire communication protocol for multi-chip cascade
By adopting a single-line communication protocol in a multi-chip system, using the data structures of prologue bytes, header bytes, chip ID bytes, data bytes and check bytes, combined with CRC checksum clock cycle detection, multi-chip is solved The complex wiring and insufficient communication speed in the system achieve efficient chip control and simplified PCB wiring.
Patent Information
- Application Number
- CN202411020691.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-22
AI Technical Summary
The existing communication interfaces have problems such as complex wiring, insufficient communication speed and limited number of devices in multi-chip systems, especially in scenarios where high-speed communication and simplified PCB wiring are required.
A single-line communication protocol is proposed to realize the multi-chip cascade of controllers through the data structure of prologue bytes, header bytes, chip ID bytes, data bytes and check bytes, combined with CRC checksum clock cycle detection. Efficient control and numbering of the structure reduces the number of signal lines and improves data transmission accuracy.
Reliable control of large-scale chips and high-speed data transmission are realized, the connection between chips and systems is simplified, the complexity of PCB wiring is reduced, and the data accuracy is improved through CRC verification.
Smart Images

Figure CN119003425A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of communication protocols, and in particular relates to a single-line communication protocol for multi-chip cascading. Background Art
[0002] Communication interfaces are widely used in semiconductor chips to achieve communication between controllers and chips. Common interfaces include I2C interface and SPI interface. The I2C interface consists of two lines, SDA and SCL. Its advantage is that the circuit is simple, but its disadvantage is that its bus structure makes the wiring complicated. At the same time, a controller can only connect up to 127 devices, which is not applicable in scenarios with more devices. The SPI interface consists of 4 lines: CLK, CS, DIN, and DOUT. The advantage of the SPI interface is that the communication speed is fast, but the controller requires more lines. Each controlled chip requires 4 signal lines. There are too many signal lines and the PCB routing is complicated.
[0003] With the development of technology, in some systems, there may be hundreds or thousands of chips of the same type. How to adopt a suitable communication protocol to achieve high-speed communication is a big difficulty. At the same time, due to the large number of chips, how to make PCB wiring easier, reduce PCB jumpers or reduce the number of PCB layers required by the system is also a relatively big challenge. Summary of the invention
[0004] In view of the above problems, the present invention proposes a communication protocol for multi-chip cascading, through which the controller can easily and independently control any selected chip or multiple chips in the cascade structure, which has a positive effect on the field of multi-chip control.
[0005] The technical solution of the present invention is:
[0006] A single-line communication protocol for multi-chip cascading. The controlled chips based on the single-line communication protocol have two interfaces: an input interface and an output interface. The input interface of each controlled chip is connected to the output interface of the previous controlled chip, and the input interface of the first controlled chip is connected to the controller. The communication method of the multi-chip cascade structure is:
[0007] The controller sends a control command which is passed in turn in each level of controlled chip. The controlled chip determines whether the current control command is related to itself by analyzing the control command. The header of the control command has a preamble byte. For each control command sent by the controller, the controlled chip needs to detect the preamble byte and obtain the communication rate, and then parse the current control command based on the obtained communication rate. Each control command has a CRC check, and only the control command with a correct CRC check will be executed.
[0008] Furthermore, the preamble byte includes start and end flag bits, and 8 valid data bits located between the start and end flag bits. The width of the high and low levels of the valid data bits is detected by the internal clock of the chip and it is checked whether the width of each bit is consistent. The total number of clocks for the entire preamble data byte obtained by counting the number of clocks is defined as N, then the number of clocks for each bit is N / 9, and the communication rate is obtained as 1 / (N / 9)*clk_cycle, where clk_cycle is the clock cycle.
[0009] Furthermore, the control command includes, in addition to the preamble byte, a header byte, a chip ID byte, a data byte, and a check byte in sequence; and the effective data bits of each data structure are 8 bits, wherein the data byte is an integer multiple of 8 bits according to the command type.
[0010] Furthermore, when controlling a multi-chip cascade structure, all connected controlled chips need to be numbered through initialization. Specifically, after parsing the control command, the current control command is obtained from the header byte to set the chip ID. The first controlled chip receives the value in the chip ID byte in the current control command to number itself, and then adds 1 to the value in the chip ID byte and sends it to the next controlled chip. And so on to achieve numbering of all controlled chips.
[0011] The beneficial effects of the present invention are: the present invention can realize reliable control of a large number of chips, and the online load is small, and high-speed data transmission can be realized, and with CRC verification, the accuracy of the data is greatly improved; at the same time, the system chip and controller based on this communication protocol, the connection between chips is simple, and board-level wiring is particularly easy. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a schematic diagram of the system relationship based on the single-line protocol;
[0013] Figure 2 It is a timing diagram of a single-line signal line;
[0014] Figure 3 This is a command timing diagram for setting the chip ID;
[0015] Figure 4 Schematic diagram of command timing for broadcast configuration of all chips;
[0016] Figure 5 Command timing diagram for the selected chip configuration;
[0017] Figure 6 This is a command timing diagram for multi-chip operations. DETAILED DESCRIPTION
[0018] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings.
[0019] like Figure 1 As shown, the communication protocol proposed in the present invention is a single-wire system. The main controller only needs one TX output line to control hundreds or thousands of chips. Each controlled chip has two signal PIN pins: RX / TX. RX is a single-wire digital input interface, and TX is the output interface obtained by the chip based on the input recovery. For the first chip, its RX is connected to the TX of the controller. Through this cascade structure, the output TX of the controller and the output TX of each chip only need to drive one chip. In order to ensure that the chip receives accurate data, the protocol has a CRC check, and only commands with correct CRC check will be executed correctly.
[0020] During the initialization phase, the controller sends a command to set chip ID to number all the chips in the series. After the numbering is completed, one or more chips can be selected and controlled through the protocol to achieve convenient and high-speed control.
[0021] like Figure 2 As shown, this protocol consists of the following data structures ( Figure 2 In the example, 10 bits are used as the minimum data group: PREA (preamble byte), HEAD_BYTE (header byte), CHIP_ID (chip ID byte), DATA (data byte), CRC (check byte). The effective data bits of each data structure are 8 bits. The data byte can be an integer multiple of 8 bits according to the command type.
[0022] Taking PREA as an example, after removing the two flag bits START and STOP, there are 8 valid data bits left, that is, 0x55. The protocol uses PREA to detect the communication rate. There is a high-speed on-chip oscillator clock inside the chip. The internal clock of the chip is used to detect the width of the high and low levels of the data bits and verify whether the width of each bit is consistent. By counting the number of clocks, the total number of clocks for the entire preamble data byte can be obtained as N, and the number of clocks for each bit is N / 9 (excluding the number of high and low levels of 0x55 after removing the end bit STOP). The communication rate is obtained as: 1 / (N / 9)*clk_cycle. The chip will parse subsequent commands according to this communication rate until the current command ends. Before the next command starts, the chip needs to detect the new preamble again and obtain the new communication rate before it can start parsing the next new command.
[0023] Different command types can be defined through HEAD_BYTE. Different command types may have different IDs and DATA numbers to be transmitted. The structure of each command ends with a CRC check byte. Table 1 shows several commonly used command structures.
[0024] Table 1: Command structure
[0025]
[0026] Take the command to set chip ID as an example, its timing is as follows Figure 3 As shown in the figure: HB1 is set as the HEAD_BYTE for setting the chip ID. After the first chip receives HB1, it knows that the command is to set the chip ID. It will receive the ID 01 after HB1 as its own number. After the first chip receives 01, it will connect the value of 01+1, that is, 02, to the second chip through TX and the next level RX. Repeat the corresponding process. After all chips receive this command, they will save the received ID number into the chip. In this way, each chip can obtain its own chip ID.
[0027] The broadcast command can configure all chips, defining HB2 as the HEAD_BYTE of the broadcast command. After receiving HB2, all chips will receive the following DATA to the corresponding storage address of the chip. Figure 4 For its command timing.
[0028] After setting the chip ID, you can select different chips for independent operation. You can operate a single chip or multiple chips. The timing of the operation of a single selected chip is as follows Figure 5 As shown. The single-chip operation command defines HB3 as the HEAD_BYTE for the selected chip operation. When the chip receives HB3 of the command, it knows that the command is a single-chip operation. When the command is transmitted to each chip, the chip will automatically match its internal number with the ID in the command; if the match is successful, it is the chip selected by the command, and the chip will temporarily store the data internally and then check whether the CRC is correct. If it is correct, it means that the received data DATA and the following data are correct, and the chip will execute the instruction. After the CRC check is completed, this command ends.
[0029] Multi-chip operation command: define HB4 as the HEAD_BYTE of the multi-chip continuous operation command. The timing of the multi-chip continuous operation command is as follows Figure 6 The ID in the ID byte of this command indicates the first chip selected by this command, and NUM indicates that data needs to be sent to NUM chips after this ID, that is, the number of the last chip is ID+NUM. ID Indicates that this data is configured for the ID chip, DATA ID+1 Indicates that this data is sent to the chip with ID+1, DATA ID+2Indicates that this data is sent to the chip ID+2, and is sent to the chip ID+NUM. Each chip that receives the data will check whether the final CRC is correct. If it is not correct, it will not actually retain the data corresponding to itself. At the same time, the chip has a built-in indication register for the selected chip. After receiving HB4 and ID after the first chip, this indication register is set to the value of the ID in the received command, and then when receiving DATA ID After completion, this data DATA ID After temporary storage, the indication register will be +1 accordingly, indicating that the next data will be assigned to chip ID+1. Each chip will only receive data corresponding to when the indication register is equal to its own ID. Each chip completes this command after the CRC check is successful. If the CRC is successful, the temporarily stored DATA will be written into the corresponding internal register.
[0030] Through the above protocol, the external controller can use the chip ID to facilitate independent operation on a chip, or select multiple chips to operate together. In addition, this protocol has CRC check, which greatly improves the accuracy of the data.
Claims
1. A single-line communication protocol for multi-chip cascading, characterized in that: The controlled chips based on the single-line communication protocol have two interfaces: input interface and output interface. The input interface of each controlled chip is connected to the output interface of the previous controlled chip, and the input interface of the first controlled chip is connected to the controller; the communication mode of the multi-chip cascade structure is: The controller sends a control command which is passed in turn in each level of controlled chip. The controlled chip determines whether the current control command is related to itself by analyzing the control command. The header of the control command has a preamble byte. For each control command sent by the controller, the controlled chip needs to detect the preamble byte and obtain the communication rate, and then parse the current control command based on the obtained communication rate. Each control command has a CRC check, and only the control command with a correct CRC check will be executed.
2. A single-line communication protocol for multi-chip cascading according to claim 1, characterized in that: The preamble byte includes start and end flag bits, and 8 valid data bits between the start and end flag bits. The width of the high and low levels of the valid data bits is detected by the internal clock of the chip and it is checked whether the width of each bit is consistent. The total number of clocks for the entire preamble data byte obtained by counting the number of clocks is defined as N, then the number of clocks for each bit is N / 9, and the communication rate is obtained as 1 / (N / 9)*clk_cycle, where clk_cycle is the clock cycle.
3. A single-line communication protocol for multi-chip cascading according to claim 2, characterized in that: In addition to the preamble byte, the control command also includes a header byte, a chip ID byte, a data byte, and a check byte in sequence; and the effective data bit of each data structure is 8 bits, wherein the data byte is an integer multiple of 8 bits according to the command type.
4. A single-line communication protocol for multi-chip cascading according to claim 3, characterized in that: When controlling a multi-chip cascade structure, all connected controlled chips need to be numbered through initialization. Specifically, after parsing the control command, the current control command is obtained from the header byte to set the chip ID. The first controlled chip receives the value in the chip ID byte in the current control command to number itself, and then adds 1 to the value in the chip ID byte and sends it to the next controlled chip. And so on to implement numbering of all controlled chips.
