LPC2294 is a powerful, ultra-low power 32-bit microcontroller with ARM7TDMI core launched by PHILIPS. It has rich on-chip resources and can fully meet the general needs of industrial control. At the same time, it can also reduce the complexity of system hardware design and improve the stability of the system.
CAN ("Controller Area Network") bus controller area network is a serial communication network that can effectively support distributed control or real-time control. CAN bus is increasingly valued and favored by people for its high performance, high reliability and low cost. In order to effectively manage CAN nodes in industrial sites and give full play to the performance of CAN bus, the design and research of communication cards are very necessary. However, there are two shortcomings in similar products on the market.
First, there may be more than one CAN bus in a general industrial site, and the CAN interface on the currently designed communication card is too few, which will bring difficulties to the centralized management of equipment.
Second, the communication between two CAN segments is mainly achieved through a one-to-one CAN bus bridge, but this method cannot solve the need to transmit data between several CAN segments at the same time in the industrial site, and it is also easy to cause network confusion.
For this reason, the ARM controller LPC2294 selected in this design has four CAN controllers integrated inside, which fully complies with the CAN specification CAN2.0B standard and ISO11989-1 standard. The global acceptance filter can identify the 11-bit and 29-bit Rx identifiers of almost all buses. As the core component of this design, the use of LPC2294 can solve the above two problems very well. It can not only take on the work of the main controller, but also serve as the data transmission controller of the CAN network to realize data exchange with the nodes in the network.
1 Hardware Design Scheme
At present, in the development of computers, except for a few specialized industrial computers that still use the ISA bus, the most commonly used bus on PCs is the PCI bus. The PCI bus is a high-performance 32/64-bit
PC
local bus launched by Intel. It can support multiple sets of peripherals at the same time without being restricted by the processor. Its data throughput is very large (33 MHz bus frequency, 32-bit transmission, its peak value can be as high as 132 MB/s).
The PCI
bus will definitely replace the ISA bus due to its superior performance. Therefore, this paper designs an intelligent communication card with 4 CAN bus segments based on the PCI bus. Figure 1 is the overall hardware structure diagram of the communication card.
1.1 Implementation of PCI bus interface
PCI bus has very strict specifications and good compatibility. However, PCI bus protocol is also relatively complex. This design uses a dedicated PCI bus interface chip PCI9030 to implement the PCI bus interface of the gateway. PCI9030 is a low-cost PCI bus slave mode interface chip developed by PLX. The chip has low power consumption and complies with PCI2.2 specifications. When designing, users only need to consider the logic control circuit on one side of the local bus and the external
EEP-ROM
used for configuration
, without having to consider the specific implementation method of the PCI protocol. This greatly simplifies the design difficulty and shortens the development cycle.
PCI9030 requires an EEPROM as an initialization memory. When the system is loaded, PCI9030 first loads the initial data from the EEPROM for initial settings. Therefore, whether the information in the EEP-ROM is correct determines whether the loading and operation of the PCI card is normal. This design uses ST93CS56 as the initialization memory of PCI9030, and its structural scheme is shown in Figure 2.
1.2 Implementation of CAN bus interface
There are two common methods for implementing the CAN bus interface in the communication card:
(1) Independent CAN bus control chip implementation
That is, the Philips SJA1000 independent CAN controller is used to implement the CAN protocol. The advantage of this method is that it can implement more complex functions and has good flexibility. However, since it is an independent controller, designing a communication card with 4 CAN segments requires 4 SJA1000s, which will cause resource redundancy, the system will be larger, and the stability will be affected, making the design more difficult. [page]
(2) Microcontroller implementation with CAN interface
A representative example of this method is the Philips ARM chip LPC2294, which integrates 4 on-chip CAN bus controllers and can easily implement multiple CAN bus interfaces, reduce system size, and improve system stability.
Comparing the above two methods, in the traditional SJA1000, the receiving filter can only meet some ID filtering with high regularity, or perform arbitrary filtering on a small number of IDs (generally less than 10-15), but it is difficult to implement more complex arbitrary ID filtering, which undoubtedly increases the burden of system software design and operation.
The second design method is relatively simple. Since the LPC2294 microcontroller provides a global receiving identifier query function for all CAN controllers, it is easy to design more complex ID receiving filters, and the focus of its work is mainly on the software design of the ARM chip. This article adopts the second method to implement the CAN bus interface, and uses PCA82C250 as the CAN bus driver. At the same time, 6N137 is connected between the CAN controller and the CAN driver to reduce the electromagnetic interference of the CAN bus to the gateway card. Figure 3 shows the connection diagram of a CAN interface in LPC2294, and other interfaces are similar.
1.3 Hardware interface design between microcontroller and PCI9030
The hardware design between microcontroller and PCI9030 is the core control part of the communication card. This design uses ALTERA's FPGA EPlC6 to realize the interface between microcontroller and PCI9030. EPlC6 is an FPGA chip of ALTERA. It integrates 20 128×36 bits RAM modules. It can be easily programmed into the required "dual-port RAM", and then the uplink data (data sent from CAN node to PC) and downlink data (data sent from PC to CAN node) are forwarded through the "dual-port RAM" cache. Since EPlC6 has a rich I/O port, it can flexibly select the data format (32-bit/16-bit/8-bit) and transmission method. This paper adopts 16-bit multiplexing transmission mode. EPlC6
also needs to be programmed to realize the logic control timing conversion between PCI9030 and ARM. Since the control signals of PCI9030 and ARM are not completely consistent, logic control timing conversion is required. At the same time, the local bus side of PCI9030 in this paper adopts the address/data multiplexing mode, while the ARM controller adopts the non-multiplexing mode, so EPlC6 is also required to perform mode conversion: during the address cycle of PCI9030, LALE can be used to latch the 16-bit address into the internal register of EPlC6, and when the data cycle of PCI9030 comes, it is sent to the address port and data port of ARM together with the data to facilitate ARM to access.
2 Software Design
2.1 Communication Card Software Design
The software on the communication card mainly refers to the software program on the ARM controller. This paper selects the ARM controller LPC2294 to realize the intelligent data transmission path selection. LPC2294 is the control core of the communication card. It integrates 4 CAN controllers, each of which has a similar register structure to the independent CAN controller SJA1000, except that the access to the device register is changed from the original 8-bit byte access to 32-bit double-word access. LPC2294 can realize data transmission control between CAN network segment and host computer (including uplink data transmission and downlink data transmission) and data transmission control between different CAN network segments (parallel data transmission).
LPC2294 provides global receive identifier query function for all CAN controllers. It contains a 512×32 (2 k bytes) RAM, which can store 1 to 5 identifier tables in RAM through software processing. The entire receive filter RAM can accommodate 1024 standard identifiers or 512 extended identifiers, or two types of mixed identifiers. Since the allowed table range is 2 k bytes, it can easily meet complex ID receive filtering requirements. LPC2294 can automatically receive and select the standard frame of the network segment in FullCAN mode, but this article does not use FullCAN mode. If
a status and control register group (SOR) is set in the "dual-port RAM" of EPlC6, then the host computer can query the operating status of the communication card by accessing the register group. In order to effectively manage data transmission and prevent data loss during transmission, this design opens up a global data transmit and receive buffer (GRTB) in the static RAM area inside the ARM, as shown in Figure 4.
In Figure 4, for a standard frame, it only has an 11-bit identifier, so the identifier bytes 3 and 4 in the figure are reserved. The frame format is used to distinguish whether this frame is a standard frame (0) or an extended frame (1). When RTR is 1, it means that this frame is a remote frame. The source segment number and destination segment number in the figure are used to indicate which network segment this frame comes from and to which network segment it will be sent to (here the host computer is also treated as one of the segments). DLC indicates the number of data bytes transmitted. [page]
2.2 Communication card operation flow
After the system is powered on and reset, the system will first run the initialization program. The initialization of LPC2294 is mainly to initialize the global receive and send buffers and clear the values in the status register; the initialization of PCI9030 is mainly to load the initial data from the EEPROM for initial settings. CAN initialization includes setting the mode, bus timing, interrupt enable, and identifier table. These settings can be achieved by assigning values to the internal registers of the CAN chip. After successful initialization, the communication card will perform a self-test and enter the working state after confirming that the startup is normal. The program flow chart of this part is shown in Part A of Figure 5.
After the system enters the working state (part B in Figure 5), it will wait for an interrupt to be generated. If there is one, it will enter the corresponding interrupt service routine. If it is data transmission, it will enter the data transmission subroutine, which mainly includes three parts:
(1) Downlink data transmission
Downlink data transmission refers to the host computer sending data to the CAN segment. That is, the host computer writes the data into the "dual-port RAM" to wait for the LPC2294 to take the data away. LPC2294 temporarily stores the data sent by the host computer in the global data transceiver buffer (GRTB), and then checks whether the matching destination segment has an idle transmission area (TBS bit in CANSR is 1). If so, the data is written into the transmission area of each segment and sent. If the three transmission buffers of the matching segment are all busy, it will wait in a loop until more than one transmission buffer is empty before sending.
(2) Uplink data transmission
Uplink data transmission refers to the CAN segment sending data to the host computer. When the program detects that the receive interrupt bit (RI) in the CAN interrupt/capture register (CANICR) of a certain network segment X is set, it will enter the receive interrupt service routine. At this time, the program will search for a matching identifier in the identifier table. The CAN controller will automatically search the table in the receive filter's RAM and match it when receiving. As long as a matching value is found, a receive interrupt will be generated and the user will be notified to retain the information. Otherwise, the frame information will be automatically discarded without generating a receive interrupt. If it only finds one matching value (in the source network segment), it means that this data is only transmitted to the host computer. At this time, the program will save the received data information in the global data transceiver buffer (GRTB) according to the format described above, waiting for LPC2294 to send it to the "dual-port RAM" of EPlC6 for the host computer to read.
(3) Parallel data transmission
When a receive interrupt occurs, the program will also search for a matching identifier in the identifier table. If more than one matching value is found, it means that there are other network segments that need this data. At this time, the program will read the received data information into the global data transceiver buffer (GRTB) and then send the data to the matching network segment.
After calling the corresponding data transmission subroutine, the program will set the flag and return. If it is some other interrupt, it will go to the corresponding interrupt service program. If no interrupt occurs, check whether the PC needs parameter configuration, and finally perform system self-check. This system will perform self-check and upload status report when the system is idle, so that users can understand the working status of the communication card at any time, which is of great significance for improving the working reliability of the system and the efficiency of error detection when a fault occurs.
2.3 Upper computer program design
In this design, the upper computer software design program mainly includes the communication card bottom driver and user service program. Its design block diagram is shown in Figure 6.
The functions of the communication card bottom driver are mainly to configure the CAN bus interface, send and receive data on the CAN bus, monitor the CAN bus in real time, and execute the send and receive commands of the user program. CAN bus and PCI bus errors are both handled by interrupts, and are directly notified to the user program through the event kernel object.
The PCI user service program communicates with the system PCIDI (PCI device interface) through the PCI communication program, and the system completes the PCI protocol processing and data transmission. Users can conveniently set node parameters and query node status information on the designed host computer interface.
3 Conclusion
The CAN/PCI intelligent communication card designed in this paper uses the powerful ARM chip LPC2294 as the core control chip. Therefore, the communication card can simultaneously process the data transmission of 4 CAN buses to the host computer. For the communication needs between CAN network segments, this communication card can also meet them well and make the CAN network networking of industrial sites simpler.
Previous article:A design method for FPGA verification environment based on ARM core SoC
Next article:Design of Distributed Remote Measurement and Control System Based on ARM7
Recommended ReadingLatest update time:2024-11-16 18:00
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
- MSP430 MCU Development Record (4)
- [Project source code] Mount the FAT32 file system partition of the mirrored SD card to Linux
- The STC manual is really confusing.
- A low-cost, high-precision temperature measurement solution? Come to the special live broadcast of "TI's new generation of low-power Bluetooth controllers" to learn more
- [GD32E231 Review] 1. Unboxing experience and development environment setup
- STM32H750 Part 2 (QSPI Memory Map)
- Post consultation
- Woohoo, can someone show me how to do this? I have to hand in my homework [crying]
- Share an open source github acceleration software
- 【EVK-NINA-B400 Evaluation Kit】+Run zigbee light_control routine