Programming and Application of LPC2000 Series CAN Acceptance Filter

Publisher:自由梦想Latest update time:2012-03-27 Source: 单片机与嵌入式系统应用 Keywords:LPC2000  CAN  SJAl000 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction
With the rapid development of information technology, 32-bit ARM microcontrollers have been widely used due to their low power consumption, high performance and small size. Their application examples can be seen everywhere in the fields of automobiles, consumer entertainment, instrumentation, industrial control, mass storage, network, security and wireless. Therefore, the technical solution based on ARM is the solution with the most market prospects and market advantages.
Fieldbus is one of the most widely used technologies in the current industrial communication field. As one of the fieldbuses, CAN bus has attracted more and more attention due to its high performance, high reliability and flexible design. More and more ARM microcontrollers are equipped with CAN controllers. Philips 2000 series ARM microcontrollers are microcontrollers based on ARM7 with 2 or 4 CAN controllers integrated, which are widely used in industrial communication networks.

1 Brief Introduction to Hardware/Software Design of CAN Bus
1.1 Hardware Design
The LPC2000 series ARM has built-in CAN controllers. Each CAN controller has a similar register structure to SJA1000, except that register access is changed from 8-bit byte access to 32-bit double-word access, which makes hardware connection relatively simple. The CAN bus driver uses 82C250 or TJA1050. In order to enhance the anti-interference ability of the node, the CAN controller and the bus driver can be connected not directly, but through the high-speed optocoupler 6N137. The two power supplies used in the optocoupler part should be isolated, so a power isolation module is used.
1.2 Software Design
The basic software design of the CAN node includes CAN node initialization, message sending, and message receiving. Based on these three parts of the program, a general application program for CAN bus communication can be compiled. Of course, to apply the CAN bus to a system with complex communication tasks, it is also necessary to write CAN bus exception handling, acceptance filter settings, and other content.

2 Acceptance filter settings and working principle
When the CAN controller receives a complete identifier, it will notify the acceptance filter. The acceptance filter responds to this signal and reads the identifier and matches it with the identifier table in the AF (acceptance filter) RAM to decide whether to receive or discard this frame information.
The AF RAM is a RAM with a capacity of 512×32 bits (2KB). Through software settings, 1 to 5 identifier tables can be stored in the RAM. Figure 1 shows the distribution of a complete AFRAM internal table.

To facilitate programming, the contents of AF RAM are arranged in 32-bit mode, and each 32 bits is called a "cell". A table is a collection of cells. In the first two tables, each cell contains two identifiers, and the high-order identifier in each cell is smaller than the low-order identifier during configuration, otherwise the acceptance filter will fail to execute. In the next two tables, each pair of ranges or each identifier occupies one cell, and the legal extended identifier range table must appear in an even number of cells. Each table must be arranged in ascending order, and each table can be appropriately reduced according to application needs.

3 Acceptance filter programming implementation
The program is written in C language, and is debugged, simulated and downloaded in real time through the JTAG interface in the ADS1.2 development environment, and has been verified in actual applications. It should be noted that the Fullcan mode is rarely used, and the program does not involve its settings; the independent standard identifier and standard identifier range table are set to receive signals with standard ID {1, 2, 0x10, 0x20} and specified range {{90<=ID<=100} and {0x300<=ID<=0x400}}, and the independent extended identifier table and extended identifier range table are not set. If you need to set it, you can refer to the setting procedures of the first two tables. [page]
In CANREG. H, the acceptance filter mode register structure is defined as follows:

② Initialize the contents of an independent standard identifier table.
③ Initialize the contents of a standard identifier group table.
④ Initialize the independent standard identifier table of 1, uT with the contents of the independent standard identifier table.
⑤ Initialize the standard identifier range table of LuT with the contents of the standard identifier range table.
⑥ Mode 2, start the global acceptance filter.
The four related functions contained in majn. c are omitted.

Conclusion
In the application of SJAlO∞, the acceptance filter can only filter some IDs with strong regularity and a small number of IDs. When it is necessary to design a complex acceptance filter, the above acceptance filter module can play a certain role. Of course, in specific applications, it is also necessary to consider the communication protocol, CAK bus exception handling, CAN initialization, receiving and sending procedures.

Keywords:LPC2000  CAN  SJAl000 Reference address:Programming and Application of LPC2000 Series CAN Acceptance Filter

Previous article:Linking and locating target code when developing embedded systems with IAR EWARM
Next article: Hardware design of bank-tax embedded system based on EP9312

Recommended ReadingLatest update time:2024-11-16 20:48

Distributed battery management system based on CAN bus
Abstract: This paper mainly discusses the digital technology of automobiles and electric vehicles, the structure of computer control systems, and related issues of field communication. Taking the battery energy system as the application background, a management system with dual CAN buses as internal and external com
[Power Management]
Distributed battery management system based on CAN bus
How many volts are CAN high and CAN low in a car?
CAN (Controller Area Network) is a communication protocol used in automotive and other industrial applications. The CAN bus uses a pair of twisted wires (CANH and CANL) to transmit data, where CANH is often referred to as "CAN high" and CANL is referred to as "CAN low". CAN bus voltage overview T
[Embedded]
How to connect and use CAN bus devices
The Ethernet to CAN module enables devices on the Ethernet bus to send information to devices on the CAN bus and work together. It is a commonly used CAN data converter. So, how should it be connected and used? Let's talk briefly. Since it is a CAN to Ethernet device, it must have integrated CAN port and
[Embedded]
CAN bus data acquisition system solution based on DSPIC30F3013
  introduction   In industrial control, in order to ensure the reliable operation of the system, it is necessary to detect the surrounding environmental variables (such as temperature, air pressure, humidity, etc.). The usual practice is to connect the signals collected by sensors distributed in various places to the
[Embedded]
CAN bus data acquisition system solution based on DSPIC30F3013
Application of CAN bus in the communication of electronic control system of modular machine tools
introduction Modern modular machine tools are equipped with a large number of electronic devices to meet the requirements of processing accuracy, processing speed, etc. If the conventional point-to-point method is used to directly connect the 12V/24V power supply to the load equipment (such as motors, hydra
[Industrial Control]
Motor Synchronous Control System and Communication Based on DSP and CAN
0 Introduction Traditional multi- motor control systems are suitable for occasions with low requirements, relatively simple, and relatively concentrated motor distribution. However, for occasions with high requirements for real-time, reliability, scalability, transmission distance, and transmi
[Embedded]
How many bytes are there in a CAN message frame?
Number of bits in a CAN FD message frame According to the CAN FD frame structure, the number of bits in a CAN FD message frame can be calculated: CAN FD message bit number = frame start (1 bit) + arbitration segment (13/32 bits) + control segment (8 bits) + data segment (0~512 bits) + CRC segment (28/33 bi
[Embedded]
Simplifying CAN in Automotive Applications with Highly Integrated 8-bit MCUs
ByEdwin Romero The Controller Area Network (CAN) protocol is a specification designed in the mid-1980s for the automotive industry to reduce the complexity (weight, quantity and cost) of wiring for data transmission in increasingly connected applications. CAN's advantages have also been accepted and absorbed by o
[Automotive Electronics]
Simplifying CAN in Automotive Applications with Highly Integrated 8-bit MCUs
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号