Chip and memory management method

By adjusting the chip's memory management method in the CAN bus communication network and using control parameters and mapping tables to optimize the size and number of message storage areas, the problem of low memory utilization efficiency is solved, efficient message storage and transmission are achieved, and costs are reduced.

CN120803983APending Publication Date: 2025-10-17SILERGY SEMICON TECH (HANGZHOU) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510898944.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In a CAN bus communication network, the message storage area in the memory is used inefficiently, especially in the case of multiple CAN controllers, where it is difficult to efficiently allocate and manage the message storage area.

Method used

By setting memory, registers and multiple CAN controllers in the chip, using the first and second control parameters to adjust the size and number of message storage areas, generating a mapping table to achieve the correspondence between message storage addresses and memory addresses, dynamically adjusting the message storage areas corresponding to the CAN controllers, and realizing efficient transmission and reception of messages.

Benefits of technology

Without increasing the memory size, the efficiency of the message storage area is improved, the message sending and receiving requirements of different CAN controllers are met, and the cost is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803983A_ABST
    Figure CN120803983A_ABST
Patent Text Reader

Abstract

The invention provides a chip and a memory management method. The chip comprises a memory, a register and a plurality of CAN controllers. The memory comprises a plurality of message storage areas. The plurality of message storage areas correspond to the plurality of CAN controllers, each message storage area comprises a plurality of storage intervals, each storage interval is used for storing a message, and the CAN controllers transmit and receive messages through the corresponding message storage areas. The register includes a first control parameter and a second control parameter of each CAN controller. The first control parameter is used for determining the size of a storage interval in a message storage area corresponding to the CAN controller, and the second control parameter is used for determining the number of the message storage areas corresponding to the CAN controller. According to the message receiving and sending condition of the user, the number of the message storage areas which can be accessed by the CAN controller is adjusted, and the use efficiency of the message storage areas is improved while the total size of the message storage areas is not increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of integrated circuits, and in particular to a chip and a memory management method. BACKGROUND

[0002] CAN (Controller Area Network) is a kind of serial communication network widely used in the field of automobile, industrial control, etc. Multiple communication units realize mutual communication through CAN bus broadcasting messages. The communication unit includes a memory for storing messages. When the communication unit includes multiple CAN controllers, it is necessary to allocate message storage areas in the memory for multiple CAN controllers. The use efficiency of the message storage area in the memory needs to be improved. SUMMARY

[0003] The present application provides a chip and a memory management method, which can improve the use efficiency of the message storage area in the memory.

[0004] An aspect of an embodiment of the present application provides a chip. The chip includes a memory, a register, and multiple CAN controllers. The memory includes multiple message storage areas. The multiple message storage areas correspond to the multiple CAN controllers, each message storage area includes multiple storage areas, each storage area is used to store a message, and the CAN controller transmits and receives messages through the corresponding message storage area. The register includes a first control parameter and a second control parameter of each CAN controller. The first control parameter is used to determine the size of the storage area in the message storage area corresponding to the CAN controller, and the second control parameter is used to determine the number of message storage areas corresponding to the CAN controller.

[0005] In some embodiments, the chip further includes a processor, the processor generates a mapping table of the CAN controller according to the first control parameter and the second control parameter, the mapping table is used to represent the correspondence between the message storage address and the memory address, the message storage address is an address recognized by the CAN controller, and the memory address is an address recognized by the memory.

[0006] In some embodiments, the memory is a static random access memory.

[0007] In some embodiments, the multiple message storage areas have the same size, and the storage areas in the message storage area corresponding to the CAN controller have the same size.

[0008] In some embodiments, when the first control parameter takes a first value, a second value, a third value, and a fourth value, the size of the storage area is a first length, a second length, a third length, and a fourth length, respectively.

[0009] In some embodiments, the first length is 16 bytes, the second length is 24 bytes, the third length is 40 bytes, and the fourth length is 72 bytes.

[0010] In some embodiments, when the number of messages required to be transmitted and received by the CAN controller is greater than a threshold value, the mapping table and the second control parameter are modified so that the CAN controller corresponds to more message storage areas.

[0011] In some embodiments, each storage area is used to store an identification segment, a control segment, and a data segment of a message.

[0012] In some embodiments, the register further includes a third control parameter for each CAN controller, the third control parameter being used to control whether the CAN controller is in an active state or an inactive state.

[0013] In some embodiments, the plurality of CAN controllers includes a first CAN controller, the plurality of message storage areas includes a first message storage area and a second message storage area, the first CAN controller corresponds to the first message storage area and the second message storage area, the message storage addresses MB1 to MB Y correspond to the first message storage area, and Y is a positive integer. Y+1 correspond to the second message storage area.

[0014] Another aspect of the embodiments of the present application provides a memory management method of a chip, the chip including a memory, a register, and a plurality of CAN controllers, the memory including a plurality of message storage areas, the plurality of message storage areas corresponding to the plurality of CAN controllers, each message storage area including a plurality of storage areas, each storage area being used to store a message, and the CAN controllers performing message transmission and reception through corresponding message storage areas. The memory management method includes: determining whether the number of messages required to be transmitted and received by the CAN controller is greater than a threshold value, the threshold value being configured to represent the maximum number of messages expected to be stored by the message storage area currently corresponding to the CAN controller; modifying the second control parameter and the mapping table so that the CAN controller corresponds to at least two message storage areas, wherein the second control parameter is stored in the register, and the second control parameter is used to determine the number of message storage areas corresponding to the CAN controller; and the CAN controller performing message transmission and reception through corresponding message storage areas.

[0015] In some embodiments, the mapping table is used to represent the correspondence between the message storage addresses and the memory addresses, wherein the message storage addresses are addresses recognized by the CAN controllers, and the memory addresses are addresses recognized by the memory.

[0016] The application provides a chip and a memory management method of the chip. The chip comprises a memory, a register and a plurality of CAN controllers. The memory comprises a plurality of message storage areas. The plurality of message storage areas correspond to the plurality of CAN controllers, each of the message storage areas comprises a plurality of storage intervals, each of the storage intervals is used for storing a message, and the CAN controllers transmit and receive messages through the corresponding message storage areas. The register comprises a first control parameter and a second control parameter of each CAN controller. The first control parameter is used for determining the size of the storage interval in the message storage area corresponding to the CAN controller, and the second control parameter is used for determining the number of the message storage areas corresponding to the CAN controller. The number of the message storage areas accessible by the CAN controller is adjusted by adjusting the control parameters. When the number of the messages required to be transmitted and received by the CAN controller is large, the CAN controller corresponds to a plurality of message storage areas, so that the use efficiency of the message storage areas is improved without increasing the size of each message storage area. The chip of the application can utilize the space of the memory to the maximum extent, and can meet the number requirement of the different messages transmitted and received by each CAN controller without increasing the size of the memory, so that the cost is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0017] The above and other objects, features and advantages of the present application will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:

[0018] Figure 1 is a schematic block diagram of the chip of the application;

[0019] Figure 2 is a schematic diagram of the message of the application;

[0020] Figure 3 is a schematic block diagram of the memory of the application;

[0021] Figure 4 is a schematic diagram of the message storage area in the memory of the application;

[0022] Figure 5 is a schematic diagram of the mapping table of the application;

[0023] Figure 6 the control parameters in the register are shown;

[0024] Figure 7 the mapping tables before and after the user setting are shown;

[0025] Figure 8 another mapping table before and after the user setting is shown;

[0026] Figure 9The three user settings of the present application are shown to correspond to the changes of the message storage area;

[0027] Figure 10 is a flowchart of the memory management method of the chip of the present application. DETAILED DESCRIPTION

[0028] The present application is described below based on embodiments, but the present application is not limited to only these embodiments. In the following detailed description of the present application, some specific details are described in detail. The present application can also be fully understood without the description of these details. In order to avoid confusion of the essence of the present application, well-known methods, processes, flows, elements and circuits are not described in detail.

[0029] Unless the context clearly requires otherwise, throughout the application, the terms "comprise", "comprising", "included", "including" or the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense that receives only those components listed after the term to which "comprise", "comprising", "included", "including" or the like are used.

[0030] In the description of the present application, it should be understood that the terms "first", "second" and the like are used only for the purpose of description and should not be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "multiple" is two or more.

[0031] The present application provides a chip. The chip can be arranged in a CAN network and communicate with other nodes in the CAN network. The chip is, for example, a microcontroller unit (MCU), an electronic control unit (ECU), a domain controller of a vehicle, etc.

[0032] Figure 1 is a schematic structural block diagram of the chip. The chip includes a processor 200, a memory 300, a register 400 and a plurality of CAN controllers 101-104. The processor 200 is, for example, a CPU of ARM or RISC-V architecture. The memory 300 is, for example, a static random-access memory (SRAM). The plurality of CAN controllers 101-104 send or receive CAN messages through a CAN transceiver module 500. The CAN transceiver module 500 includes one or more CAN transceivers. The plurality of CAN controllers 101-104 share one CAN transceiver, or at least two of the plurality of CAN controllers 101-104 share one CAN transceiver, or each CAN controller corresponds to one CAN transceiver. In some embodiments, the chip further includes one or more of an analog-to-digital converter, a digital-to-analog converter, a counter, and a flash memory. The number of CAN controllers in the chip is an integer greater than or equal to 2.Figure 1 The exemplary chip includes four CAN controllers. The present application does not limit the specific number of CAN controllers.

[0033] CAN messages to be sent and received by the CAN controllers 101-104 are stored in the memory 300. The registers 400 store control parameters of the CAN controllers 101-104.

[0034] Exemplary CAN message types include: data frame, remote frame, error frame, overload frame, etc. Figure 2 An exemplary CAN message structure is shown. A CAN message includes: start segment, identification segment, control segment, data segment, check segment, response segment, and end segment. The data segment is information that the chip and other CAN network nodes need to interact. The identification segment is used to indicate the priority of the CAN message or to determine whether the CAN message is a desired message. The check segment is used to ensure the accuracy of data transmission. In one embodiment, the control segment includes a data length code. The data length code is used to indicate the length of the data segment. For example, the data length code indicates how many bytes the data segment includes.

[0035] As shown in FIG. 4, a CAN message includes a storage segment and a non-storage segment. The storage segment is stored in the memory 300, and the non-storage segment does not need to be stored in the memory 300. Taking message sending as an example, the processor 200 stores the storage segment in the memory 300, and the CAN controller obtains the storage segment from the memory 300, generates the non-storage segment of the CAN message according to the storage segment, and then sends the complete CAN message to the CAN bus through the CAN transceiver. Taking message receiving as an example, the CAN controller receives the complete CAN message through the CAN transceiver, parses the storage segment therein, and stores the storage segment in the memory 300. Figure 2

[0036] The storage segment includes at least the data segment. Exemplarily, the storage segment includes the identification segment, the control segment, and the data segment. As shown in FIG. 5, the storage segment includes the identification segment, the control segment, the data segment, and a check segment. The check segment is used to ensure the accuracy of data transmission. Figure 2 ​As shown, the length of the data segment is N byte, the length of the storage segment is N+Q byte, and the length of the CAN message is M byte, M, N and Q are integers, and M is greater than N. Exemplarily, N is greater than or equal to 0 and less than or equal to 64. Exemplarily, Q is equal to 2. Exemplarily, when the length of the data segment of the message is 8 byte (2 word), the length of the storage segment of the message is 16 byte (4 word); when the length of the data segment of the message is 16 byte (4 word), the length of the storage segment of the message is 24 byte (6 word); when the length of the data segment of the message is 32 byte (8 word), the length of the storage segment of the message is 40 byte (6 word); and when the length of the data segment of the message is 64 byte (16 word), the length of the storage segment of the message is 72 byte (10 word).

[0037] Exemplarily, when the CAN controller sends a message, the CAN controller obtains the identification segment, the control segment and the data segment of the message to be sent from the memory 300, the CAN controller generates the start segment, the check segment, the response segment and the end segment, thereby generating a complete CAN message, and the CAN controller sends the complete CAN message to the CAN bus through the CAN transceiver module 500. Exemplarily, when the CAN controller receives a CAN message, the CAN controller parses the identification segment, the control segment and the data segment from the complete CAN message, and stores the identification segment, the control segment and the data segment into the memory 300.

[0038] Exemplarily, the memory 300 includes a control circuit and an array of storage units. For example, the storage unit stores 1 bit data, and the storage unit includes two inverters. The control circuit addresses the storage units according to the memory address. For example, the control circuit performs row decoding and column decoding based on the memory address to determine the storage unit corresponding to the memory address. Figure 3 is a schematic block diagram of the memory 300. The memory 300 includes a plurality of message storage areas 301-304. The message storage areas 301-304 are memory areas for CAN message transmission and reception. Specifically, the message storage areas 301-304 are used to store the storage segments of the CAN messages to be sent and the storage segments of the received CAN messages. The plurality of message storage areas 301-304 correspond to the plurality of CAN controllers 101-104, and the CAN controllers perform message transmission and reception through the corresponding message storage areas. Each message storage area 301-304 stores the storage segments of at least two CAN messages. Each message storage area corresponds to at most one CAN controller at the same time.

[0039] Figure 4is a schematic diagram of a message storage area. Each message storage area includes a plurality of storage sections, and each storage section includes a plurality of storage units 1-n, and each storage section is used to store a storage segment of a CAN message. The size of the storage section is greater than or equal to the length of the storage segment of the CAN message. Each storage section corresponds to a message storage address.

[0040] When transmitting and receiving messages, the CAN controller uses the message storage address. For example, the message storage address is a logical address, and the memory address is a physical address. Exemplarily, the message storage addresses are consecutive. The memory 300 also stores a mapping table. The mapping table is used to represent the correspondence between the message storage address and the memory address. The storage unit corresponding to the memory address is in the message storage area corresponding to the CAN controller. Exemplarily, the memory 300 stores a mapping table for each CAN controller. The control circuit of the memory 300 can perform conversion between the message storage address and the memory address according to the mapping table.

[0041] When the CAN controller needs to send a message, the CAN controller sends the message storage address to the memory 300, and the memory 300 determines the corresponding memory address according to the mapping table and sends the message storage segment in the storage unit corresponding to the memory address to the CAN controller.

[0042] When the CAN controller receives a message, the CAN controller sends the message storage address and the message storage segment to the memory 300, and the memory 300 determines the corresponding memory address according to the mapping table and stores the message storage segment in the corresponding storage unit.

[0043] Each message storage area corresponds to one of a plurality of CAN controllers. The message storage area and the CAN controller "correspond" means that the message storage address recognized by the CAN controller can be mapped to the memory address of the message storage area. In this application, at least two message storage areas can correspond to the same CAN controller.

[0044] Exemplarily, the number of message storage areas is equal to the number of CAN controllers. In this way, when there is one CAN controller corresponding to at least two message storage areas, there is another CAN controller without corresponding message storage areas.

[0045] Figure 5 An exemplary mapping table is shown. Referring to Figure 4 and Figure 5 , the message storage address MB1 corresponds to the memory address 1, and both correspond to the storage section 1; the message storage address MB2 corresponds to the memory address 2, and both correspond to the storage section 2; … the message storage address MB 32The memory address 32 corresponds to the memory address 32, and both correspond to the storage interval 32. The CAN controllers need to transmit and receive messages in turn in the storage intervals 1-32. The memory 300 determines the corresponding memory address of the message storage address according to the mapping table. The storage units indicated by the memory addresses 1-32 are in the message storage area corresponding to the CAN controller. For example, the storage intervals of the message storage area corresponding to the same CAN controller have the same size. For example, the CAN controller 101 corresponds to the message storage area 301, and the storage intervals in the message storage area 301 have the same size. For another example, the CAN controller 101 corresponds to the message storage areas 301 and 302, and the storage intervals in the message storage areas 301 and 302 have the same size. For example, the message storage areas 301-304 have the same size. For example, the sizes of the message storage areas 301-304 are preset and cannot be changed by the user. The number n of storage intervals is determined by the size of the message storage area and the size of the storage interval.

[0046] Figure 6 The control parameters stored in the register 400 are shown. Each CAN controller has a corresponding set of control parameters. As shown, the CAN controllers 101-104 correspond to the control parameter sets 401-404, respectively. The control parameter sets 401-404 are modified by the processor 200. As shown, each CAN controller has a first control parameter and a second control parameter. Figure 6 Figure 6

[0047] The first control parameter is used to determine the size of the storage interval in the message storage area corresponding to the CAN controller. For example, when the first control parameter is a first value, the size of the storage interval is a first length; when the first control parameter is a second value, the size of the storage interval is a second length; when the first control parameter is a third value, the size of the storage interval is a third length; and when the first control parameter is a fourth value, the size of the storage interval is a fourth length. For example, the first length is 16 bytes (4 words), the second length is 24 bytes (6 words), the third length is 40 bytes (10 words), and the fourth length is 72 bytes (18 words).

[0048] ​​When the length of the data segment of a CAN message is less than or equal to 8 bytes, the storage segment of the CAN message can be stored in a 16-byte storage interval. When the length of the data segment of a CAN message is less than or equal to 16 bytes, the storage segment of the CAN message can be stored in a 24-byte storage interval. When the length of the data segment of a CAN message is less than or equal to 32 bytes, the storage segment of the CAN message can be stored in a 40-byte storage interval. When the length of the data segment of a CAN message is less than or equal to 64 bytes, the storage segment of the CAN message can be stored in a 72-byte storage interval. For example, when the storage interval is 16 bytes and the length of the data segment of the CAN message is greater than 8 bytes, the chip cannot receive the CAN message.

[0049] The second control parameter is used to determine the number of message storage areas corresponding to the CAN controller. For example, when the second control parameter of the CAN controller 101 is a first value, the CAN controller 101 corresponds to one message storage area; when the second control parameter of the CAN controller 101 is a second value, the CAN controller 101 corresponds to two message storage areas; when the second control parameter of the CAN controller 101 is a third value, the CAN controller 101 corresponds to three message storage areas; and when the second control parameter of the CAN controller 101 is a fourth value, the CAN controller 101 corresponds to four message storage areas.

[0050] In some embodiments, as Figure 6 As shown, each CAN controller has a third control parameter. The third control parameter is used to control whether the corresponding CAN controller is in an active state or a disabled state. For example, when the third control parameter is a first value, the corresponding CAN controller is in an active state and can send and receive messages; when the third control parameter is a second value, the corresponding CAN controller is in a disabled state and cannot send or receive messages.

[0051] The first control parameter, the second control parameter, and the third control parameter can be set by the user. The user can determine the maximum length of the data segment of the CAN message according to the usage scenario of the chip, and select a storage interval of appropriate size according to the maximum length of the data segment of the CAN message to select the appropriate first control parameter. For example, the maximum length of the data segment of the CAN message used in the chip usage scenario is 16 bytes, the first control parameter can select the second value, and the size of the storage interval is 24 bytes. The processor 200 creates a mapping table for the CAN controller based on the first control parameter and the second control parameter. When the size of the message storage area and the size of the storage interval are determined, the processor 200 can calculate how many storage intervals the message storage area includes, that is, how many messages a message storage area can store. When the message storage area corresponding to the CAN controller is determined, the processor 200 can further generate a mapping table for the CAN controller.

[0052] For example, the size of a message storage area is 64*8 bytes, the storage interval size determined by the first control parameter is 16 bytes, and the CAN controller is determined to correspond to a message storage area according to the second control parameter. The CAN controller can use 32 message addresses MB1-MB 32 , 32 message addresses correspond to 32 storage intervals of the message storage area. For another example, the size of a message storage area is 64*8 bytes, the storage interval size determined by the first control parameter is 16 bytes, and the CAN controller is determined to correspond to two message storage areas according to the second control parameter. The CAN controller can use 64 message addresses MB1-MB 64 , 64 message addresses correspond to 64 storage intervals of the two message storage areas. For another example, the size of a message storage area is 64*8 bytes, the storage interval size determined by the first control parameter is 40 bytes, and the CAN controller is determined to correspond to two message storage areas according to the second control parameter. The CAN controller can use 24 message addresses MB1-MB 24 The 24 message addresses correspond to 24 memory intervals in the two message storage areas. This allows the user to configure the number of CAN transceivers used and the amount of memory they can access based on actual needs. When a CAN controller needs to send and receive a large number of messages, it allocates multiple message storage areas, thereby improving storage efficiency without increasing the size of each area.

[0053] In some embodiments, the first control parameter, the second control parameter and the third control parameter have default values. When the user does not set the first control parameter, the second control parameter and the third control parameter, the values of the first control parameter, the second control parameter and the third control parameter are the default values. Exemplarily, when the first control parameter, the second control parameter and the third control parameter are the default values, the CAN transceiver 101 corresponds to the message storage area 301, the CAN transceiver 102 corresponds to the message storage area 302, the CAN transceiver 103 corresponds to the message storage area 303, the CAN transceiver 104 corresponds to the message storage area 304, and the size of the storage area interval in the message storage areas 301-304 is the first length.

[0054] The user can select the first control parameter and the second control parameter in the following manner. The first control parameter is determined by the maximum length of the data segment of the message to be transmitted and received. Here, the selection of the second control parameter is mainly discussed. When the number of CAN messages to be transmitted and received by one of the CAN controllers 101-104 is greater than a threshold value, the processor 200 causes the CAN controller to correspond to more message storage areas, for example, at least two message storage areas. For example, when the CAN controller needs to transmit and receive m CAN messages, and m is greater than the threshold value, the processor 200 causes the CAN controller to correspond to at least two message storage areas. The threshold value represents the maximum number of messages expected to be stored in the message storage area currently corresponding to the CAN controller. Taking the size of each message storage area as 64*8 bytes as an example, when the maximum length of the data segment of the CAN message is 8 bytes, a storage area interval with a size of 16 bytes is needed, the threshold value is 32, and the number of CAN messages to be transmitted and received is 32, the user can select to cause the CAN controller to correspond to one message storage area. When the maximum length of the data segment of the CAN message is 8 bytes, a storage area interval with a size of 16 bytes is needed, the threshold value is 32, and the number of CAN messages to be transmitted and received is 64, the user can select to cause the CAN controller to correspond to two message storage areas. When the maximum length of the data segment of the CAN message is 16 bytes, a storage area interval with a size of 24 bytes is needed, the threshold value is 21, and the number of CAN messages to be transmitted and received is 60, the user can select to cause the CAN controller to correspond to three message storage areas.

[0055] Figure 7 An exemplary mapping table before and after the user sets is shown. When the first control parameter, the second control parameter and the third control parameter are the default values, the CAN controller 101 corresponds to the message storage area 301, the CAN controller 102 corresponds to the message storage area 302, the CAN controller 101 recognizes the message storage addresses as MB1, MB2, MB3…MB 32, the corresponding memory addresses are memory address 1 - memory address 32. The user sets the first control parameter to the first value and the second control parameter to the second value. Each message storage address corresponds to a 16-byte storage interval. The CAN controller 101 corresponds to two message storage areas. The CAN controller 101 corresponds to message storage area 301 and message storage area 302. The message storage addresses recognized by the CAN controller 101 are MB1, MB2, MB3...MB 64 , the corresponding memory address is memory address 1-memory address 64. Among them, the message storage address is MB1-MB 32 The storage unit indicated by the corresponding memory address is in the message storage area 301, and the message storage address is MB 33 -MB 64 The storage unit indicated by the corresponding memory address is in the message storage area 302 . Figure 7 The mapping table shown is a mapping table of the CAN controller 101. By setting the value of the third control parameter, the CAN controller 102 is turned off. For example, after the CAN controller 102 is turned off, the message storage address identified by the CAN controller 102 has no corresponding memory address.

[0056] Figure 8 Another mapping table before and after user settings is shown. When the first control parameter, the second control parameter and the third control parameter are the default values, the CAN controller 101 corresponds to the message storage area 301, the CAN controller 102 corresponds to the message storage area 302, and the message storage addresses recognized by the CAN controller 101 are MB1, MB2, MB3...MB 32 , the corresponding memory addresses are memory address 1 - memory address 32. The user sets the first control parameter to the third value and the second control parameter to the second value. Each message storage address corresponds to a 40-byte storage interval. The CAN controller 101 corresponds to two message storage areas, CAN controller 101 corresponds to message storage area 301 and message storage area 302. The message storage addresses recognized by the CAN controller 101 are MB1, MB2, MB3...MB 24 , the corresponding memory address is memory address 1'-memory address 24'. Among them, the message storage address is MB1-MB 12 The storage unit indicated by the corresponding memory address is in the message storage area 301, and the message storage address is MB 13 -MB 24 The storage unit indicated by the corresponding memory address is in the message storage area 302 . Figure 8 The mapping table shown is a mapping table of the CAN controller 101. By rewriting the third control parameter, the CAN controller 102 is turned off. For example, after the CAN controller 102 is turned off, the message storage address identified by the CAN controller 102 has no corresponding memory address.

[0057] Figure 9 The change of message storage area corresponding to three user settings of the application is shown. When the first control parameter, the second control parameter and the third control parameter are default values, the CAN controllers 101-104 and the message storage areas 301-304 are one-to-one corresponding. Taking the size of the message storage area as 64*8 byte, the first control parameter as the default value (the first value) and the length of the storage area as 16 byte as an example for illustration. The maximum length of the storage segment of the message which the user needs to transmit and receive is 8 byte, and the first control parameter keeps the first value.

[0058] The maximum number of messages (i.e. the threshold value) which the message storage area 301 corresponding to the CAN controller 101 is expected to store is 32, i.e. the message storage area 301 can store 32 storage segments of CAN messages.

[0059] When the number of CAN messages which the CAN controller 101 needs to receive or transmit is greater than the threshold value, the CAN controller 101 is set to correspond to more message storage areas.

[0060] When the number of CAN messages which the CAN controller 101 needs to receive or transmit is greater than 32 and less than or equal to 64, the second control parameter is set to the second value, and the processor 200 rewrites the mapping table in mode (1) so that the CAN controller 101 corresponds to the message storage areas 301 and 302, and the CAN controller 102 is closed.

[0061] When the number of CAN messages which the CAN controller 101 needs to receive or transmit is greater than 64 and less than or equal to 96, the second control parameter is set to the third value, and the processor 200 rewrites the mapping table in mode (2) so that the CAN controller 101 corresponds to the message storage areas 301, 302 and 303, and the CAN controllers 102 and 103 are closed.

[0062] When the number of CAN messages which the CAN controller 101 needs to receive or transmit is greater than 96, the second control parameter is set to the fourth value, and the processor 200 rewrites the mapping table in mode (3) so that the CAN controller 101 corresponds to the message storage areas 301-304, and the CAN controllers 102-104 are closed.

[0063] As described above, the user rewrites the control parameters, and the processor 200 modifies the mapping table according to the modified control parameters so that the CAN controller which needs larger message storage space corresponds to more message storage areas. In this way, without increasing the memory, the storage space corresponding to each CAN controller is increased, the number of CAN messages which can be transmitted is increased, and the use efficiency of the memory is improved.

[0064] The application also provides a memory management method. The memory management method can be applied to the chip shown. Figure 1 The chip is shown.Figure 10 As shown, the method comprises the following steps.

[0065] In step S101, it is determined that the number of CAN messages to be transmitted and received by the CAN controller is greater than a threshold value. First, the maximum length of the data segment of the CAN message is determined according to the use requirement of the chip, and the size of the storage interval is selected according to the maximum length of the data segment, i.e., the first control parameter is set. After setting the first control parameter, the storage interval can store the CAN message with the maximum data segment length. Then, the maximum number of messages that the current message storage area corresponding to the CAN controller can expect to store is determined, i.e., the threshold value is determined. Therefore, the threshold value is configured to represent the maximum number of messages that the current message storage area corresponding to the CAN controller can expect to store, i.e., the number of the current message storage interval corresponding to the CAN controller.

[0066] In step S102, the second control parameter and the mapping table are modified so that the CAN controller corresponds to at least two message storage areas. The mapping table is used to represent the correspondence between the message storage address and the memory address. An exemplary mapping table is shown in Figure 5 As shown. An exemplary mapping table is rewritten as shown in Figure 7-9

[0067] In step S103, the CAN controller transmits and receives messages through the corresponding message storage area.

[0068] Other aspects of the memory management method can refer to the content of the chip embodiment.

[0069] The above description is only the preferred embodiment of the present application and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.​

Claims

1. A chip, comprising: Memory, including multiple message storage areas; register; as well as Multiple CAN controllers; The multiple message storage areas correspond to the multiple CAN controllers, each of the message storage areas includes multiple storage intervals, each of the storage intervals is used to store a message, and the CAN controller sends and receives messages through the corresponding message storage area. The register includes a first control parameter and a second control parameter of each of the CAN controllers, The first control parameter is used to determine the size of the storage interval in the message storage area corresponding to the CAN controller, and the second control parameter is used to determine the number of the message storage areas corresponding to the CAN controller.

2. The chip according to claim 1, characterized in that The chip also includes a processor, which generates a mapping table of the CAN controller based on the first control parameter and the second control parameter. The mapping table is used to characterize the correspondence between the message storage address and the memory address. The message storage address is the address recognized by the CAN controller, and the memory address is the address recognized by the memory.

3. The chip according to claim 1, characterized in that The memory is static random access memory.

4. The chip according to claim 1, characterized in that The multiple message storage areas have the same size, and the storage intervals in the message storage areas corresponding to the CAN controller have the same size.

5. The chip according to claim 1, characterized in that When the first control parameter takes the first value, the second value, the third value, and the fourth value, the sizes of the storage interval are the first length, the second length, the third length, and the fourth length respectively.

6. The chip according to claim 5, characterized in that The first length is 16 bytes, the second length is 24 bytes, the third length is 40 bytes, and the fourth length is 72 bytes.

7. The chip according to claim 2, characterized in that When the number of messages that the CAN controller needs to send and receive is greater than a threshold, the mapping table and the second control parameter are modified so that the CAN controller corresponds to more message storage areas.

8. The chip according to claim 1, characterized in that The storage interval is used to store the identification segment, control segment and data segment of the message.

9. The chip according to claim 1, characterized in that The register further includes a third control parameter of each of the CAN controllers, where the third control parameter is used to control whether the CAN controller is in an active state or an inactive state.

10. The chip according to claim 2, characterized in that The multiple CAN controllers include a first CAN controller, the multiple message storage areas include a first message storage area and a second message storage area, the first CAN controller corresponds to the first message storage area and the second message storage area, the message storage addresses MB1 to MB Y Corresponding to the first message storage area, the message storage address MB Y+1 Corresponding to the second message storage area, Y is a positive integer.

11. A memory management method for a chip, wherein the chip includes a memory, a register, and multiple CAN controllers, the memory includes multiple message storage areas, the multiple message storage areas correspond to the multiple CAN controllers, each message storage area includes multiple storage intervals, each storage interval is used to store a message, and the CAN controller sends and receives messages through the corresponding message storage area, characterized in that: include: determining that the number of messages that the CAN controller needs to send and receive is greater than a threshold, where the threshold is configured to represent a maximum number of messages that the message storage area currently corresponding to the CAN controller is expected to store; Modifying a second control parameter and a mapping table so that the CAN controller corresponds to at least two of the message storage areas, wherein the second control parameter is stored in the register and is used to determine the number of message storage areas corresponding to the CAN controller; and The CAN controller sends and receives messages through the corresponding message storage area.

12. The memory management method according to claim 11, wherein: The mapping table is used to characterize the correspondence between the message storage address and the memory address, wherein the message storage address is the address recognized by the CAN controller, and the memory address is the address recognized by the memory.

Citation Information

Patent Citations

  • A CAN hub and a processing method of data information

    CN109274568A

  • Memory collaborative management system and method

    CN115269450A

  • Data transmission method and system and electronic equipment

    CN116915879A

  • Device for improving frame receiving efficiency of CAN (Controller Area Network) bus

    CN117478609A

  • RAM space dynamic sharing method for multiple CAN communication modules in vehicle gauge level domain control MCU

    CN117873930A