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.
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
- Popular Resources
- Popular amplifiers
- New Energy Vehicle Control System Inspection and Maintenance (Edited by Bao Pili)
- Detailed explanation of big data technology system: principles, architecture and practice (Dong Xicheng)
- Automotive CAN embedded intrusion detection system based on deep learning
- Lightweight FPGA-based IDS-ECU architecture for automotive CAN networks
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
- ARM's strategic layout in the field of Internet of Things
- BearPi-HM Nano Development Board Review 1 Getting Started with Program Development
- I have some doubts about SensorTile.box
- A novice needs help. When drawing PCB manual wiring in AD13.4, why can't I see the trace of the wiring before the wiring is completed?
- What are the important techniques for PCB wiring?
- Naming of Cadence Allegro 17.2 built-in pads
- A precision rectification experiment
- Video: Talking about TI CC2650
- How stable is RT-Thread?
- How to improve the hardware and software architecture of embedded minimum systems?