Bus communication system and method, electronic equipment and storage medium
By introducing a signal conversion module into the bus communication system for arbitration processing, multiple bus controllers are allowed to share a bus transceiver, which solves the problem of pin resources and cost when adding bus controllers, and realizes the multiplexing and reuse of bus transceivers. Resource conservation.
Patent Information
- Application Number
- CN202411161458.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-10-11
AI Technical Summary
In a bus communication system, adding a bus controller requires adding a bus transceiver, resulting in an increase in pin resource occupation and equipment cost.
By introducing a signal conversion module between the bus controller and the bus transceiver, arbitration processing between multiple bus controllers is achieved, allowing multiple bus controllers to share a bus transceiver, ensuring that only one bus controller is operating at any given time. Time is occupied by the bus transceiver for service data transmission.
It effectively saves pin resources in computer equipment, reduces equipment costs, ensures the reuse of bus transceivers, and avoids unnecessary waste of resources.
Smart Images

Figure CN118764336A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication buses, and in particular to a bus communication system, method, electronic equipment and storage medium. Background Art
[0002] A bus is a public communication trunk for transmitting information between various functional components of a computer. For example, the CAN bus (Controller Area Network) is a common serial communication protocol bus used for real-time applications.
[0003] In the related art, if a computer component such as a processor needs to communicate through a bus, it needs to be connected to the bus through a bus controller and a bus transceiver, and communicate with other components through the bus controller and the bus transceiver. Among them, the bus controller and the bus transceiver always correspond one to one, which means that if a bus controller is added, a bus transceiver must be added accordingly to cooperate, which not only easily occupies a large number of pin resources in the computer equipment, but also greatly increases the cost of the equipment. Summary of the invention
[0004] The object of the present invention is to provide a bus communication system, method, electronic device and storage medium, which can multiplex bus transceivers, thereby saving pin resources and reducing equipment costs.
[0005] In order to solve the above technical problems, the present invention provides a bus communication system, comprising: a bus controller, a signal conversion module and a bus transceiver, wherein the bus controller is multiple, each of the bus controllers is connected to the signal conversion module, the signal conversion module is connected to the bus transceiver, and the bus transceiver is connected to the bus;
[0006] The bus controller is used to send an arbitration signal to the signal conversion module, monitor the arbitration result returned by the signal conversion module, send service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and quit sending service data when it is determined that its own arbitration fails according to the arbitration result;
[0007] The signal conversion module is used to perform arbitration processing on all the arbitration signals to obtain the arbitration result, return the arbitration result to each bus controller, and send the service data sent by the bus controller to the bus transceiver;
[0008] The bus transceiver is used to send the service data to the bus.
[0009] Optionally, the signal conversion module includes a calculation unit and a signal line branch circuit, the signal sending pin of each bus controller is connected to the first signal sending pin of the calculation unit, the second signal sending pin of the calculation unit is connected to the signal sending pin of the bus transceiver, and the signal receiving pin of each bus controller is connected to the signal receiving pin of the bus transceiver through the signal line branch circuit;
[0010] The calculation unit is used to perform an AND operation on all the arbitration signals to obtain an arbitration result signal, and send the arbitration result signal to the bus transceiver;
[0011] The bus transceiver is used to send the arbitration result signal to the bus and send a bus level signal to each of the bus controllers;
[0012] The bus controller is used to determine the arbitration result according to the bus level signal.
[0013] Optionally, the signal conversion module further includes a register, wherein the register is used to store a register value corresponding to each of the bus controllers, and the signal conversion module selects the signal line of each of the bus controllers according to the register value.
[0014] The present invention also provides a bus communication method, which is applied to the bus communication system as described above, and the method comprises:
[0015] The plurality of bus controllers send arbitration signals to the signal conversion module;
[0016] The signal conversion module performs arbitration processing on all the arbitration signals to obtain arbitration results, and sends the arbitration results to each of the bus controllers;
[0017] Each of the bus controllers monitors the arbitration result, sends service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and quits sending service data when it is determined that its own arbitration fails according to the arbitration result;
[0018] The signal conversion module sends the service data sent by the bus controller to the bus transceiver;
[0019] The bus transceiver sends the service data to the bus.
[0020] Optionally, it also includes:
[0021] The calculation unit in the signal conversion module performs an AND operation on all the arbitration signals to obtain an arbitration result signal, and sends the arbitration result signal to the bus transceiver;
[0022] The bus transceiver sends the arbitration result signal to the bus, and sends a bus level signal to the bus controller;
[0023] The bus controller determines the arbitration result according to the bus level signal.
[0024] Optionally, the bus controller sends an arbitration signal to the signal conversion module, including:
[0025] The bus controller sends its own controller identification number bit by bit to the signal conversion module;
[0026] The bus controller determines the arbitration result according to the bus level signal, including:
[0027] The bus controller determines whether the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal;
[0028] If the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal, determining whether all the bits in the controller identification number have been sent;
[0029] If all the digits in the controller identification number have not been sent, sending the next digit in the controller identification number to the signal conversion module;
[0030] If all bits in the controller identification number have been sent, it is determined that the self-arbitration is successful;
[0031] If the level corresponding to the number of bits of the controller identification number currently sent is different from the current level of the bus level signal, it is determined that the self-arbitration has failed.
[0032] Optionally, after the bus controller determines that its own arbitration fails according to the arbitration result, the method further includes:
[0033] Continuously sending a high level and monitoring the bus level signal;
[0034] When it is determined that the bus is idle according to the bus level signal, resending the arbitration signal to the signal conversion module;
[0035] When it is determined that the device is a data receiver according to the bus level signal, the service data sent by the data sender is received through the bus transceiver.
[0036] Optionally, it also includes:
[0037] The signal conversion module obtains register values corresponding to each bus controller according to its internal register, and selects the signal lines of each bus controller according to the register value.
[0038] The present invention also provides an electronic device, comprising: a bus and the bus communication system as described above.
[0039] Optionally, a plurality of the bus communication systems are connected to the same bus.
[0040] The present invention also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the bus communication method as described above is implemented.
[0041] The present invention provides a bus communication system, comprising: a bus controller, a signal conversion module and a bus transceiver, wherein there are multiple bus controllers, each of which is connected to the signal conversion module, the signal conversion module is connected to the bus transceiver, and the bus transceiver is connected to a bus; the bus controller is used to send an arbitration signal to the signal conversion module, monitor the arbitration result returned by the signal conversion module, send service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and exit the service data sending when it is determined that its own arbitration fails according to the arbitration result; the signal conversion module is used to perform arbitration processing on all the arbitration signals to obtain the arbitration result, return the arbitration result to each bus controller, and send the service data sent by the bus controller to the bus transceiver; the bus transceiver is used to send the service data to the bus.
[0042] It can be seen that the present invention can add a signal conversion module between the bus controller and the bus transceiver, and multiple bus controllers can send arbitration signals to the signal conversion module and monitor the arbitration results returned by the signal conversion module; and the signal conversion module can perform arbitration processing on all the arbitration signals to obtain the arbitration results, and return the arbitration results to each of the bus controllers. Furthermore, the bus controller can send service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration results, and exit the service data transmission when it is determined that its own arbitration fails according to the arbitration results; and the signal conversion module can send the service data sent by the bus controller to the bus transceiver, thereby realizing the multiplexing of the bus transceiver, thereby effectively saving the pin resources in the computer device, and effectively reducing the equipment cost. The present invention also provides a bus communication method, an electronic device and a computer-readable storage medium, which have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A structural block diagram of a bus communication system provided by an embodiment of the present invention;
[0045] Figure 2 A structural block diagram of another bus communication system provided by an embodiment of the present invention;
[0046] Figure 3 A flow chart of a bus communication method provided by an embodiment of the present invention;
[0047] Figure 4 A structural block diagram of a CAN bus communication system provided by an embodiment of the present invention;
[0048] Figure 5 The present invention is a flowchart of another bus communication method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The bus is a public communication trunk line for transmitting information between various functional components of a computer. For example, the CAN bus (Controller Area Network) is a common serial communication protocol bus used for real-time applications. In the related technology, if computer components such as processors need to communicate through the bus, they need to be connected to the bus through a bus controller and a bus transceiver, and communicate with other components through the bus controller and the bus transceiver. Among them, the bus controller and the bus transceiver always correspond one to one, which means that if a bus controller is added, a bus transceiver must be added accordingly to cooperate, which not only easily occupies a large number of pin resources in the computer equipment, but also greatly increases the cost of the equipment.
[0051] In view of this, the present invention can provide a bus communication system that can multiplex bus transceivers, so that when a bus controller is added, there is no need to add a matching bus transceiver, thereby saving pin resources and reducing equipment costs.
[0052] For easier understanding, please refer to Figure 1 , Figure 1 This is a structural block diagram of a bus communication system provided by an embodiment of the present invention. The system may include: a bus controller, a signal conversion module and a bus transceiver. There are multiple bus controllers, each of which is connected to the signal conversion module, the signal conversion module is connected to the bus transceiver, and the bus transceiver is connected to the bus. It should be noted that the embodiment of the present invention does not limit the total number of bus controllers, which can be set according to actual application requirements. In other words, in simple terms, multiple bus controllers share one bus transceiver. The embodiment of the present invention also does not limit the bus type, for example, it can be a CAN bus, and then the above-mentioned bus controller and bus transceiver can be a CAN bus controller (CAN Controller) and a CAN bus transceiver (CAN Transceiver). The embodiment of the present invention also does not limit how the signal conversion module is connected to the bus transceiver, for example, it can be connected through a GPIO interface (General-purpose input / output, general-purpose input and output interface). The following are the uses of the bus controller, signal conversion module and bus transceiver:
[0053] The bus controller is used to send an arbitration signal to the signal conversion module, monitor the arbitration result returned by the signal conversion module, send business data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and exit the business data sending when it is determined that its own arbitration fails according to the arbitration result.
[0054] The signal conversion module is used to perform arbitration processing on all the arbitration signals to obtain the arbitration result, return the arbitration result to each bus controller, and send the service data sent by the bus controller to the bus transceiver.
[0055] The bus transceiver is used to send the service data to the bus.
[0056] It should be noted that among multiple bus controllers, only one bus controller can occupy the bus transceiver for business data transmission at a time. Therefore, when multiple bus controllers initiate data transmission at the same time, these multiple bus controllers first need to perform arbitration operations to compete for the data sender of this round (that is, the bus controller that occupies the bus transceiver this time). In order to achieve the arbitration effect, the embodiment of the present invention can add a signal conversion module dedicated to the arbitration processing of the above-mentioned bus controller. Specifically, each bus controller can send an arbitration signal to the signal conversion module, and the signal conversion module can perform arbitration processing on all received arbitration signals to obtain an arbitration result, and then return the arbitration result to each of the bus controllers. And each bus controller can determine whether it has successfully arbitrated according to the arbitration result. If successful, it means that it has become a data sender, and then it can send business data to the bus transceiver through the signal conversion module, so that the bus transceiver sends business data to the bus; if unsuccessful, it means that the competition has failed, and then the business data can be withdrawn. Considering that the bus controller usually does not initiate data transmission all the time, the embodiment of the present invention can ensure that these multiple bus controllers use the bus transceiver in turn, so that the multiplexing of the bus transceiver can be achieved.
[0057] It should be noted that the arbitration signal in the embodiment of the present invention is a level sequence composed of a high level and a low level. The arbitration signal corresponds to the bus controller one-to-one, and different bus controllers send different arbitration signals. For this reason, an arbitration method can be adopted to compare the levels of all arbitration signals, perform bitwise AND operations (&) on all arbitration signals, and compare the levels of the AND operation results with all arbitration signals, or perform bitwise OR operations (||) on all arbitration signals and compare the levels of the OR operation results with all arbitration signals to arbitrate each bus controller, and uniquely determine the bus controller that sends the business data. The specific arbitration method can be set according to actual application requirements. It should be noted that the embodiment of the present invention does not limit the length of the above-mentioned level sequence, which can be set according to actual application requirements.
[0058] A possible arbitration method is introduced below, which may include the following steps:
[0059] 1. Each bus controller sends an arbitration signal to the signal conversion module bit by bit. For example, if the arbitration signal of a bus controller is 1011, it will send a recessive level (indicating a logical value of 1), a dominant level (indicating a logical value of 0), a recessive level, and a recessive level in sequence.
[0060] 2. The signal conversion module performs an AND operation on the received arbitration signals to obtain arbitration result signals, and returns the arbitration result signals to each bus controller.
[0061] For example, if bus controller 1 sends a recessive level and bus controller 2 sends a dominant level, the level of the arbitration result signal is a dominant level. If both bus controllers 1 and 2 send recessive levels, the level of the arbitration result signal is a recessive level. If both bus controllers 1 and 2 send dominant levels, the level of the arbitration result signal is a dominant level.
[0062] 3. The bus controller determines whether the level corresponding to the arbitration signal bit currently sent is the same as the current level of the bus level signal. If they are the same, it goes to step 4; if they are not the same, it goes to step 7.
[0063] 4. The bus controller determines whether all the bits in the controller identification number have been sent. If not, proceed to step 5; if sent, proceed to step 6.
[0064] 5. The bus controller sends the next bit of the controller identification number to the signal conversion module and returns to step 3.
[0065] 6. The bus controller determines that its arbitration is successful.
[0066] 7. The bus controller determines that its own arbitration has failed.
[0067] It can be seen that the above method arbitrates all arbitration signals by means of AND operation to obtain arbitration result signals, and the bus controller can determine whether it has successfully competed by comparing the arbitration result signal with its own arbitration signal. If the competition is successful, the bus controller obtains the right to use the bus transceiver.
[0068] Further, it should be pointed out that in a complex bus structure, in addition to the bus controller in the bus communication system, other bus controllers may also be provided in the bus. In addition, multiple bus communication systems as described in the embodiment of the present invention may also be provided in the bus. However, the bus can only be occupied by one bus controller at a time for business data transmission, so the right to use the bus also needs to be arbitrated. In order to realize the arbitration of the bus, the signal conversion module in the embodiment of the present invention can also further send the arbitration result signal to the bus transceiver, so that the bus transceiver can further send the arbitration result signal to the bus to participate in the bus arbitration. In order to obtain the bus arbitration result, the bus transceiver can return the bus level signal to the signal conversion module, and the signal conversion module can return the bus level signal to each bus controller in parallel. Furthermore, the bus controller can determine whether it has obtained the right to use the bus by comparing the bus level signal with its own arbitration signal.
[0069] Another form of bus communication system is introduced below. Figure 2 , Figure 2This is a structural block diagram of another bus communication system provided by an embodiment of the present invention. The signal conversion module includes a calculation unit and a signal line branch circuit. The signal sending pin (not shown) of each bus controller is connected to the first signal sending pin (not shown) of the calculation unit, the second signal sending pin (not shown) of the calculation unit is connected to the signal sending pin (not shown) of the bus transceiver, and the signal receiving pin (not shown) of each bus controller is connected to the signal receiving pin (not shown) of the bus transceiver through the signal line branch circuit. It should be pointed out that according to the function of the signal line, the signal line between the bus controller and the calculation unit is a signal sending line (TX line), and the signal is sent from the bus controller to the calculation unit; the signal line between the calculation unit and the bus transceiver is a signal sending line (TX line), and the signal is sent from the calculation unit to the bus transceiver; the signal line between the calculation unit and the bus controller (through the signal line branch circuit) is a signal receiving line (RX line), and the signal is sent from the bus transceiver to each bus controller. In other words, the calculation unit in the signal conversion module will process the signals sent by each bus controller and send the processed signals to the bus transceiver. The signal line branch circuit in the signal conversion module does not process the signal returned from the bus transceiver to the bus controller, but simply returns the signal to each bus controller in parallel. The following are the uses of the calculation unit and other uses of the bus transceiver and bus controller:
[0070] The calculation unit is used to perform an AND operation on all the arbitration signals to obtain an arbitration result signal, and send the arbitration result signal to the bus transceiver;
[0071] The bus transceiver is used to send the arbitration result signal to the bus and send a bus level signal to each of the bus controllers;
[0072] The bus controller is used to determine the arbitration result according to the bus level signal.
[0073] It can be seen that the calculation unit is used to perform an AND operation on the arbitration signals of each bus controller to obtain an arbitration result signal, and send the arbitration result signal to the bus transceiver. The bus transceiver can send the arbitration result signal to the bus to participate in the bus arbitration, as well as collect the bus level signal, and return the bus level signal to each bus controller through the signal line branch circuit in the signal conversion module. The bus controller can determine the arbitration result according to the bus level signal. Different from the above embodiment, the bus controllers in this system may all encounter arbitration failures and cannot obtain the right to use the bus transceiver and the bus. For example, the bus controllers in this system all send recessive levels, that is, the arbitration result signals sent by this system are recessive levels, and other bus controllers in the bus send dominant levels, which causes the bus level to be dominant, and then causes all bus controllers in this system to fail in arbitration. In this way, it can be ensured that in a complex bus structure, only one bus controller always occupies the bus for business data transmission to ensure the normal operation of the existing bus structure.
[0074] Further, the signal conversion module may also include a register (not shown in Figure 1 , 2 ), the register can be used to store the register value corresponding to each bus controller, and the signal conversion module selects the signal line of each bus controller according to the register value. In this way, each bus controller can be turned on or off according to actual needs, thereby improving the flexibility of the bus communication system.
[0075] Based on the above embodiments, the present invention can add a signal conversion module between the bus controller and the bus transceiver, and multiple bus controllers can send arbitration signals to the signal conversion module and monitor the arbitration results returned by the signal conversion module; and the signal conversion module can perform arbitration processing on all the arbitration signals to obtain the arbitration results, and return the arbitration results to each of the bus controllers. Furthermore, the bus controller can send service data to the bus transceiver through the signal conversion module when it determines that its arbitration is successful according to the arbitration results, and exit the service data transmission when it determines that its arbitration fails according to the arbitration results; and the signal conversion module can send the service data sent by the bus controller to the bus transceiver, thereby realizing the multiplexing of the bus transceiver, thereby effectively saving the pin resources in the computer equipment, and effectively reducing the equipment cost.
[0076] Based on the above system structure description, the bus communication method provided by the present invention is introduced below. Figure 3 , Figure 3 A flowchart of a bus communication method provided by an embodiment of the present invention, which is applied to the bus communication system as described above, may include:
[0077] S301. Multiple bus controllers send arbitration signals to a signal conversion module.
[0078] As described above, the arbitration signal in the embodiment of the present invention is a level sequence composed of a high level and a low level. The arbitration signal corresponds to the bus controller one by one, and different bus controllers send different arbitration signals. In order to ensure that the arbitration signal is unique, each bus controller can send its own controller identification number (ID) bit by bit.
[0079] S302: The signal conversion module performs arbitration processing on all the arbitration signals to obtain arbitration results, and sends the arbitration results to each bus controller.
[0080] In the embodiment of the present invention, the signal conversion module can perform arbitration processing on all arbitration signals, obtain arbitration results, and return the arbitration results to each bus controller. For example, the signal conversion module can perform AND operations on all arbitration signals, and return the results of the AND operations as arbitration results to each bus controller.
[0081] S303, each bus controller monitors the arbitration result, and sends service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and quits sending service data when it is determined that its own arbitration fails according to the arbitration result.
[0082] Each bus controller can determine whether it has successfully arbitrated based on the arbitration result. If successful, the bus controller can occupy the bus transceiver in the system to send business data; if unsuccessful, the bus controller needs to quit sending business data and wait for the bus transceiver to resume the idle state.
[0083] S304. The signal conversion module sends the service data sent by the bus controller to the bus transceiver.
[0084] S305: The bus transceiver sends the service data to the bus.
[0085] Based on the above embodiments, Figure 2 The bus communication system shown in the figure further introduces the bus communication method provided by the present invention. In a possible case, the method may also include:
[0086] S401. Multiple bus controllers send arbitration signals to a signal conversion module.
[0087] Specifically, each bus controller may send its own controller identification number (ID) to the signal conversion module bit by bit, so that the controller identification number is used as the arbitration signal.
[0088] Based on this, the bus controller sends an arbitration signal to the signal conversion module, which may include:
[0089] Step 11: The bus controller sends its own controller identification number bit by bit to the signal conversion module.
[0090] S402: The calculation unit in the signal conversion module performs an AND operation on all the arbitration signals to obtain an arbitration result signal, and sends the arbitration result signal to the bus transceiver.
[0091] In this step, in order to ensure that the bus controller in the system further participates in bus arbitration, the calculation unit in the signal conversion module can send the obtained arbitration result signal to the bus transceiver after performing AND operations on all arbitration signals, so that the bus transceiver sends the arbitration result signal to the bus to participate in bus arbitration.
[0092] S403: The bus transceiver sends the arbitration result signal to the bus, and sends a bus level signal to the bus controller.
[0093] In this step, while sending the arbitration result signal to the bus, the bus transceiver also collects the bus level signal in the bus and returns the latter to each bus controller so that the bus controller can determine the bus arbitration result.
[0094] S404, the bus controller determines the arbitration result according to the bus level signal, sends service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and exits the service data sending when it is determined that its own arbitration fails according to the arbitration result.
[0095] The specific steps of the bus controller determining its own arbitration result are introduced below. In one possible case, the bus controller determines the arbitration result according to the bus level signal, which may include:
[0096] Step 21: The bus controller determines whether the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal.
[0097] For example, if the number of bits in the current controller identification number is 0, the corresponding level is a dominant level; if the number of bits in the current controller identification number is 1, the corresponding level is a recessive level.
[0098] Step 22: If the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal, determine whether all the bits in the controller identification number have been sent.
[0099] Step 23: If all the digits in the controller identification number have not been sent, send the next digit in the controller identification number to the signal conversion module.
[0100] Step 24: If all bits in the controller identification number have been sent, it is determined that the self-arbitration is successful.
[0101] Step 25: If the level corresponding to the number of bits of the controller identification number currently sent is different from the current level of the bus level signal, it is determined that the self-arbitration has failed.
[0102] It is worth pointing out that, since the embodiment of the present invention can use the controller identification number as the arbitration number, the bus controller with a smaller controller identification number has a higher corresponding priority and is more likely to compete for the right to use the bus transceiver and the bus.
[0103] Furthermore, for the bus controller that fails in the competition, it can continuously send a high level (i.e., a recessive level) and enter a listening state. Among them, continuously sending a high level can ensure that the bus controller called the data sender does not affect the business data transmission. After entering the listening state, the bus controller can perform the following steps: 1. Determine whether the bus is idle according to the bus level signal returned by the bus transceiver. If the bus is determined to be idle, it can resend the arbitration signal to the signal conversion module to complete the unfinished business data transmission task; 2. Determine whether there are other bus controllers that initiate data transmission to itself according to the bus level signal returned by the bus transceiver, that is, determine whether it is called a data receiver. If it has become a data receiver, it can establish a handshake connection with the data sender through the bus transceiver and receive the business data sent by the data sender.
[0104] Based on this, after the bus controller determines that its own arbitration fails according to the arbitration result, the following method may also be included:
[0105] Step 31: Continue to send a high level and monitor the bus level signal.
[0106] It should be pointed out that the high level is the recessive level.
[0107] Step 32: When it is determined that the bus is idle according to the bus level signal, resending the arbitration signal to the signal conversion module;
[0108] Step 33: When determining that the device is a data receiver according to the bus level signal, receiving the service data sent by the data sender through the bus transceiver.
[0109] S405. The signal conversion module sends the service data sent by the bus controller to the bus transceiver.
[0110] S406: The bus transceiver sends the service data to the bus.
[0111] Based on the above embodiment, a register may also be provided in the signal conversion module, and the signal conversion module may obtain a register value corresponding to each bus controller according to the register inside the signal conversion module, and select the signal line of each bus controller according to the register value. In this way, each bus controller can be turned on or off according to actual needs, thereby improving the flexibility of the bus communication system.
[0112] Based on the above embodiment, the above bus communication method is fully introduced below based on specific examples. The present invention provides a multiplexing method for an external CAN transceiver of a SOC system (System On Chip). In the CAN bus protocol, when two nodes send signals to the bus at the same time, if one sends a dominant level (logic 0) and the other sends a recessive level (logic 1), the bus presents a dominant level.
[0113] Taking two CAN nodes in the SOC system as an example, the specific operation is as follows: the two CAN nodes inside the SOC correspond to two CAN controllers. When the two nodes need to be connected to the same CAN bus at the same time outside the SOC, or when only one CAN node needs to be connected to the bus each time (the other node is a standby node), the CAN_TX signals of the two controllers are subjected to a "wire and" operation in the signal conversion module, which is equivalent to an arbitration of the two nodes. At this time, the node with a smaller identification number (id) will obtain the right to send the bus, and the node with a larger identification number will exit the sending mode and enter the listening mode. The arbitration result is output to the CAN transceiver for level conversion, and then connected to the CAN bus. As for the CAN_RX signal of the two CAN nodes, it is directly connected to the RX signal input by the CAN transceiver. One side of the CAN transceiver is the connection of the CAN controller TX and RX signals, and the other side converts the logic signal into a differential level signal (CAN_high, CAN_low) and connects it to the external CAN bus. For the structure of the bus communication system, please refer to Figure 4 , Figure 4 A structural block diagram of a CAN bus communication system provided by an embodiment of the present invention.
[0114] A CAN bus transceiver multiplexing method in an implementation case of the present invention is as follows Figure 5 As shown, Figure 5 A flowchart of another bus communication method provided by an embodiment of the present invention, the method comprising the following steps:
[0115] 1. Determine whether the SOC system integrates multiple CAN controllers as multiple nodes connected to the same CAN bus or only one node is connected to the bus and the remaining nodes are used as backup nodes. If so, execute step 2.1, otherwise execute 2.2.
[0116] 2.1. Connect the TX signals and RX signals of multiple CAN nodes to the signal conversion module, and then perform step 3.1.
[0117] 2.2. Select the CAN node through the module register configuration, select the CAN node to be used by enabling the selection signal, and then execute step 3.2.
[0118] 3.1. Perform a "wired AND" arbitration operation on the TX signals of multiple CAN nodes connected to the signal conversion module. When the TX signal is sent to the ID segment of the CAN frame, if multiple nodes are sending nodes at the same time, the nodes are arbitrated according to the ID number. The node that successfully arbitrates is the sending node, and the remaining nodes are listening nodes; then connect the RX signal of each node to the RX side of the CAN transceiver, and then execute step 4.
[0119] 3.2. Connect the TX and RX signals of the selected CAN node to the TX and RX sides of the CAN transceiver.
[0120] 4. The node that succeeds in the arbitration operation in step 3.1 will be the sending node of the SOC system. At this time, the node will continue to send CAN frames, including the ID segment, control end, DLC segment, data segment, CRC segment, ACK segment and frame end segment, while other nodes will be converted into listening nodes. The TX signal is always sent at a high level by default, and the CAN frame sending of the bus is monitored. When filtering is performed after monitoring and it is found that it is a data receiving node, the TX signal will be sent at a low level in the ACK segment, and a handshake operation will be performed with the sending node, thereby completing the sending and receiving of CAN frames.
[0121] 5. One side of the CAN transceiver is used to connect the CAN controller TX and RX signals, and the other side converts the logic signal into a differential level signal (CAN_high, CAN_low) and connects it to the external CAN bus.
[0122] The electronic device, computer program product, and computer-readable storage medium provided in the embodiments of the present invention are introduced below. The electronic device, computer program product, and computer-readable storage medium described below can be referenced to each other with the bus communication method and bus communication system described above.
[0123] An embodiment of the present invention further provides an electronic device, including a bus and the bus communication system as described above.
[0124] It is worth noting that multiple bus communication systems are connected to the same bus, which ensures that the bus controller in the electronic device multiplexes a small number of bus transceivers in the device, thereby effectively reducing the number of bus transceivers, thereby effectively saving pin resources and reducing equipment costs.
[0125] Of course, the electronic device may also include other components, such as a power supply, a communication interface, an input / output interface, etc. Among them, the power supply is used to provide working voltage for each hardware device on the electronic device; the communication interface can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, and is not specifically limited here; the input / output interface is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here. The above-mentioned communication interface, input / output interface, and power supply can also be connected to the bus and can be set according to actual application requirements.
[0126] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, wherein the computer program / instruction implements the bus communication method described in the above embodiment when executed by a processor.
[0127] Since the embodiments of the computer program product part correspond to the embodiments of the bus communication method part, please refer to the description of the embodiments of the bus communication method part for the embodiments of the computer program product part, and will not be repeated here.
[0128] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the bus communication method described in the above embodiment is implemented.
[0129] Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the bus communication method part, the embodiments of the storage medium part refer to the description of the embodiments of the bus communication method part, which will not be repeated here.
[0130] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0131] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0132] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0133] The bus communication system, method, electronic device and storage medium provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A bus communication system, characterized in that: include: A bus controller, a signal conversion module and a bus transceiver, wherein there are multiple bus controllers, each of which is connected to the signal conversion module, the signal conversion module is connected to the bus transceiver, and the bus transceiver is connected to the bus; The bus controller is used to send an arbitration signal to the signal conversion module, monitor the arbitration result returned by the signal conversion module, send service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and quit sending service data when it is determined that its own arbitration fails according to the arbitration result; The signal conversion module is used to perform arbitration processing on all the arbitration signals to obtain the arbitration result, return the arbitration result to each bus controller, and send the service data sent by the bus controller to the bus transceiver; The bus transceiver is used to send the service data to the bus.
2. The bus communication system according to claim 1, characterized in that: The signal conversion module includes a calculation unit and a signal line branch circuit, the signal sending pin of each bus controller is connected to the first signal sending pin of the calculation unit, the second signal sending pin of the calculation unit is connected to the signal sending pin of the bus transceiver, and the signal receiving pin of each bus controller is connected to the signal receiving pin of the bus transceiver through the signal line branch circuit; The calculation unit is used to perform an AND operation on all the arbitration signals to obtain an arbitration result signal, and send the arbitration result signal to the bus transceiver; The bus transceiver is used to send the arbitration result signal to the bus and send a bus level signal to each of the bus controllers; The bus controller is used to determine the arbitration result according to the bus level signal.
3. The bus communication system according to claim 2, characterized in that: The signal conversion module further includes a register, wherein the register is used to store a register value corresponding to each of the bus controllers, and the signal conversion module selects a signal line of each of the bus controllers according to the register value.
4. A bus communication method, characterized in that: Applied to the bus communication system according to any one of claims 1 to 3, the method comprises: The plurality of bus controllers send arbitration signals to the signal conversion module; The signal conversion module performs arbitration processing on all the arbitration signals to obtain arbitration results, and sends the arbitration results to each of the bus controllers; Each of the bus controllers monitors the arbitration result, sends service data to the bus transceiver through the signal conversion module when it is determined that its own arbitration is successful according to the arbitration result, and quits sending service data when it is determined that its own arbitration fails according to the arbitration result; The signal conversion module sends the service data sent by the bus controller to the bus transceiver; The bus transceiver sends the service data to the bus.
5. The bus communication method according to claim 4, characterized in that: Also includes: The calculation unit in the signal conversion module performs an AND operation on all the arbitration signals to obtain an arbitration result signal, and sends the arbitration result signal to the bus transceiver; The bus transceiver sends the arbitration result signal to the bus, and sends a bus level signal to the bus controller; The bus controller determines the arbitration result according to the bus level signal.
6. The bus communication method according to claim 5, characterized in that: The bus controller sends an arbitration signal to the signal conversion module, including: The bus controller sends its own controller identification number bit by bit to the signal conversion module; The bus controller determines the arbitration result according to the bus level signal, including: The bus controller determines whether the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal; If the level corresponding to the number of bits of the controller identification number currently sent is the same as the current level of the bus level signal, determining whether all the bits in the controller identification number have been sent; If all the digits in the controller identification number have not been sent, sending the next digit in the controller identification number to the signal conversion module; If all bits in the controller identification number have been sent, it is determined that the self-arbitration is successful; If the level corresponding to the number of bits of the controller identification number currently sent is different from the current level of the bus level signal, it is determined that the self-arbitration has failed.
7. The bus communication method according to claim 5, characterized in that: After the bus controller determines that its own arbitration fails according to the arbitration result, the method further includes: Continuously sending a high level and monitoring the bus level signal; When it is determined that the bus is idle according to the bus level signal, resending the arbitration signal to the signal conversion module; When it is determined that the device is a data receiver according to the bus level signal, the service data sent by the data sender is received through the bus transceiver.
8. The bus communication method according to claim 5, characterized in that: Also includes: The signal conversion module obtains register values corresponding to each bus controller according to its internal register, and selects the signal lines of each bus controller according to the register value.
9. An electronic device, characterized in that: include: A bus, a bus communication system according to any one of claims 1 to 3.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are loaded and executed by the processor, the bus communication method according to any one of claims 4 to 8 is implemented.
