Sending mechanism control method and device of CAN multiplexing mailbox, processor and computer readable storage medium thereof

By grouping and software processing of CANIDs in the body domain controller, all CAN sending functions are realized when the number of mailboxes of microcontrollers is insufficient, the development cycle and cost problems caused by hardware replacement are solved, and compatibility and efficiency are improved.

CN119420727APending Publication Date: 2025-02-11DONGFENG ELECTRONICS TECH +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411542640.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

In the body domain controller, when the number of CANIDs exceeds the number of microcontroller mailboxes, all CAN sending functions cannot be realized. Usually, the microcontroller needs to be replaced, resulting in an increase in development cycle and cost.

Method used

By grouping all CANIDs in the requirements, the same group of CANIDs share one mailbox, and adding multiple CANIDs to the software to multiplex the same mailbox, the sending function of all CANs is realized.

Benefits of technology

Without modifying the hardware, all CAN transmission functions are implemented, shortening the development cycle, reducing costs, and improving the compatibility of the transmission mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420727A_ABST
    Figure CN119420727A_ABST
Patent Text Reader

Abstract

The invention relates to a sending mechanism control method for a CAN multiplexing mailbox. The method comprises the following steps: (1) arranging and grouping all CANIDs in the current customer demand according to a preset rule; (2) creating an array A and an array B according to the grouping condition, wherein the array A and the array B are respectively used for storing all CANIDs and single-chip microcomputer mailboxes; (3) identifying whether the CANID meeting the sending condition exists in the array A, if so, directly adopting a mailbox multiplexing function in the array B and entering the step (4), otherwise, not executing any operation; and (4) performing corresponding identification processing on the multiplexing mailbox needing to execute the sending queue in the array B. The invention also relates to a corresponding device, a processor and a computer readable storage medium. By adopting the sending mechanism control method and device of the CAN multiplexing mailbox, the processor and the computer readable storage medium thereof, the change of hardware is avoided, the development period is shortened, the compatibility of the sending mechanism is good, and the sending mechanism can be adapted to different single-chip microcomputers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of automotive electronic control technology, and in particular to a CAN sending mechanism of a vehicle body domain controller, and specifically refers to a sending mechanism control method, device, processor and computer-readable storage medium of a CAN multiplex mailbox. Background Art

[0002] At present, the development cycle of automotive electronic components is very short. An ECU component that can meet mass production standards is required in one year or even nine months. Vehicle customers will continue to propose changes in requirements after mass production, and the functions of the body domain controller also need to be changed accordingly. Most of the requirements can be updated through software changes, but sometimes the requirements proposed by the vehicle manufacturer will involve hardware changes after professional evaluation. For example, the body domain controller will be required to forward signals, such as converting LIN signals into CAN signals, and forwarding CAN1 signals to CAN2. The result is that there are more and more CANIDs. Since the selection of the microcontroller is based on the initial requirements, the number of mailboxes selected for the microcontroller will be greater than the number of CANIDs in the initial requirements. The microcontroller is fixed, and the number of mailboxes supported by its hardware is also fixed. At present, the conventional usage method is that one mailbox of the microcontroller corresponds to one CANID to ensure normal CAN data transmission. However, when the number of CANIDs exceeds the number of mailboxes, the extra CANIDs cannot be assigned corresponding mailboxes and cannot be sent. At this time, the usual solution is to replace the microcontroller and select a microcontroller with a number of mailboxes that matches the number of CANIDs required. Due to the update of the microcontroller, the underlying code that adapts to the microcontroller needs to be updated. Changes in software and hardware will cause a significant increase in development cycle and cost.

[0003] Based on this, it is necessary to propose a solution to improve the problems existing in the current prior art. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the above-mentioned prior art and to provide a method, device, processor and computer-readable storage medium for controlling the sending mechanism of a CAN multiplexed mailbox that realizes all CAN sending functions without modifying the hardware when the number of CANIDs required by customers' continuously iterative changes exceeds the number of microcontroller mailboxes.

[0005] In order to achieve the above purpose, the solution of the present invention is: group all CANIDs in the requirements according to certain rules, and the CANIDs in the same group share a mailbox. The software adds a processing mechanism for multiple CANIDs to reuse the same mailbox, and finally realizes the sending function of all CANs. Specifically, the control method, device, processor and computer-readable storage medium of the sending mechanism of the CAN multiplexing mailbox of the present invention are as follows:

[0006] The main feature of the method for controlling the sending mechanism of the CAN multiplex mailbox is that the method comprises the following steps:

[0007] (1) All CANIDs in the current customer requirements are sorted and grouped according to preset rules;

[0008] (2) Create arrays A and B according to the grouping conditions to store all CANIDs and MCU mailboxes respectively;

[0009] (3) Identify whether there is a CANID in the array A that meets the sending condition. If so, directly use the multiplexing mailbox function in the array B and enter step (4). Otherwise, do not perform any operation;

[0010] (4) In the array B, corresponding identification processing is performed on the multiplexed mailboxes that need to execute the sending queue.

[0011] Preferably, the step (1) is specifically as follows:

[0012] Based on all the CANIDs currently obtained, grouping is performed according to the grouping principle with small bit differences, and the final number of groups is equal to the number of mailboxes of the microcontroller.

[0013] Preferably, the size of the array A is equal to the number of all CANIDs in the current customer demand;

[0014] The size of the array B is equal to the number of microcontroller mailboxes and is used for initialization processing of CAN registers.

[0015] Preferably, the step (3) specifically comprises the following steps:

[0016] (3.1) Determine whether there is a CANID in the array A that meets the sending conditions. If so, proceed to step (3.2). Otherwise, terminate the current process directly.

[0017] (3.2) Determine whether the current CANID uses a multiplexing mailbox. If so, directly fill the current CANID into the sending queue of the corresponding multiplexing mailbox; otherwise, go to step (3.3);

[0018] (3.3) Directly call the CAN sending function to send the current CANID.

[0019] Preferably, the step (3) is performed within a sending period of a preset periodic task.

[0020] Preferably, the step (4) specifically comprises the following steps:

[0021] (4.1) Identify whether there is CAN data to be sent in the sending queue of all the multiplexed mailboxes in the array B. If the sending queue is empty, no operation is performed; if there is data to be sent in the sending queue, go to step (4.2);

[0022] (4.2) Send the first CANID to be sent in the sending queue of all multiplexed mailboxes to complete the CANID sending function.

[0023] Preferably, the step (4.2) further comprises:

[0024] It is necessary to first configure the multiplexing mailbox to the current CANID, and then call the underlying CAN sending function to send this CANID.

[0025] Preferably, the step (4) further comprises:

[0026] The timer interrupt function is turned on, and step (4) is triggered to execute within the interval time.

[0027] The main feature of the sending mechanism control device of the CAN multiplex mailbox is that the device comprises:

[0028] a processor configured to execute computer executable instructions;

[0029] The memory stores one or more computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned CAN multiplex mailbox sending mechanism control method are implemented.

[0030] The sending mechanism control processor of the CAN multiplexed mailbox has the main feature that the processor is configured to execute computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned CAN multiplexed mailbox sending mechanism control method are implemented.

[0031] The main feature of the computer-readable storage medium is that a computer program is stored thereon, and the computer program can be executed by a processor to implement the steps of the above-mentioned CAN multiplex mailbox sending mechanism control method.

[0032] The sending mechanism control method, device, processor and computer-readable storage medium of the CAN multiplexing mailbox of the present invention are adopted. By adding a processing mechanism for multiple CANIDs to reuse the same mailbox in the software, all CAN sending functions can be realized, avoiding hardware changes, shortening the development cycle, and the sending mechanism has good compatibility and can be adapted to different microcontrollers. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1The figure is a schematic diagram of CANID grouping rules of the sending mechanism control method of the CAN multiplexing mailbox of the present invention.

[0034] Figure 2 This is a flow chart for judging whether all CANIDs meet the sending conditions during the periodic task execution of the present invention.

[0035] Figure 3 The present invention is a flow chart for judging whether the CANID of a multiplexed mailbox is sent during the execution of a periodic task. DETAILED DESCRIPTION

[0036] In order to more clearly describe the technical content of the present invention, further description is given below in conjunction with specific embodiments.

[0037] Before describing in detail embodiments according to the present invention, it should be noted that, hereinafter, the terms "comprises", "includes" or any other variations are intended to cover non-exclusive inclusion, whereby a process, method, article or apparatus comprising a series of elements includes not only these elements, but also other elements not explicitly listed or inherent to such process, method, article or apparatus.

[0038] The sending mechanism control method of the CAN multiplexing mailbox, wherein the method comprises the following steps:

[0039] (1) All CANIDs in the current customer requirements are sorted and grouped according to preset rules;

[0040] (2) Create arrays A and B according to the grouping conditions to store all CANIDs and MCU mailboxes respectively;

[0041] (3) Identify whether there is a CANID in the array A that meets the sending condition. If so, directly use the multiplexing mailbox function in the array B and enter step (4). Otherwise, do not perform any operation;

[0042] (4) In the array B, corresponding identification processing is performed on the multiplexed mailboxes that need to execute the sending queue.

[0043] As a preferred embodiment of the present invention, the step (1) is specifically:

[0044] Based on all the CANIDs currently obtained, grouping is performed according to the grouping principle with small bit differences, and the final number of groups is equal to the number of mailboxes of the microcontroller.

[0045] As a preferred embodiment of the present invention, the size of the array A is equal to the number of all CANIDs in the current customer demand;

[0046] The size of the array B is equal to the number of microcontroller mailboxes and is used for initialization processing of CAN registers.

[0047] As a preferred embodiment of the present invention, the step (3) specifically comprises the following steps:

[0048] (3.1) Determine whether there is a CANID in the array A that meets the sending conditions. If so, proceed to step (3.2). Otherwise, terminate the current process directly.

[0049] (3.2) Determine whether the current CANID uses a multiplexing mailbox. If so, directly fill the current CANID into the sending queue of the corresponding multiplexing mailbox; otherwise, go to step (3.3);

[0050] (3.3) Directly call the CAN sending function to send the current CANID.

[0051] As a preferred implementation of the present invention, the step (3) is performed within the sending cycle of the preset periodic task.

[0052] As a preferred embodiment of the present invention, the step (4) specifically comprises the following steps:

[0053] (4.1) Identify whether there is CAN data to be sent in the sending queue of all the multiplexed mailboxes in the array B. If the sending queue is empty, no operation is performed; if there is data to be sent in the sending queue, go to step (4.2);

[0054] (4.2) Send the first CANID to be sent in the sending queue of all multiplexed mailboxes to complete the CANID sending function.

[0055] As a preferred embodiment of the present invention, the step (4.2) further includes:

[0056] It is necessary to first configure the multiplexing mailbox to the current CANID, and then call the underlying CAN sending function to send this CANID.

[0057] As a preferred embodiment of the present invention, the step (4) further comprises:

[0058] The timer interrupt function is turned on, and step (4) is triggered to execute within the interval time.

[0059] In practical applications, the processing logic of this technical solution is as follows:

[0060] 1. Sort out all CANIDs required by customers and group them according to the principle that those with small bit differences are in the same group. The final number of groups is equal to the number of mailboxes of the microcontroller.

[0061] 2. Create two new arrays in the software code, named array A and array B, such as Figure 1 As shown, the size of array A is equal to the number of CANIDs currently required by customers, and the size of array B is equal to the number of MCU mailboxes. Array B is used to initialize the CAN registers, and a parameter is also required to indicate whether the mailbox will be reused, such as Figure 1 The mailboxes shown as 0, 1, 3, 4, 5, etc. all use multiplexed mailboxes, while mailboxes 2, 6, 7, and 8 do not use multiplexed mailboxes, that is, CANID0 and CANID1 share mailbox number 0; CANID2, CANID3, CANID4, and CANID5 share mailbox number 1; CANID6 uses mailbox number 2 alone and does not share with other CANIDs, and so on; and only the first CANID of each group is filled in array B. Since multiple CANIDs share one mailbox, it is also necessary to reasonably allocate the use of this mailbox to avoid multiple CANIDs occupying this mailbox at the same time, resulting in unsuccessful transmission, or causing the microcontroller to reset due to improper operation of the underlying layer, so it is necessary to disperse the start transmission time of multiple CANIDs.

[0062] 3. Add a periodic task in the software. Its main function is to identify whether the CANID in array A meets the conditions for sending, such as whether the periodic frame meets its sending cycle, etc. If not, no operation is performed; if it is satisfied, it continues to determine whether the multiplexing mailbox function is used. If not, the underlying CAN sending function is directly called to send this CANID out; if the multiplexing mailbox function is used, the CANID is stuffed into the sending queue of the corresponding mailbox number, such as Figure 2 shown.

[0063] 4. Open a timer interrupt in the software, for example, trigger it every 2ms. Each time it is triggered, it identifies whether there is CAN data to be sent in the sending queue of all multiplexed mailboxes. If the sending queue is empty, no operation is performed; if there is data to be sent in the sending queue, the first CANID to be sent in all multiplexed mailboxes is sent. The mailbox needs to be configured to this CANID first, and then the underlying CAN sending function is called to send this CANID. For example, Figure 3 shown.

[0064] In actual applications, CANID is grouped according to the rule of small bit difference. The final number of groups is equal to the number of mailboxes of the microcontroller, and the CANID sending time points of the multiplexed mailboxes are arranged in a dispersed manner.

[0065] In actual applications, the total number of CANIDs exceeds the number of MCU mailboxes. There is no need to change the MCU. All CANIDs can be grouped according to certain rules. CANIDs in the same group share one mailbox. A processing mechanism is added to the software to allow multiple CANIDs to reuse the same mailbox to realize the sending function of all CANs.

[0066] In actual application, the software creates two arrays based on the grouping situation, and includes parameters such as whether to reuse the mailbox and the sending time point, and runs two periodic tasks. The first task mainly identifies whether the sending conditions are met and whether the multiplexing mailbox function is needed. The second task mainly identifies whether there is a sending queue of the multiplexing mailbox that needs to be sent.

[0067] In a specific embodiment of the present invention, the vehicle customer proposes a demand change after the mass production of the body domain controller, and needs to increase the forwarding function of CAN, forward the data sent and received by LIN through CAN, and send the data received by CAN1 through CAN2. An assessment is made based on the customer's needs. For example, 10 CANIDs need to be added, which exceeds the CAN mailbox margin reserved by the original single-chip microcomputer. At this time, the single-chip microcomputer with a larger number of mailboxes needs to be replaced, and the replacement of hardware requires re-certification experiments. This is too costly from the two dimensions of time cycle and component cost. If the CAN multiplexing mailbox sending mechanism of the present invention is used, this problem can be solved, thereby effectively shortening the software development cycle and avoiding hardware changes.

[0068] In a specific embodiment of the present invention, due to the fierce competition in the industry, the cost control of the controller is very strict. If the single-chip microcomputer is selected based on the demand, and it is necessary to select a single-chip microcomputer with a higher specification just because the number of mailboxes is not met, the solution of the present invention can be adopted to select a single-chip microcomputer with a lower specification in the same series and a sending mechanism of a multiplexed mailbox, thereby reducing the physical cost and increasing the market competitiveness of the product.

[0069] The sending mechanism control device of the CAN multiplexing mailbox, wherein the device comprises:

[0070] a processor configured to execute computer executable instructions;

[0071] The memory stores one or more computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned CAN multiplex mailbox sending mechanism control method are implemented.

[0072] The sending mechanism of the CAN multiplexing mailbox controls the processor, wherein the processor is configured to execute computer executable instructions, and when the computer executable instructions are executed by the processor, the steps of the above-mentioned CAN multiplexing mailbox sending mechanism control method are implemented.

[0073] The computer-readable storage medium stores a computer program thereon, and the computer program can be executed by a processor to implement the steps of the above-mentioned method for controlling the sending mechanism of the CAN multiplex mailbox.

[0074] This technical solution has the following characteristics in practical application:

[0075] 1. Reduce costs, no need to replace the microcontroller with a higher specification, and avoid major hardware changes.

[0076] 2. The sending mechanism has good compatibility, can maintain the original software architecture, has few code changes, is highly portable, and can be adapted to different microcontrollers.

[0077] 3. Shorten the development cycle.

[0078] The software code module of this sending function is highly independent and can be easily decoupled. When the required CANID does not exceed the number of single-chip mailboxes, the conventional method is used, that is, one mailbox matches one CANID; when the required CANID continues to increase and the final number exceeds the number of single-chip mailboxes, the solution of the present invention is needed. A fixed number of mailboxes are selected as multiplexed mailboxes, and the other mailboxes remain consistent with the previous ones. The original software architecture is maintained, and the processing mechanism of the multiplexed mailboxes is added. The code changes are small and the portability is strong.

[0079] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0080] It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution device.

[0081] A person of ordinary skill in the art may understand that all or part of the steps of the method for implementing the above-mentioned embodiment may be completed by instructing the relevant hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0082] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0083] In the description of this specification, the description with reference to the terms "an embodiment", "some embodiments", "example", "specific example", or "embodiment" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0084] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

[0085] The sending mechanism control method, device, processor and computer-readable storage medium of the CAN multiplexing mailbox of the present invention are adopted. By adding a processing mechanism for multiple CANIDs to reuse the same mailbox in the software, all CAN sending functions can be realized, avoiding hardware changes, shortening the development cycle, and the sending mechanism has good compatibility and can be adapted to different microcontrollers.

[0086] In this specification, the present invention has been described with reference to specific embodiments thereof. However, it is apparent that various modifications and variations may be made without departing from the spirit and scope of the present invention. Therefore, the specification and drawings should be regarded as illustrative rather than restrictive.

Claims

1. A method for controlling the sending mechanism of a CAN multiplexed mailbox, characterized in that: The method comprises the following steps: (1) All CANIDs in the current customer requirements are sorted and grouped according to preset rules; (2) Create arrays A and B according to the grouping conditions to store all CANIDs and MCU mailboxes respectively; (3) Identify whether there is a CANID in the array A that meets the sending condition. If so, directly use the multiplexing mailbox function in the array B and enter step (4). Otherwise, do not perform any operation; (4) In the array B, corresponding identification processing is performed on the multiplexed mailboxes that need to execute the sending queue.

2. The method for controlling the sending mechanism of a CAN multiplexed mailbox according to claim 1, characterized in that: The step (1) is specifically as follows: Based on all the CANIDs currently obtained, grouping is performed according to the grouping principle with small bit differences, and the final number of groups is equal to the number of mailboxes of the microcontroller.

3. The method for controlling the sending mechanism of a CAN multiplexed mailbox according to claim 1, characterized in that: The size of the array A is equal to the number of all CANIDs in the current customer demand; The size of the array B is equal to the number of microcontroller mailboxes and is used for initialization processing of CAN registers.

4. The method for controlling the sending mechanism of a CAN multiplex mailbox according to claim 3, characterized in that: The step (3) specifically comprises the following steps: (3.1) Determine whether there is a CANID in the array A that meets the sending conditions. If so, proceed to step (3.2). Otherwise, terminate the current process directly. (3.2) Determine whether the current CANID uses a multiplexing mailbox. If so, directly fill the current CANID into the sending queue of the corresponding multiplexing mailbox; otherwise, go to step (3.3); (3.3) Directly call the CAN sending function to send the current CANID.

5. The method for controlling the sending mechanism of a CAN multiplex mailbox according to claim 4, characterized in that: The step (3) is performed within the sending cycle of the preset periodic task.

6. The method for controlling the sending mechanism of a CAN multiplex mailbox according to claim 4, characterized in that: The step (4) specifically comprises the following steps: (4.1) Identify whether there is CAN data to be sent in the sending queue of all the multiplexed mailboxes in the array B. If the sending queue is empty, no operation is performed; if there is data to be sent in the sending queue, go to step (4.2); (4.2) Send the first CANID to be sent in the sending queue of all multiplexed mailboxes to complete the CANID sending function.

7. The method for controlling the sending mechanism of a CAN multiplexed mailbox according to claim 6, characterized in that: The step (4.2) further comprises: It is necessary to first configure the multiplexing mailbox to the current CANID, and then call the underlying CAN sending function to send this CANID.

8. The method for controlling the sending mechanism of a CAN multiplex mailbox according to claim 6, characterized in that: The step (4) further comprises: The timer interrupt function is turned on, and step (4) is triggered to execute within the interval time.

9. A sending mechanism control device for a CAN multiplex mailbox, characterized in that: The device comprises: a processor configured to execute computer executable instructions; A memory stores one or more computer executable instructions, and when the computer executable instructions are executed by the processor, the steps of the method for controlling the sending mechanism of the CAN multiplexing mailbox according to any one of claims 1 to 8 are implemented.

10. A CAN multiplex mailbox transmission mechanism control processor, characterized in that: The processor is configured to execute computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the method for controlling the sending mechanism of the CAN multiplexing mailbox described in any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program can be executed by a processor to implement the steps of the method for controlling the sending mechanism of a CAN multiplexing mailbox according to any one of claims 1 to 8.

Citation Information

Cited By

  • Message processing method and device, computer readable storage medium and product

    CN121441878A