A method for constructing a message channel between two independent systems based on PPS
By building a message channel between two independent systems based on PPS, the problem of redundant steps when modifying message content in the prior art is solved, faster and more accurate message delivery is achieved, and the normal operation of the communication system is ensured.
Patent Information
- Application Number
- CN202111180870.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2041-10-11
AI Technical Summary
Under the existing communication methods, there are redundant steps when modifying the message content, resulting in an extended modification time and an expanded modification range.
The message channel between two independent systems is constructed using a PPS-based method. The information format is converted to the information format on the serial bus through serial communication, and the message ID is converted into a string. PPS is used for message publishing and subscribing, reducing the participation of the communication channel.
It reduces the operating time, narrows the scope of influence, ensures normal communication between communication systems, and allows independent debugging interfaces on the publishing side and subscription side.
Smart Images

Figure CN114090279B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of constructing an inter-system message transmission channel, and in particular to a method for constructing an inter-system message channel based on a PPS. Background Art
[0002] QNX is a distributed, scalable, POSIX-compliant Unix-like hard real-time operating system. QNX's PPS is a subscription / publish message bus. Using PPS as a communication method between modules is a common choice in software design based on QNX systems. In automotive systems, designs where SoCs and MCUs communicate via SPI or UART serial connections are widely used.
[0003] However, in the existing communication mode, in order to achieve hardware connection, the publisher and the subscriber need to negotiate the message types to be exchanged when designing the communication channel, define the names and contents of the publications, and notify the message channel service to add these messages. That is, under the guidance of the existing technology, to modify a message, three modules need to be modified at the same time, but in fact, the message transmission will not be affected if the message channel is not modified. Therefore, when the message needs to be modified, the existing technical solution has redundant steps, which prolongs the modification time and expands the modification scope.
[0004] Therefore, a method for constructing a message channel between two independent systems based on PPS comes into being. Summary of the invention
[0005] The invention content of the present invention is to provide a method for building a message channel between two independent systems based on PPS, which mainly solves the problem that under the existing communication mode, when the message content needs to be modified, there are redundant steps that should not exist, which leads to greatly extended modification time and a larger modification scope.
[0006] The present invention proposes a method for constructing a message channel between two independent systems based on PPS, comprising the following steps:
[0007] S1, the first independent system and the second independent system in serial communication are powered on, and the first independent system or the second independent system is a QNX system;
[0008] S2, the message channel of the first independent system converts the information format into the information format on the serial bus, and converts the message ID in the converted information format into a character string;
[0009] S3, the second independent system publishes the information received by the specific message channel to the user through the PPS;
[0010] In the step S2, any PPS object of the receiving end is defined in the character string.
[0011] Preferably, the message parameters and message length in the string are put into a json object, and the format of the string is defined as:
[0012] data:json:{"len":len,"data":[xx,xx,xx,…]}
[0013] Among them, len is the message length; the content of the data array corresponds to the message parameters.
[0014] Preferably, the string is named name, and name is used as the object name published by PPS; the json object is a member of the name object.
[0015] Preferably, in step S2, the character string includes a user interface in the second independent system for receiving the message;
[0016] The string format is,
[0017] name:json:{"len":len,"data":[xx,xx,xx,…]};
[0018] In the step S3, the second independent system publishes the information received by the specific message channel to the specific user via the PPS.
[0019] Preferably, the method further comprises the steps of:
[0020] S4, users can also subscribe to the required messages through the PPS bus.
[0021] Preferably, the method further comprises the steps of:
[0022] S51, setting a unique publishing node on the second independent system, and writing data in json format on the publishing node;
[0023] S52, the message channel parses the data in json format and converts it into the information format on the serial bus for sending.
[0024] Preferably, in step S2, the information format includes a frame header, a frame sequence number, a frame type, a frame length, a message ID, a message length, a message parameter, a CRC, and a frame tail;
[0025] The message ID is two bytes in length.
[0026] As can be seen from the above, the application of the technical solution provided by the present invention can achieve the following beneficial effects:
[0027] First, the method for constructing an inter-system message channel proposed in the present invention can realize message negotiation between the publishing side and the subscribing side without the participation of the communication channel, which greatly reduces the operation time and reduces the impact range within a specific range, thereby ensuring normal communication between communication systems;
[0028] Second, for the system using QNX's PPS, the present invention allows the publishing side and the subscribing side to independently debug their own interfaces, and when problems occur, they can be checked and debugged at any time through simple instructions. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0030] Figure 1 A model for constructing a message channel between two independent systems in an embodiment of the present invention;
[0031] Figure 2 A flowchart of building a message channel between two independent systems in an embodiment of the present invention;
[0032] Figure 3 In the embodiment of the present invention, each item is a reference naming method of a pps object named by name. DETAILED DESCRIPTION
[0033] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all 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.
[0034] Under the existing communication mode, when the content of a message needs to be modified, there are redundant steps that should not exist, which greatly prolongs the modification time and expands the scope of modification.
[0035] In order to solve the above problem, this embodiment proposes a method for building a message channel between two independent systems based on PPS, which mainly includes the following steps:
[0036] S1, the first independent system and the second independent system in serial communication are powered on, and the first independent system or the second independent system is a QNX system;
[0037] S2, the message channel of the first independent system converts the information format into the information format on the serial bus, and converts the message ID in the converted information format into a character string;
[0038] S3, the second independent system releases the information received by the specific message channel to the user through the PPS;
[0039] In step S2, any PPS object of the receiving end is defined in the character string.
[0040] Preferably but not limited to, in this embodiment, the first independent system is an MCU, but may be other systems as long as it is connected to the QNX system through a serial communication interface, and the second independent system is a SoC, that is, the second independent system runs the QNX operating system.
[0041] Preferably but not limited to, in this embodiment, the first independent system and the second independent system communicate via SPI, and UART communication may also be used.
[0042] Preferably but not limited to, in step S2, the information format includes a frame header, a frame sequence number, a frame type, a frame length, a message ID, a message length, message parameters, a CRC and a frame tail; wherein the message ID is two bytes in length.
[0043] More specifically, step S2 further includes:
[0044] The message parameters and message length in the string are put into a json object, and the format of the string is defined as:
[0045] data:json:{"len":len,"data":[xx,xx,xx,…]}
[0046] Among them, len is the message length; the content of the data array corresponds to the message parameters.
[0047] More specifically, in step S2, the string is named name, and name is used as the object name published by PPS; the json object is a member of the name object.
[0048] In this embodiment, when receiving a message, the "SPI message channel service" converts the "message ID" into a string and names it as name when parsing the spi bus message data, puts the "message parameters" and "message length" into a json object, and uses name as the object name published by PPS. The json object is a member of the name object, such as Figure 3 shown.
[0049] More specifically, in step S2, the character string includes a user interface in the second independent system for receiving the message;
[0050] The string format is,
[0051] name:json:{"len":len,"data":[xx,xx,xx,…]};
[0052] In step S3, the second independent system publishes the information received by the specific message channel to a specific user via the PPS.
[0053] In this embodiment, when the message reception is completed, a unique PPS object is defined for the interface sent by the SoC side: for example, / var / pps / spi_service / tx. To publish a message, the SoC side only needs to write to the tx object in the format of name:json:{"len":len,"data":[xx,xx,xx,…]}.
[0054] In this embodiment, the detailed design of the message channel service parsing the SPI bus message and converting it into JSON format for publication is as follows:
[0055] Define the data structure to bind the message name and the pps publishing node handle:
[0056] struct Message_attr_t{
[0057] char name
[32] ;
[0058] int fd;
[0059] };
[0060] An array defining the maximum number of messages supported by the system:
[0061] Message_attr_t message_attrs[max_messages];
[0062] The message channel service receives this json object on tx, converts it into a message on the serial bus, and writes it to the serial bus through the serial bus interface to complete the message sending.
[0063] When a message arrives on the Spi bus, after parsing the name and converting the format into json format, the message_attrs table is searched by name. If the name does not exist in the table, it is added to the message_attrs table, and the added position is offset. A pps message publishing node is created and the corresponding fd is recorded. If there is a message, the position offset is remembered. In both cases, the corresponding message_attrs[offset].fd is returned, and the spi message is published using message_attrs[offset].fd.
[0064] More specifically, the method further includes step S4, where the user can subscribe to required messages via the PPS bus.
[0065] More specifically, the method further comprises the steps of:
[0066] S51, setting a unique publishing node on the second independent system, and writing data in json format on the publishing node;
[0067] S52, the message channel parses the data in json format and converts it into the information format on the serial bus for sending.
[0068] In this embodiment, a unique publishing node can be corresponding to the MCU, and the software module on the QNX side only needs to write JSON format data to the publishing node to send data to the MCU. The "SPI message channel service" parses the JSON format data and converts it into the MCU bus data format, and sends it to the SPI bus through the SPI driver.
[0069] The above method realizes the two-way message communication between SoC and MCU through the "SPI message channel service". When the SoC side module and the MCU side module need to communicate, only good messages need to be defined between the two, and the "SPI message channel service" does not need to be involved.
[0070] For example, the MCU defines a new message on the SPI bus as follows:
[0071]
[0072] When this message is published through the SPI bus, the "Message Channel Service" receives the SPI bus message data, converts it into data:json:{"len":2,"data":[0,0]}, and publishes it on the publishing node corresponding to the 5001 message, such as / pps / spi_service / 5001; the subscriber on the SoC side monitors whether the / pps / spi_service / 5001 node exists. If it exists, it reads this node, that is, it receives the 5001 message sent by the MCU.
[0073] In summary, this embodiment proposes a method for building a message channel between two independent systems based on PPS, which can realize the negotiation of messages between the publishing side and the subscribing side without the participation of the communication channel, greatly reducing the operation time, while narrowing the impact range within a specific range, ensuring normal communication between communication systems; at the same time, in a system using QNX's PPS, the publishing side and the subscribing side can independently debug their respective interfaces, and when problems occur, they can be viewed and debugged at any time through simple instructions.
[0074] The above-described implementation methods do not constitute a limitation on the protection scope of the technical solution. Any modification, equivalent replacement and improvement made within the spirit and principle of the above-described implementation methods shall be included in the protection scope of the technical solution.
Claims
1. A method for constructing a message channel between two independent systems based on PPS, characterized in that: The following steps are involved: S1, the first independent system and the second independent system in serial communication are powered on, and the first independent system or the second independent system is a QNX system; S2, the message channel of the first independent system converts the information format into the information format on the serial bus, and converts the message ID in the converted information format into a character string; S3, the second independent system publishes the information received by the specific message channel to the user through the PPS; In the step S2, any PPS object of the receiving end is defined in the character string; the step S2 also includes, The message parameters and message length in the string are put into a json object, and the format of the string is defined as: data:json:{"len":len,"data":[xx,xx,xx,…]} Among them, len is the message length; the content of the data array corresponds to the message parameters; In step S2, the string is named name, and name is used as the object name published by PPS; the json object is a member of the name object; In the step S2, the character string includes a user interface in the second independent system for receiving the message; The string format is, name:json:{"len":len,"data":[xx,xx,xx,…]}; In the step S3, the second independent system publishes the information received by the specific message channel to the specific user via the PPS; When a message arrives on the Spi bus, after parsing the name and converting the format into json format, the message_attrs table is searched by name. If the name does not exist in the table, it is added to the message_attrs table. The added position is offset, and a pps message publishing node is created to record the corresponding fd. If there is one, the position offset is remembered. In both cases, the corresponding message_attrs[offset].fd is returned, and the spi message is published using message_attrs[offset].fd.
2. A method for constructing a message channel between two independent systems based on PPS according to claim 1, characterized in that: Also includes the steps: S4, users can also subscribe to the required messages through the PPS bus.
3. A method for constructing two independent system message channels based on PPS according to claim 2, characterized in that: Also includes the steps: S51, setting a unique publishing node on the second independent system, and writing data in json format on the publishing node; S52, the message channel parses the data in json format and converts it into the information format on the serial bus for sending.
4. The method for constructing a message channel between two independent systems based on PPS according to claim 1, characterized in that: In step S2, the information format includes a frame header, a frame sequence number, a frame type, a frame length, a message ID, a message length, a message parameter, a CRC, and a frame tail; The message ID is two bytes in length.
Citation Information
Patent Citations
Systems and / or methods for standards-based messaging
CN101854351A
Broadcast signal transmitting device, broadcast signal receiving device, broadcast signal transmitting method, and broadcast signal receiving method
CN106464395A