A coordinated sending method for CAN shared mailbox
Through the coordinated sending method of CAN shared mailbox, the problem of high transmission rate and resource occupation in CAN bus communication is solved, efficient email information transmission and resource utilization are achieved, and the system access efficiency is improved.
Patent Information
- Application Number
- CN202411089972.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-09
AI Technical Summary
The existing CAN bus communication protocol transmits mail information between multiple CANs in the same chip system at a transmission rate of 1Mbit/s, and the mailbox information is independent, resulting in high resource occupation and low efficiency.
The coordinated sending method of CAN shared mailbox is adopted to realize the delivery of mail information through the top-level mailbox shared signal, including sending requests, reply signals, email sending and locking unlocking, and new peripheral signals are added to improve access efficiency and resource utilization.
It improves the access efficiency between mailboxes, reduces the resource usage of CAN bus, and improves the efficiency of mail information transmission.
Smart Images

Figure CN118612181B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a coordinated sending method for a CAN shared mailbox. Background Art
[0002] The CAN (Multi-Host Local Area Network Serial Communication Protocol) communication protocol is mainly used for in-vehicle communication. Multiple CANs are mounted on the CAN bus to form a multi-host local area network, which allows fast, safe and efficient communication between CAN mailboxes and quickly adapts to today's increasingly intelligent in-vehicle systems.
[0003] The CAN bus signal is transmitted through the bus interface on two differential voltage signal lines. The CAN email information is transmitted to another CAN mailbox through the serial port to complete the information transmission. If the email information transmission between multiple CANs in the same chip system is transmitted through the differential voltage signal line, it will be limited by the CAN transmission rate of 1Mbit / s. In addition, the existing CAN mailbox information is independent.
[0004] The background description provided herein is for the purpose of generally presenting the context of the present disclosure. Unless otherwise indicated herein, the materials described in this section are not prior art to the claims of this application and are not admitted to be prior art by inclusion in this section. Summary of the invention
[0005] In view of the above technical problems in the related art, the present invention proposes a coordinated sending method of a CAN shared mailbox, which is applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate through a CAN bus, the N CANs have a top-level mailbox sharing signal of the CAN, and the CAN internal mailbox includes sending mails and receiving mails, and N is a positive integer greater than 1; the method includes the following steps:
[0006] S1, the i-th CAN_i sends a request to send mail[i][j], and mail[i][j] has mail information;
[0007] S2, poll all CANs, obtain the j-th CAN_j to give a response signal ACK[j], and lock the email [i][j];
[0008] S3, CAN_i receives and sends the email n information to CAN_j; the email n information of CAN_i is sent from the sending port of CAN_j;
[0009] S4, after CAN_j completes sending, ACK[j] of CAN_j is pulled low.
[0010] Specifically, after step S4, the following further includes: S5, ACK response is completed, CAN_i continues to poll the sending request, waits for the next coordinated sending request, and waits for requests sent to CAN_i by other CANs.
[0011] Specifically, poll all CAN_n and check whether they respond in turn;
[0012] CAN_0~CAN_j-1, no response;
[0013] If CAN_j gives a response signal, email [i] [j] is locked and cannot be sent or modified by CAN_i.
[0014] Specifically, the step S4 specifically includes: after CAN_j responds, CAN_i receives and sends the email n information to CAN_j;
[0015] The email n information of CAN_i is sent from the CAN_j sending port;
[0016] CAN_i's mail n unlocked;
[0017] Manually update the filling status of mail [i] [j] of CAN_i; the manual update of the filling status of mail [i] [j] of CAN_i is specifically to update the filling status of mail [i] [j] of CAN_i through DSP or other host.
[0018] Specifically, the step S1 is as follows: CAN_i coordinates CAN_j to send a request command CAN_REQ_i;
[0019] The CAN_REQ_i request is configured by the DSP or other host.
[0020] Specifically, if CAN_i polls CAN_REQ_i[j][n] and pulls it high, and the filling status of mail n is not empty, and waits for the response CAN_ACK_j[i] sent by CAN_j, then mail n of CAN_i is locked, and DSP or other hosts will not write to mail n, nor will CAN_i send the content of mail n.
[0021] Specifically, after the response, mail n is locked. If CAN_i specifies to send mail n to the bus interface, the sending status of CAN_i is in a waiting state. It can be unlocked only after CAN_j completes the response. CAN_i starts to send mail n to the CAN bus interface. If CAN sends sequentially and the CAN_ACK_j[i] response status is pulled high, mail n is skipped and n+1 content is continued to be sent.
[0022] Specifically, CAN_j coordinates to send the email n information sent by CAN_i, then CAN_ACK_j[i] responds and CAN_i updates the filling status of email n. If the filling status of email n is cleared, CAN_i cannot send it a second time. If the filling status of email n is not cleared, CAN_i will send it a second time.
[0023] In a second aspect, another embodiment of the present invention provides a coordinated sending method of a CAN shared mailbox, which is applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate through a CAN bus, the N CANs have a top-level mailbox sharing signal of the CAN, and the CAN internal mailbox includes sending mails and receiving mails, and N is a positive integer greater than 1; the method includes the following steps:
[0024] S1, CAN_j is in idle state, receives the coordinated transmission command from CAN_i, and CAN_j sends a response CAN_ACK_j[i] to CAN_i;
[0025] S2, after answering, lock the sending function of CAN_j bus interface, CAN_j receives the email n information of CAN_i, the email n is not written into the internal email of CAN_j, only occupies the sending function of CAN_j bus interface, and sends the email n information of CAN_i through the bus interface of CAN_j;
[0026] S3, after the response, detect that the CAN_j bus interface sends a completion signal, CAN_j sends a response CAN_ACK_j[i] and pulls it low, and CAN_j unlocks its own mailbox.
[0027] S4, CAN_j continues to be in the idle state and polls to check the coordinated transmission request of other CANs.
[0028] Specifically, after the response, the sending function of the CAN_j bus interface is locked, and the CAN_j sending mailbox itself is locked and cannot be sent out through the CAN_j bus interface. It needs to wait. At this time, the coordinated sending priority is the highest. Only after the CAN_j coordinated sending is completed, the CAN_j own mailbox can be sent to the CAN_j bus interface.
[0029] The present invention adds a CAN peripheral signal, and realizes a mail information transmission method between mailboxes in the same chip system on the basis of the original internal system network communication, which greatly improves the access efficiency between mailboxes and reduces the resource occupation of the CAN bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] 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 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 work.
[0031] Figure 1 It is a structural diagram of a CAN mailbox sharing provided by an embodiment of the present invention;
[0032] Figure 2 This is a schematic diagram of a command sent by a CAN mailbox sharing provided by an embodiment of the present invention;
[0033] Figure 3 This is a schematic diagram of a command sent by a CAN shared mailbox in coordination according to an embodiment of the present invention;
[0034] Figure 4 It is a flow chart of a coordinated sending method of a CAN shared mailbox provided by an embodiment of the present invention;
[0035] Figure 5 It is a CAN_i flow chart of CAN_i coordinating CAN_j to send an email provided by an embodiment of the present invention;
[0036] Figure 6 This is a CAN_j flow chart of CAN_i coordinating CAN_j to send an email provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] 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 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 belong to the scope of protection of the present invention.
[0038] Embodiment 1
[0039] refer to Figure 1A CAN mailbox sharing method of this embodiment is used in a CAN communication system, wherein the CAN communication system includes N CAN communication interfaces CAN_0...CAN_N, each of which has one or more mailboxes, that is, each communication interface can read and write a corresponding mailbox. In the prior art, the internal mailbox of the CAN is generally accessed through the chip internal system bus network (wherein the chip internal system bus network is used to configure the registers and mailbox contents of the CAN), such as the AMBA bus, and the email information of the CAN mailbox is triggered to be transmitted to the CAN bus interface (wherein the CAN bus interface is used for CAN to send / receive emails), so as to transmit email information between CANs. As a result, in the same chip system, the transmission of email information between multiple CANs is limited to the 1Mbit / s transmission rate of CAN through the differential voltage signal line.
[0040] refer to Figure 2-3 This embodiment discloses a CAN mailbox sharing method, where each CAN mailbox can receive mailbox sharing status and control, and then control the mailbox according to the mailbox sharing status and control information. The mailbox sharing status and control information of this embodiment is expressed through the response and control information of the corresponding command, such as the ACK response to the read and write command, the CAN response of the coordinated send command and its control information. The specific implementation method refers to the following specific description.
[0041] By mutually transmitting the status and control information of mailbox sharing between each CAN, the delivery and receiving of mails between each CAN can be completed by applying for other mailboxes to coordinate sending requests, reading other mailboxes' mail information requests, obtaining other mailboxes' working status, sending and receiving mails to other mailboxes, other mailboxes or returning the empty and full status information of their own mailboxes, etc. The working status of the mailbox in this embodiment includes: mailbox lock destiny, mailbox reply command ACK, etc.; the empty and full status information of the mailbox is confirmed by the mailbox filling status. The CAN interface of this embodiment will send and receive commands, and in the process of executing and completing the command, the status information is all internal to each CAN, and is output according to the operating status of each CAN, and each CAN receives the internal status information (such as mailbox filling, mail information, etc.) from each CAN, but only confirms the status information of the CAN that needs to be received through the command, and performs the corresponding status response.
[0042] This embodiment takes CAN_0 coordinating other CAN shared mailboxes in the same chip system as an example. The specific CAN external communication architecture diagram is as follows: Figure 1As shown. For each CAN newly added peripheral signal, the newly added peripheral signals include: the control signal wr_n[n:0] for reading and writing mailboxes, the chip select signal cs_n[n:0] of CAN, the mailbox response signal ack_n[n:0], the mail [n] send request, the CAN [n] response to the mail send request, and the filling status of the mailbox, and judge the types of other CAN requests: mailbox read and write request, coordination mail send request, CAN response to the mail generation request, and the filling status of the mailboxes between each other. Through these basic information, the information sharing of shared mails and resource coordination are completed.
[0043] The CAN shared mailbox of the present invention has two operation modes: mail reading and writing operation, and mail coordinated sending operation.
[0044] The first type: mail read and write operations: mail read and write request wr_0[1] mail n is the reading and writing of the nth mail in the mailbox of CAN_1 by CAN_0. The read operation will not modify the filling status of the mailbox, and the write operation will update the filling status of the mailbox. By judging each CAN's response to CAN_0's request, it is confirmed which CAN receives the read and write request command.
[0045] The second type: coordinated sending of mail: The sending request of mail n[0] is the sending request of the nth mailbox initiated by CAN_0, in which CAN_0 confirms which CAN receives the sending request command by polling. Once confirmed, the coordinated sending function of the sending request CAN_0 is locked by the receiving command CAN. Only when the receiving command CAN is sent or released manually, can CAN_0 start the coordinated sending function. The filling status of the mailbox of the CAN receiving the command will not be updated. After the sending is completed, the filling status of the CAN_0 mailbox itself needs to be manually updated. The manual update of this embodiment refers to the read and write operations of the filling status register of the mailbox through the DSP or other host.
[0046] The shared mailbox coordinates sending. After the sending is completed, the filling status of the mailbox will not change, and the lock status of the mailbox will be released. At this time, the user can send again as needed. If there is no need to send again, the DSP or other host will clear the filling status bit of the mailbox to prevent secondary sending and save CAN bus resources. That is, this embodiment controls the filling status bit of the mailbox by whether the user sends again (manual update) as needed. The significance of manual is that it increases the flexibility of user use and adds the possibility that the user needs to send again.
[0047] refer to Figure 4-5, this embodiment discloses a coordinated sending method of a CAN shared mailbox, which is applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate through a CAN bus, the N CANs have a top-level mailbox sharing signal of the CAN, and the CAN internal mailbox includes sending mails and receiving mails, and N is a positive integer greater than 1;
[0048] It includes the following steps:
[0049] S1, the i-th CAN_i sends a request to send mail[i][j], and mail[i][j] has mail information;
[0050] Step S1 specifically includes CAN_i coordinating CAN_j to send a request command CAN_REQ_i;
[0051] The CAN_REQ_i request is configured by the DSP or other host.
[0052] S2, poll all CANs, obtain the j-th CAN_j to give a response signal ACK[j], and lock the email [i][j];
[0053] In this embodiment, CAN_i polls all CAN_n to check whether they respond in turn;
[0054] CAN_0~CAN_j-1, no response;
[0055] If CAN_j gives a response signal, email [i] [j] is locked and cannot be sent or modified by CAN_i.
[0056] S3, CAN_i receives and sends the email n information to CAN_j; the email n information of CAN_i is sent from the sending port of CAN_j;
[0057] S4, after CAN_j is sent, ACK[j] of CAN_j is pulled low;
[0058] After CAN_j responds, CAN_i receives and sends the email n message to CAN_j;
[0059] The email n information of CAN_i is sent from the CAN_j sending port;
[0060] CAN_i's mail n unlocked;
[0061] Manually update the population status of mail[i][j] of AN_i.
[0062] After ACK[j] is pulled low, this embodiment further includes step S5: ACK response is completed, CAN_i continues to poll the sending request, waits for the next coordinated sending request, and waits for requests sent to CAN_i by other CANs.
[0063] Specifically, CAN_i starts to poll whether the request is valid (pulled high) from CAN_REQ_i[0][0]. If the request waits for a certain period of time without a response, the coordinated sending command is manually canceled. Otherwise, CAN_i keeps waiting for the request response.
[0064] CAN_i polls CAN_REQ_i[j][n] and pulls it high, and the filling status of mail n is not empty, and waits for the response CAN_ACK_j[i] sent by CAN_j, then mail n of CAN_i is locked, and DSP or other hosts cannot write to mail n, nor can CAN_i send the content of mail n.
[0065] After replying, CAN_i sends the message "mail n" to CAN_j.
[0066] After the response, mail n is locked. If CAN_i specifies to send mail n to the bus interface, the sending status of CAN_i is in the waiting state. It can be unlocked only after CAN_j completes the response. CAN_i starts to send mail n to the CAN bus interface. If CAN sends sequentially and CAN_ACK_j[i] is in the response state (pulled high), mail n is skipped and n+1 content is continued to be sent.
[0067] CAN_j coordinates and sends the message n sent by CAN_i, then CAN_ACK_j[i] responds (pulled low), CAN_i updates the filling status of message n, if the filling status of message n is cleared, CAN_i cannot send it a second time, if the filling status of message n is not cleared, CAN_i will send it a second time.
[0068] In this embodiment, CAN_i first sends an email sending request, polls all CANs, and when a CAN gives a response signal, sends the email through the CAN that gives the response. The present invention adds a peripheral signal of CAN, and on the basis of the original internal system network communication, realizes a method for transmitting email information between mailboxes in the same chip system, greatly improves the access efficiency between mailboxes, and reduces the resource occupation of the CAN bus.
[0069] Embodiment 2
[0070] refer to Figure 6, this embodiment discloses a coordinated sending method of a CAN shared mailbox, which is applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate through a CAN bus, the N CANs have a top-level mailbox sharing signal of the CAN, and the CAN internal mailbox includes sending mails and receiving mails, and N is a positive integer greater than 1;
[0071] Its application is to send emails in CAN_j, which includes the following steps:
[0072] S1, CAN_j is in idle state, receives the coordinated transmission command from CAN_i, and CAN_j sends a response CAN_ACK_j[i] to CAN_i;
[0073] CAN_j receives the coordinated send command from CAN_i. When CAN_j is in idle state, it will receive the read and write email n command. Specifically, CAN_j has not sent the coordinated send command CAN_REQ_j to other CANs, CAN_j has not sent email to the CAN bus interface, or the CAN_j bus interface is receiving other email information.
[0074] When CAN_j is in idle state, it polls to detect the received coordinated transmission request. When CAN_j detects the coordinated transmission command CAN_REQ_i[j][n] of CAN_j, it sends a response signal CAN_ACK_j[i] to CAN_i.
[0075] S2, after answering, lock the sending function of CAN_j bus interface, CAN_j receives the email n information of CAN_i, the email n is not written into the internal email of CAN_j, only occupies the sending function of CAN_j bus interface, and sends the email n information of CAN_i through the bus interface of CAN_j;
[0076] After the response, the sending function of the CAN_j bus interface is locked, but the internal mailbox of CAN_j can be accessed by the chip system bus. After the response, CAN_j receives the email n information of CAN_i, which is not written into the internal email of CAN_j, but only occupies the sending function of the bus interface of CAN_j, and sends the email n information of CAN_i through the bus interface of CAN_j.
[0077] After the response, the sending function of the CAN_j bus interface is locked, and the CAN_j sending mailbox is locked. It cannot be sent out through the CAN_j bus interface and needs to wait. At this time, the coordinated sending priority is the highest. Only after the CAN_j coordinated sending is completed, the CAN_j mailbox itself can be sent to the CAN_j bus interface;
[0078] After the response, the sending function of the CAN_j bus interface is locked, but the CAN_j internal mailbox can be accessed by the chip system bus.
[0079] After the response, CAN_j receives the email n information of CAN_i. The email n is not written into the internal email of CAN_j, but only occupies the sending function of the bus interface of CAN_j, and sends the email n information of CAN_i through the bus interface of CAN_j.
[0080] S3, after the response, detect that the CAN_j bus interface sends a completion signal, CAN_j sends a response CAN_ACK_j[i] and pulls it low, and CAN_j unlocks its own mailbox.
[0081] S4, CAN_j continues to be in the idle state and polls to check the coordinated transmission request of other CANs.
[0082] In this embodiment, the CAN polls the signal on the CAN bus. When the CAN is idle and a response signal is given, the email is sent out through the CAN that gives the response. The present invention adds a peripheral signal of the CAN, and on the basis of the original internal system network communication, realizes a method for transmitting email information between mailboxes in the same chip system, greatly improving the access efficiency between mailboxes and reducing the resource occupation of the CAN bus.
[0083] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A coordinated sending method of a CAN shared mailbox, applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate through a CAN bus, the N CANs have a top-level mailbox sharing signal of the CAN, and the CAN internal mailbox includes sending mails and receiving mails, wherein N is a positive integer greater than 1; characterized in that: The steps include: S1, the i-th CAN_i sends a request to send mail[i][j], and mail[i][j] has mail information; S2, poll all CANs, obtain the j-th CAN_j to give a response signal ACK[j], and lock the email [i][j]; S3, CAN_i receives and sends the email n information to CAN_j; the email n information of CAN_i is sent from the sending port of CAN_j; S4, after CAN_j is sent, ACK[j] of CAN_j is pulled low; CAN_j coordinates to send the message n sent by CAN_i, then ACK_[j] is completed, CAN_i updates the filling status of message n, if the filling status of message n is cleared, CAN_i cannot send it again, if the filling status of message n is not cleared, CAN_i will send it again; S5, ACK[j] response is completed, CAN_i continues to poll the send request, waits for the next coordinated send request, and waits for requests sent to CAN_i by other CANs.
2. The method according to claim 1, characterized in that The step S2 specifically includes: polling all CAN_n to check in turn whether they respond; CAN_0~CAN_j-1, no response; If CAN_j gives a response signal, email [i] [j] is locked and cannot be sent or modified by CAN_i.
3. The method according to claim 2, characterized in that: The step S4 specifically includes: after CAN_j responds, CAN_i receives and sends the email n information to CAN_j; The email n information of CAN_i is sent from the CAN_j sending port; CAN_i's mail n unlocked; Manually update the filling status of mail [i] [j] of CAN_i; the manual update of the filling status of mail [i] [j] of CAN_i is specifically to update the filling status of mail [i] [j] of CAN_i through DSP or other host.
4. The method according to claim 3, characterized in that: The step S1 specifically includes: CAN_i sends a coordination transmission request command CAN_REQ_i to CAN_j; The CAN_REQ_i request is configured by the DSP or other host.
5. The method according to claim 4, characterized in that: When CAN_i polls and CAN_REQ_i is pulled high, and the filling status of mail n is not empty, and it waits for the response ACK[j] sent by CAN_j, mail n of CAN_i is locked, and mail n cannot be written by DSP or other hosts, and the content of mail n cannot be sent by CAN_i.
6. The method according to claim 5, characterized in that: After CAN_j responds, mail n is locked. If CAN_i specifies to send mail n to the bus interface, the sending status of CAN_i is in waiting status. It can be unlocked only after CAN_j responds. CAN_i starts to send mail n to the CAN bus interface. If CAN sends sequentially and the ACK[j] response status is pulled high, mail n is skipped and the content of mail n+1 is continued to be sent.
7. A coordinated sending method of a CAN shared mailbox, applied to a CAN communication system, wherein the system includes N CANs, the N CANs communicate via a CAN bus, the N CANs have a top-level mailbox sharing signal of CAN, and the CAN internal mailbox includes sending mails and receiving mails, wherein N is a positive integer greater than 1; characterized in that, It includes the following steps: S1, CAN_j is in idle state, receives the coordinated transmission command from CAN_i, and CAN_j sends a response CAN_ACK_j[i] to CAN_i; S2, after answering, lock the sending function of CAN_j bus interface, CAN_j receives the email n information of CAN_i, the email n is not written into the internal mailbox of CAN_j, only occupies the sending function of CAN_j bus interface, and sends the email n information of CAN_i through CAN_j bus interface; S3, after the response, detect that the CAN_j bus interface sends a completion signal, pull CAN_ACK_j[i] low, the CAN_j sends a response CAN_ACK_j[i] to CAN_i, and CAN_j unlocks its own mailbox; CAN_j coordinates to send the message n sent by CAN_i, then CAN_ACK_j[i] responds and CAN_i updates the filling status of message n. If the filling status of message n is cleared, CAN_i cannot send it again. If the filling status of message n is not cleared, CAN_i will send it again. S4, CAN_j continues to be in the idle state and polls to check the coordinated transmission request of other CANs.
8. The method according to claim 7, characterized in that: After step S2 is answered, the sending function of the CAN_j bus interface is locked, and the sending function of CAN_j's own mailbox is locked. It cannot be sent out through the CAN_j bus interface and needs to wait. At this time, the coordinated sending priority is the highest. Only after CAN_j coordinated sending is completed, can CAN_j's own mailbox be sent to the bus interface of CAN_j.
Citation Information
Patent Citations
Design method for communication between CAN communication channels based on DSP2812
CN106230688A
Method and device for receiving and transmitting mailbox message of CAN bus controller
CN113141288A
FlexCan bus controller based on SRAM PUF
CN114422556A
CAN multi-mailbox multiplexing processing method and system
CN114979058A
Communication device
JP2013055593A
