Application of CAN bus acceptance filter in LPC2000 series

Publisher:大橙子5511Latest update time:2012-08-27 Source: 中电网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

CAN (Controller Area Network) bus, or Controller Area Network bus, was developed and launched by Bosch in Germany in 1982 as the earliest data communication protocol for measuring and executing components inside automobiles. In its 20-year history, CAN bus has been applied in many fields and is the only field bus with international standards so far.

The CAN fieldbus implements the physical layer, data link layer and application layer according to the "Open System Interconnection (OSI)" reference model proposed by the International Organization for Standardization ISO. The CAN controller is used to implement the CAN bus protocol. There are two types of CAN controller chips: one is an independent controller chip, such as SJA1000; the other is made together with a microcontroller, such as Philips' LPC2000 series 32-bit ARM microcontroller. Both types of controllers provide acceptance filters for message identification filtering. However, the acceptance filter of the independent CAN controller can only filter the message identifiers (IDs) with strong regularity, or arbitrarily filter a small number of IDs, and it is difficult to achieve more complex arbitrary ID filtering. The acceptance filter embedded in the Philips LPC2000 series 32-bit ARM microcontroller provides a global identifier query function for the CAN controller, which can achieve complex message ID filtering and greatly reduce the burden on the microcontroller.

1. Characteristics and functions of acceptance filter

1.1 Characteristics of acceptance filter

The LPC2000 series ARM microcontroller is a 32-bit embedded microprocessor using the ARM7TDMI-S core, with a built-in 2-way or 4-way CAN controller and acceptance filter. The acceptance filter provides global message identification filtering for the CAN controller. It contains a 512×32 (2 KB) RAM, in which 1 to 5 message identifier tables can be set to form a lookup table LUT (LookUp Table). The entire lookup table can accommodate 1 024 standard identifiers or 512 extended identifiers, or two mixed types of identifiers. The five possible identifier tables include the FullCAN standard identifier table and the independent standard identifier table, the standard identifier range table, the independent extended identifier table, and the extended identifier range table. These five tables do not have to exist at the same time and can be reduced as needed. If the starting address of a table is equal to the starting address of the next table or the value of the table end register, the table is empty and will be ignored in the processing.

1.2 Acceptance filter function

The CAN acceptance filter of the LPC2000 series ARM microcontroller has two working modes: one is the general mode; the other is called "FullCAN mode". In the general mode, when the receiving end of the CAN controller receives a complete identifier, it will notify the receiving acceptance filter. The acceptance filter responds to this signal, reads the CAN controller number and the identifier size (standard identifier 11 bits or extended identifier 29 bits); then searches the LUT to find a matching identifier. If a matching identifier is found, the CAN controller is notified to put the received message into the CAN controller receive buffer; otherwise, the received frame information is discarded. Its workflow is shown in Figure 1.



If FullCAN mode is enabled and the CAN controller reports that a standard identifier is generated, the acceptance filter first queries the FullCAN standard identifier table and then processes the reception in FullCAN mode. If no matching ID is found in the FullCAN standard identifier table, the next existing table is searched in sequence until a match is found or the table lookup ends. Once a matching ID is found, the received message is placed in a special message buffer instead of the CAN controller receive buffer. This special buffer is located in the acceptance filter's RAM and is at the end of the LUT. The CPU can read the received message at any time. The reception workflow of FullCAN mode is shown in Figure 2. [page]



2 Acceptance filter driver development

2.1 Acceptance filter register description

Take LPC2292 as an example to illustrate the development of its acceptance filter driver. LPC2292 has a built-in 2-way CAN controller, and its acceptance filter registers are listed in Table 1. Note: The starting address here is the offset of the starting address of the acceptance filter RAM as the basic address. For example, in general mode, SFF_sa=0 means that the starting address of the independent standard frame identifier is located at 0xE0038000.

The size of a table is determined by the difference between the two table start address registers before and after it. For example, SFF_GRP_sa-SFF_sa is the size of the independent standard frame identifier lookup table. If its value is 0, that is, SFF_GRP_sa=SFF_sa, the size of the independent standard frame identifier lookup table is 0, and this table will be ignored during the search. The end of the lookup table register ENDofTable represents the end address of the lookup table, and ENDofTable-EFF_GRP_sa is the size of the extended frame group identifier lookup table. The acceptance filter register AFMR controls its working mode, and the specific definition is listed in Table 2.



2.2 Format of identifiers in the lookup table

①FullCAN standard identifier table and independent standard identifier table.

It should be noted that each FullCAN standard identifier table and independent standard identifier table must be arranged in ascending order, that is, identifier 1 is greater than identifier O; otherwise, a table error will be caused in AF and the reception filter will fail. The table format is as follows:

② Standard identifier range table. The IDs between the upper and lower boundaries (including the upper and lower boundaries) of the identifier are allowed to pass. The table format is as follows:

③ Independent extended identifier table. One independent extended identifier occupies one word and needs to be arranged in ascending order. The table format is as follows:

④ Extended identifier range table. It always appears in pairs and occupies 2 characters, so a legal table must appear with an even number of characters and must be arranged in ascending order. The table format is as follows: [page]

2.3 Design of acceptance filter driver

According to the above description, the driver program of the acceptance filter can be designed. Taking LPC2292 as an example, how to design the driver program is explained.

Assume that there are two independent standard identifiers, ID0 and ID1, arranged in ascending order, and the group standard frame identifier range is ID2 to ID3 (ID2

3 Conclusion

The CAN acceptance filter of the LPC2000 series ARM microcontroller can effectively shield messages that are not allowed to pass on the bus, greatly reducing the burden on the CPU and playing a great role in applications using the CAN bus as a communication network.

Reference address:Application of CAN bus acceptance filter in LPC2000 series

Previous article:Design of Handheld JPEG Image Display Based on LPC2292
Next article:Audio processing solution based on LPC2214 and uC/OS-II

Recommended ReadingLatest update time:2024-11-16 23:56

Measuring automobile CAN-BUS bus signals and waveform analysis-auto repair oscilloscope
With the increasing number of automotive electronic devices, it is a reliable and economical approach to use serial bus to achieve multi-channel transmission and form an automotive electronic network. In the original traditional automobile circuits, the connection between the powertrain module and the body module is
[Test Measurement]
Measuring automobile CAN-BUS bus signals and waveform analysis-auto repair oscilloscope
Detailed analysis: CAN-BUS, the electronic system in the car
This article is a technical article. I will explain to you what the "CAN-BUS system" is and its functions. For example: In the past, the circuit system of a car was a bit like household electricity. There must be electricity and plugs to supply electricity to electric
[Automotive Electronics]
Detailed analysis: CAN-BUS, the electronic system in the car
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号