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.
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- X-NUCLEO-IKS02A1 Industrial Sensor Evaluation Board Data
- FAQ_About the pulse problem when the output port of BlueNRG-2 remains at a low level in low power mode
- There are still some problems with the PCB diagram drawn by a novice
- 2020 Open Source Hardware (OSHW) Community Survey
- SparkRoad OV2640 FPGA evaluation board test
- 【TGF4042 signal generator】+ Dual channel comparison test
- 3. Microcontrollers used in previous "Control" competitions
- SparkRoad Review (9) - Routine GAME Test
- Domestic Soul Core II A high-performance processor
- [Bluesun AB32VG1 RISC-V Evaluation Board] Problems encountered: USB and Bluetooth