CN107547441A - CAN message filtering analytic method, system and electronic control unit - Google Patents

CAN message filtering analytic method, system and electronic control unit Download PDF

Info

Publication number
CN107547441A
CN107547441A CN201710743658.5A CN201710743658A CN107547441A CN 107547441 A CN107547441 A CN 107547441A CN 201710743658 A CN201710743658 A CN 201710743658A CN 107547441 A CN107547441 A CN 107547441A
Authority
CN
China
Prior art keywords
message
valid
idx
num
ram
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710743658.5A
Other languages
Chinese (zh)
Other versions
CN107547441B (en
Inventor
马建辉
王知学
侯冬冬
郭坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Automation Shandong Academy of Sciences
Original Assignee
Institute of Automation Shandong Academy of Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Automation Shandong Academy of Sciences filed Critical Institute of Automation Shandong Academy of Sciences
Priority to CN201710743658.5A priority Critical patent/CN107547441B/en
Publication of CN107547441A publication Critical patent/CN107547441A/en
Application granted granted Critical
Publication of CN107547441B publication Critical patent/CN107547441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses CAN message filtering analytic method, system and electronic control unit, by the program copy in FLASH spaces corresponding to RAM_CODE_SEG code segments into corresponding ram space, when the reception of MCU operation CAN messages, filtering and analytical function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;CAN message reception, filtering and analytical function are performed in RAM, the run time of interrupt service routine can not only be reduced, the requirement to system stack can also be reduced, it is proposed a kind of message ID matching algorithms simultaneously, message ID matching algorithms are placed in interrupt service routine and carried out, message is reduced and receives the requirement of buffering area and CAN message parsing task message queue to RAM resources.

Description

CAN message filtering analytic method, system and electronic control unit
Technical field
The present invention relates to technical field of automotive electronics, and analytic method, system and electronics control are filtered more particularly to CAN message Unit processed.
Background technology
With the upgrading of automotive engineering and becoming increasingly abundant for function, the message of automobile electronic system CAN network is more and more, For the specific CAN nodes in network, a large amount of useless messages can be received.Due to CAN controller hardware filtering function It is limited, when CAN nodes need to receive and parse through multiple messages, hardware filtering function just can not be used, at present typically using soft Part filtering filters out useless message, and when CAN network reaches certain load factor, frequently message reception, filtering and parsing can poles The earth consumption MCU loads.On the other hand, the program of vehicle electronic control unit (ECU) is generally stored inside nonvolatile memory In FLASH, when program is run, MCU reads instruction at the address that program counter points to.Because MCU internal RAM resources have Limit, program typically runs in FLASH, and its reading speed of the limit decision of FLASH technologies is much smaller than RAM reading speeds, phase Ying Di, speed of the speed of operation program much smaller than the operation program in RAM in FLASH.Message is carried out by software mode When receiving, filter and parsing, ECU needs to consume substantial amounts of these tasks of RAM resources, instruction cycle and time-triggered protocol, not only shadow Acoustic system real-time, certain require can be also proposed to MCU specifications.
By software filtering filtering useless message, there are two kinds of implementations:
1st, set sufficiently large CAN message to receive buffering area, and parse task for CAN message and sufficiently large message team is set Row, in message is stored buffering area successively during CAN message receives interrupt service routine, then parse task to CAN message Message is sent, the filtering useless message in CAN message parsing task, parses useful message.
2nd, set a certain size CAN message to receive buffering area, nothing is filtered out in CAN message receives interrupt service routine With message, by useful packet storage into buffering area, message then is sent to CAN message parsing task, is appointed in CAN message parsing Useful message is parsed in business.
During using the first implementation, if CAN network has the useless message that this large amount of node need not parse, need Message is received into buffering area and CAN message parsing task message queue is set enough to big, buffering area is otherwise likely to occur and overflows Go out or message queue overflows, cause the gross error of message dropping.Larger reception buffering area and packet parsing task message Queue can consume a large amount of RAM resources, it may be necessary to MCU also more expensive when changing RAM more Datong District, so as to increase electronic component Cost.
Using during second of implementation, it is necessary in the reception break service routine in carry out software filtering, using traversal ratio Compared with method filtering packets, it is necessary to which the substantial amounts of instruction cycle, violates the more short better principle of interrupt service routine run time.Hold Interruption occurs during row interrupt service routine again to may result in interrupt nesting or interrupt loss, interrupt nesting can be consumed largely Limited storehouse resource, if stack overflow, unpredictable consequence can be caused.Interrupt the standard lost and can also influence system operation True property and reliability.
Traversal comparison method refers to set a constant array, the message ID that array element parses for needs, by what is received Message ID and array element are compared one by one, if the message ID received is equal with some array element, then it represents that CAN is saved Point needs to parse this message.
Chinese invention patent:Software filtering method, system and the electronic control unit (application number of CAN message: 201410058072.1) a kind of software filtering method of CAN message, is described, it is slow that the invention is provided with several receptions Area is rushed, the message ID stored in each buffering area is several fixation values, first packet storage into some buffering area, so Several fixations ID corresponding to message ID and the buffering area is compared afterwards.This method can reduce ID number of comparisons, but need Several are set to receive buffering area, before not only programming is more complicated, and receive buffering area memory storage is filtering CAN message, it is necessary to consumption RAM resources it is relatively more.It is disconnected service journey in the reception moreover, the patent of invention does not illustrate Sequence still carries out software filtering in packet parsing task.
The content of the invention
In order to solve the deficiencies in the prior art, the invention provides a kind of CAN message to filter analytic method, and it is in RAM CAN message reception, filtering and analytical function are performed, the run time of interrupt service routine can not only be reduced, can also be reduced Requirement to system stack, while a kind of message ID matching algorithms are proposed, message ID matching algorithms are placed on interrupt service routine Middle progress, reduce message and receive the requirement of buffering area and CAN message parsing task message queue to RAM resources;
A kind of CAN message filters analytic method, as follows applied to electronic control unit, including step:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG generations Program copy corresponding to code section in FLASH spaces into corresponding ram space, when MCU operation CAN messages receive, filtering and During analytical function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, effective message is established ID value array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_ in each subinterval in the form of array index NUM] in original position;Array Id_idx [9] is established, is corresponding to the minimum effectively message ID in i work songs section with Id_idx [i] The subscript value of Valid_id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive effectively is reporting In the range of literary ID values array Valid_id [VALID_NUM], if it is not, then reception interrupt service routine is directly exited, it is no Then enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and connect Receive in buffering area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and value ID in section is compared, and extracts corresponding CAN signal, performs the operation of correlation.
The RAM_CODE_SEG code segments of the step (1), are arranged in threaded file, are the code segments of relocatable; CAN message reception, filtering and analytical function defined in RAM_CODE_SEG code segments;After program is compiled, linking, burning program When, the routine data storage being defined in RAM_CODE_SEG code segments is arrived FLASH spaces by MCU;
One section of FLASH space and one section and FLASH bulk identicals RAM are set in the code segment of the relocatable Space, and FLASH spaces are reoriented to ram space.
In the step (2), according to ECU technical specification and CAN network matrix table, it is determined that needing the effective message parsed ID and number;
The order of the effective message ID values parsed on demand in the step (2) from small to large is established effective message ID and taken It is worth array Valid_id [VALID_NUM], minimum value is Valid_id [0], and maximum is Valid_id [VALID_NUM-1].
In the step (2), VALID_NUM and Valid_id [VALID_NUM] are constant, by technical specification and CAN Network matrix table analysis is drawn.
In the step (3), CAN standard frames ID is 11, span 0x00-0x7ff, and CAN standard frames ID is taken Value interval division is 8 subintervals;The ID spans in 8 subintervals are respectively 0x00-0xff, 0x100-0x1ff, 0x200- 0x2ff, 0x300-0x3ff, 0x400-0x4ff, 0x500-0x5ff, 0x600-0x6ff and 0x700-0x7ff, corresponding subinterval Label is respectively 0,1,2,3,4,5,6 and 7.
In the step (4), according to ECU technical specification and CAN network matrix table, determined in the form of array index each Original positions of effective message ID in Valid_id [VALID_NUM] in individual subinterval.
The method of the step (4) is as follows:
Assuming that the message ID values that this node needs to parse have 0x40,0x50 between 0 work song section 0x00-0xff, 0x60,0x70 ..., one is shared n, and ID values have a 0x140,0x150,0x160,0x170 ... between 0x100-0x1ff, and one Shared m is individual, then Id_idx [0]=0, Id_idx [1]=n, Id_idx [2]=n+m ..., Id_idx [8]=VALID_NUM.
The step (5) first by the ID of the message received respectively with Valid_id [0] and Valid_id [VALID_ NUM-1] compare, if the ID of the message received is more than Valid_id [VALID_NUM-1] or less than Valid_id [0], reception interrupt service routine is directly exited, otherwise into step (6).
The invention also provides another technical scheme:
A kind of CAN message filters resolution system, including:Electronic control unit ECU, computer instruction is stored thereon with, institute State computer instruction and operationally perform following steps:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG generations Program copy corresponding to code section in FLASH spaces into corresponding ram space, when MCU operation CAN messages receive, filtering and During analytical function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, effective message is established ID value array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_ in each subinterval in the form of array index NUM] in original position;Array Id_idx [9] is established, is corresponding to the minimum effectively message ID in i work songs section with Id_idx [i] The subscript value of Valid_id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive effectively is reporting In the range of literary ID values array Valid_id [VALID_NUM], if it is not, then reception interrupt service routine is directly exited, it is no Then enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and connect Receive in buffering area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and value ID in section is compared, and extracts corresponding CAN signal, performs the operation of correlation.
The invention also provides another technical scheme:
A kind of electronic control unit, including:CAN controller, computer instruction is stored with the CAN controller, it is described Computer instruction operationally performs following steps:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG generations Program copy corresponding to code section in FLASH spaces into corresponding ram space, when MCU operation CAN messages receive, filtering and During analytical function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, effective message is established ID value array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_ in each subinterval in the form of array index NUM] in original position;Array Id_idx [9] is established, is corresponding to the minimum effectively message ID in i work songs section with Id_idx [i] The subscript value of Valid_id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive effectively is reporting In the range of literary ID values array Valid_id [VALID_NUM], if it is not, then reception interrupt service routine is directly exited, it is no Then enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and connect Receive in buffering area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and value ID in section is compared, and extracts corresponding CAN signal, performs the operation of correlation.
Compared with prior art, the beneficial effects of the invention are as follows:
1st, in actual motion, CAN message receives MCU, filtering and analytical function can be reoriented in RAM and run, significantly The speed that CAN message is received, filters and parsed is improved, improves system real time.
2nd, by setting ID values subinterval, reduce the number that ID compares, improve message filtering speed.
3rd, after the CAN message received is filtered processing, effective message is stored in and receives buffering area, reduces reception Buffering area and the RAM resource requirements of CAN message parsing task message queue.
4th, according to the ID values subinterval obtained in interrupt service routine, ID is carried out in CAN message parsing task Timing, ID number of comparisons can be reduced, improve packet parsing speed.
Brief description of the drawings
The Figure of description for forming the part of the application is used for providing further understanding of the present application, and the application's shows Meaning property embodiment and its illustrate be used for explain the application, do not form the improper restriction to the application.
Fig. 1 is the overall workflow figure of the present invention;
Fig. 2 is the message filtering algorithm flow chart of the present invention.
Embodiment
It is noted that described further below is all exemplary, it is intended to provides further instruction to the application.It is unless another Indicate, all technologies used herein and scientific terminology are with usual with the application person of an ordinary skill in the technical field The identical meanings of understanding.
It should be noted that term used herein above is merely to describe embodiment, and be not intended to restricted root According to the illustrative embodiments of the application.As used herein, unless the context clearly indicates otherwise, otherwise singulative It is also intended to include plural form, additionally, it should be understood that, when in this manual using term "comprising" and/or " bag Include " when, it indicates existing characteristics, step, operation, device, component and/or combinations thereof.
As illustrated in fig. 1 and 2, a kind of CAN message filtering analytic method, it is as follows applied to electronic control unit, including step:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG generations Program copy corresponding to code section in FLASH spaces into corresponding ram space, when MCU operation CAN messages receive, filtering and During analytical function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;Institute RAM_CODE_SEG code segments are stated, are arranged in threaded file, are the code segments of relocatable;In RAM_CODE_SEG code segments Define CAN message reception, filtering and analytical function;After program is compiled, linking, during burning program, MCU is being defined on RAM_ FLASH spaces are arrived in routine data storage in CODE_SEG code segments;One section of FLASH is set in the code segment of the relocatable Space and one section and FLASH bulk identical ram spaces, and FLASH spaces are reoriented to ram space.
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, effective message is established ID value array Valid_id [VALID_NUM];According to ECU technical specification and CAN network matrix table, it is determined that needing what is parsed Effective message ID and number;The order of the effective message ID values parsed on demand from small to large establishes effective message ID value numbers Group Valid_id [VALID_NUM], minimum value is Valid_id [0], and maximum is Valid_id [VALID_NUM-1]. VALID_NUM and Valid_id [VALID_NUM] is constant, is drawn by technical specification and CAN network matrix table analysis.
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;CAN standard frames ID is 11, value model Enclose for 0x00-0x7ff, according to the ID highests value of three, CAN standard frame ID intervals are divided into 8 subintervals;8 The ID spans in subinterval are respectively 0x00-0xff, 0x100-0x1ff, 0x200-0x2ff, 0x300-0x3ff, 0x400- 0x4ff, 0x500-0x5ff, 0x600-0x6ff and 0x700-0x7ff, corresponding subinterval label is respectively 0,1,2,3,4,5,6 With 7.
Step (4):Determine that effective message ID is in Valid_id [VALID_ in each subinterval in the form of array index NUM] in original position;Array Id_idx [9] is established, is corresponding to the minimum effectively message ID in i work songs section with Id_idx [i] The subscript value of Valid_id [VALID_NUM] array element, especially, Id_idx [8]=VALID_NUM;
According to ECU technical specification and CAN network matrix table, determined in the form of array index in each subinterval effectively Original positions of the message ID in Valid_id [VALID_NUM].
Assuming that the message ID values that this node needs to parse have 0x40,0x50 between 0 work song section 0x00-0xff, 0x60,0x70 ..., one is shared n, and ID values have a 0x140,0x150,0x160,0x170 ... between 0x100-0x1ff, and one Shared m is individual, then Id_idx [0]=0, Id_idx [1]=n, Id_idx [2]=n+m ....Especially, Id_idx [8]=VALID_ NUM。
Step (5):CAN message receive interrupt service routine in, first by the ID of the message received respectively with Valid_id [0] compares with Valid_id [VALID_NUM-1], if the ID of the message received is more than Valid_id [VALID_NUM-1] or less than Valid_id [0], reception interrupt service routine is directly exited, otherwise into step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Under using Id_idx [idx] and Id_idx [idx+1] -1 as array Valid_id [VALID_NUM] Section is marked, the ID values in the ID of the message received and subscript section are compared one by one, if the message received Any one ID value is all unequal in ID and the subscript section, then abandons the message received, directly exits and receives at interruption Program is managed, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and connect Receive in buffering area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and value ID in section is compared, and extracts corresponding CAN signal, performs the operation of correlation.
The application illustrates to the present invention in conjunction with specific embodiments:
For certain automobile factory exploitation a PEPS, it is necessary to parsing effective message ID have 20, including 0x42,0x52, 0x70,0x73,0x74,0x75,0x1a2,0x270,0x271,0x340,0x380,0x390,0x4e0,0x521,0x570, 0x610,0x630,0x645,0x701,0x7df, it is according to this method, VALID__NUM=20, effective ID arrays of foundation Uint16_t Valid_id [VALID__NUM]=0x42,0x52,0x70,0x73,0x74,0x75,0x1a2,0x270, 0x271,0x340,0x380,0x390,0x4e0,0x521,0x570,0x610,0x630,0x645,0x701,0x7df};According to It is as follows that the inventive method establishes form:
Table 1
Uint8_t Id_idx [9]={ 0,6,7,9,12,13,15,18,20 };
Specifically, it is assumed that the message ID=0x521 received, if entered according to traversal comparison method to the message ID received Row filtering is, it is necessary to carry out 14 comparison operations.According to this method step 6, the ID of the message received is moved to right 8, by result It is designated as idx;
Idx=0x521>>8=5
Array Valid_id [VALID_NUM] subscript section, i.e. 13- are used as using Id_idx [5] and Id_idx [6] -1 14, compared with the value between 0x521 and Valid_id [13]-Valid_id [14], it is only necessary to which fortune is once compared in execution Calculate, just can determine that the message received is effective message.
Assuming that the message ID=0x520 received, if be filtered according to traversal comparison method to the message ID received, Need to carry out 20 comparison operations, according to method of the present invention it is only necessary to performing a shift right operation and comparison operation three times.
On average, the message ID received is filtered according to traversal comparison method, if effective message, average specific It it is VALID__NUM/2 times compared with number, if invalid packet, number of comparisons is VALID__NUM times, is filtered according to the present invention Ripple, number of comparisons can be significantly smaller than traversal comparison method.
The preferred embodiment of the application is the foregoing is only, is not limited to the application, for the skill of this area For art personnel, the application can have various modifications and variations.It is all within spirit herein and principle, made any repair Change, equivalent substitution, improvement etc., should be included within the protection domain of the application.

Claims (10)

1. a kind of CAN message filters analytic method, it is characterized in that, it is as follows applied to electronic control unit, including step:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG code segments Program copy in corresponding FLASH spaces is into corresponding ram space, when MCU operation CAN messages are received, filter and parsed During function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, establish effective message ID and take It is worth array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_NUM] in each subinterval in the form of array index Original position;Array Id_idx [9] is established, is the minimum Valid_ effectively corresponding to message ID in i work songs section with Id_idx [i] The subscript value of id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive is in effective message ID In the range of value array Valid_id [VALID_NUM], if it is not, then directly exiting reception interrupt service routine, otherwise enter Enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and received and is delayed Rush in area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and the value subinterval In ID be compared, extract corresponding CAN signal, perform correlation operation.
2. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, the step (1) RAM_ CODE_SEG code segments, are arranged in threaded file, are the code segments of relocatable;Defined in RAM_CODE_SEG code segments CAN message reception, filtering and analytical function;After program is compiled, linking, during burning program, MCU is being defined on RAM_CODE_ FLASH spaces are arrived in routine data storage in SEG code segments.
3. a kind of CAN message filtering analytic method as claimed in claim 2, it is characterized in that, the code segment of the relocatable One section of FLASH space of middle setting and one section and FLASH bulk identical ram spaces, and FLASH spaces are reoriented to Ram space.
4. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, in the step (2), according to ECU Technical specification and CAN network matrix table, it is determined that needing effective message ID for parsing and number;VALID_NUM and Valid_id [VALID_NUM] is constant, is drawn by technical specification and CAN network matrix table analysis.
5. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, solved on demand in the step (2) The order of effective message ID values of analysis from small to large establishes effective message ID value arrays Valid_id [VALID_NUM], most Small value is Valid_id [0], and maximum is Valid_id [VALID_NUM-1].
6. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, in the step (2), the step Suddenly in (3), CAN standard frames ID is 11, span 0x00-0x7ff, and CAN standard frame ID intervals are divided into 8 Subinterval;The ID spans in 8 subintervals are respectively 0x00-0xff, 0x100-0x1ff, 0x200-0x2ff, 0x300- 0x3ff, 0x400-0x4ff, 0x500-0x5ff, 0x600-0x6ff and 0x700-0x7ff, corresponding subinterval label is respectively 0, 1st, 2,3,4,5,6 and 7.
7. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, in the step (4), according to ECU Technical specification and CAN network matrix table, determine that effective message ID is in Valid_ in each subinterval in the form of array index Original position in id [VALID_NUM].
8. a kind of CAN message filtering analytic method as claimed in claim 1, it is characterized in that, the method for the step (4) is such as Under:
Assuming that the message ID values that this node needs to parse have 0x40,0x50,0x60 between 0 work song section 0x00-0xff, 0x70 ..., a shared n is individual, and ID values have 0x140,0x150,0x160,0x170 ..., a shared m between 0x100-0x1ff It is individual, then Id_idx [0]=0, Id_idx [1]=n, Id_idx [2]=n+m ..., Id_idx [8]=VALID_NUM.
9. a kind of CAN message filters resolution system, it is characterized in that, including:Electronic control unit ECU, is stored thereon with computer Instruction, the computer instruction operationally perform following steps:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG code segments Program copy in corresponding FLASH spaces is into corresponding ram space, when MCU operation CAN messages are received, filter and parsed During function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, establish effective message ID and take It is worth array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_NUM] in each subinterval in the form of array index Original position;Array Id_idx [9] is established, is the minimum Valid_ effectively corresponding to message ID in i work songs section with Id_idx [i] The subscript value of id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive is in effective message ID In the range of value array Valid_id [VALID_NUM], if it is not, then directly exiting reception interrupt service routine, otherwise enter Enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and received and is delayed Rush in area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and the value subinterval In ID be compared, extract corresponding CAN signal, perform correlation operation.
10. a kind of electronic control unit, it is characterized in that, including:CAN controller, computer is stored with the CAN controller and is referred to Order, the computer instruction operationally perform following steps:
Step (1):Initial phase on electronic control unit ECU after electric or reset, by RAM_CODE_SEG code segments Program copy in corresponding FLASH spaces is into corresponding ram space, when MCU operation CAN messages are received, filter and parsed During function, program counter automatically points to the ram space where RAM_CODE_SEG, and described program is run in RAM;
Step (2):It is determined that effective message ID and number, number that needs parse are designated as VALID_NUM, establish effective message ID and take It is worth array Valid_id [VALID_NUM];
Step (3):CAN standard frame ID intervals are divided into 8 subintervals;
Step (4):Determine that effective message ID is in Valid_id [VALID_NUM] in each subinterval in the form of array index Original position;Array Id_idx [9] is established, is the minimum Valid_ effectively corresponding to message ID in i work songs section with Id_idx [i] The subscript value of id [VALID_NUM] array element, Id_idx [8]=VALID_NUM;
Step (5):In CAN message receives interrupt service routine, whether the ID for the message for judging to receive is in effective message ID In the range of value array Valid_id [VALID_NUM], if it is not, then directly exiting reception interrupt service routine, otherwise enter Enter step (6);
Step (6):The ID of the message received is moved to right 8, result is designated as idx;
Step (7):Effective message ID value arrays Valid_id is used as using Id_idx [idx] and Id_idx [idx+1] -1 The subscript section of [VALID_NUM], the ID values in the ID of the message received and subscript section are compared one by one, if Any one ID value is all unequal in the ID of the message received and the subscript section, then abandons the message received, directly Reception interrupt handling routine is exited, otherwise into step (8);
Step (8):Message ID, place ID values subinterval label, message length, message data are stored in message and received and is delayed Rush in area, " receiving new message " message is sent to packet parsing task;
Step (9):In packet parsing task, according to the label in ID values subinterval, by message ID and the value subinterval In ID be compared, extract corresponding CAN signal, perform correlation operation.
CN201710743658.5A 2017-08-25 2017-08-25 CAN message filtering analysis method, system and electronic control unit Active CN107547441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710743658.5A CN107547441B (en) 2017-08-25 2017-08-25 CAN message filtering analysis method, system and electronic control unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710743658.5A CN107547441B (en) 2017-08-25 2017-08-25 CAN message filtering analysis method, system and electronic control unit

Publications (2)

Publication Number Publication Date
CN107547441A true CN107547441A (en) 2018-01-05
CN107547441B CN107547441B (en) 2020-06-02

Family

ID=60957773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710743658.5A Active CN107547441B (en) 2017-08-25 2017-08-25 CAN message filtering analysis method, system and electronic control unit

Country Status (1)

Country Link
CN (1) CN107547441B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108471401A (en) * 2018-02-07 2018-08-31 山东省科学院自动化研究所 A kind of encapsulation of CAN signal, analysis method and device
CN108965293A (en) * 2018-07-13 2018-12-07 智车优行科技(北京)有限公司 Message parsing method and device, electronic equipment
CN110333976A (en) * 2019-06-26 2019-10-15 中国第一汽车股份有限公司 A kind of electronic controller test macro and method
EP4035442A4 (en) * 2019-09-27 2024-01-24 Univ Michigan Regents Automated can message translator

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020031646A (en) * 2000-10-20 2002-05-03 이계안 Ecu data monitoring/matching method
CN106534368A (en) * 2016-12-19 2017-03-22 山东省科学院自动化研究所 Message transceiving method and system for car CAN bus gateway

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020031646A (en) * 2000-10-20 2002-05-03 이계안 Ecu data monitoring/matching method
CN106534368A (en) * 2016-12-19 2017-03-22 山东省科学院自动化研究所 Message transceiving method and system for car CAN bus gateway

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈惠纲,等: "基于TMS320F28335 的DSP/BIOS 系统从FLASH到RAM运行", 《现代电子技术》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108471401A (en) * 2018-02-07 2018-08-31 山东省科学院自动化研究所 A kind of encapsulation of CAN signal, analysis method and device
CN108965293A (en) * 2018-07-13 2018-12-07 智车优行科技(北京)有限公司 Message parsing method and device, electronic equipment
CN108965293B (en) * 2018-07-13 2021-06-11 智车优行科技(北京)有限公司 Message analysis method and device and electronic equipment
CN110333976A (en) * 2019-06-26 2019-10-15 中国第一汽车股份有限公司 A kind of electronic controller test macro and method
CN110333976B (en) * 2019-06-26 2022-08-23 中国第一汽车股份有限公司 Electronic controller test system and method
EP4035442A4 (en) * 2019-09-27 2024-01-24 Univ Michigan Regents Automated can message translator

Also Published As

Publication number Publication date
CN107547441B (en) 2020-06-02

Similar Documents

Publication Publication Date Title
CN107547441A (en) CAN message filtering analytic method, system and electronic control unit
Zhao et al. A window protocol for transmission of time-constrained messages
CN106534244B (en) Scheduling method and device of proxy resources
CN103338157B (en) A kind of internuclear data message caching method of multiple nucleus system and equipment
US20140109105A1 (en) Intrusion detection apparatus and method using load balancer responsive to traffic conditions between central processing unit and graphics processing unit
CN109819161A (en) A kind of method of adjustment of frame per second, device, terminal and readable storage medium storing program for executing
CN103412786A (en) High performance server architecture system and data processing method thereof
CN110119307B (en) Data processing request processing method and device, storage medium and electronic device
CN101604261B (en) Task scheduling method for supercomputer
CN108628671A (en) Method for scheduling task and device
CN104424240B (en) Multilist correlating method, main service node, calculate node and system
CN103873523A (en) Client cluster access method and device
CN102299843A (en) Network data processing method based on graphic processing unit (GPU) and buffer area, and system thereof
CN105978821B (en) The method and device that network congestion avoids
Bhowmik et al. Distributed control plane for software-defined networks: A case study using event-based middleware
CN110990140A (en) Method for scheduling distributed machine learning flow in photoelectric switching network
CN111209240B (en) Data transmission method, electronic equipment and storage medium
CN110995608A (en) Method, device and system for multi-link load balancing
CN105471770B (en) A kind of message processing method and device based on multi-core processor
Hengrong Design on IPNCS of electrical propulsion ship based on real-time Ethernet
US20030072313A1 (en) Packet shaping on a fixed segment scheduler
CN114490458A (en) Data transmission method, chip, server and storage medium
CN102571578A (en) Method for realizing on-line communication of 500 thousands of users through completion port technology
CN110968411A (en) Timed task scheduling method, timed task scheduling device, server and storage medium
CN104951369A (en) Hotspot resource competition eliminating method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant