With the continuous improvement of the control level of locomotives in China, microcomputer control has become an important control method for locomotive control in China. The logic control unit LCU (Logic Control Unit) is a control module that mainly completes the functions of locomotive operation logic control and circuit fault recording control. It is an important component related to the safe operation of the locomotive. Compared with the traditional contact control circuit, LCU has the advantages of high reliability, small size, good versatility, and simple and convenient maintenance. Traditional
LCU detection includes manual detection, single-chip detection, and PC detection through serial port control development board [1]. However, with the improvement of LCU production and manufacturing level, traditional detection methods can no longer complete the test task well.
ARM has the characteristics of short design and development cycle, low power consumption, and superior performance, which can meet the requirements of LCU detection. The universal LCU detection software developed based on the Linux operating system can provide multi-level and multi-occasion reuse, which can save equipment costs and has huge market prospects and economic benefits.
1 System design principle
LCU detection is to test the internal operation logic of LCU and perform fault diagnosis. The test system sends an initial command to the LCU under test and checks whether its output result is the same as the reference output to determine whether the logic of the LCU under test is correct.
This article uses some concepts in traditional relay control for software analysis. Traditional hardware relay contacts are divided into two categories: "normally open contacts" and "normally closed contacts". The operating results of a line will be reflected on another coil, so the output of relay control can be represented by a coil. This article uses the names in hardware relays for software logic analysis. In the program, the BOOL variable TRUE represents the contact open state, and FALSE represents the contact closed state.
The signals on the line can be expressed in binary, so the test range will increase exponentially according to the number of contacts on the line. For control signals with less stringent requirements, it is only required to obtain the result of opening or closing under appropriate conditions, and the conditions for its action are sufficient but not necessary conditions. For control signals with strict requirements, it is not only required to obtain the desired results under certain conditions, but also to ensure that this condition is a sufficient and necessary condition. Therefore, to a large extent, the test may traverse all combinations of contacts, and the overall test time will expand to a large time range. Assuming that the signal flow time value of a line is ns, the total test time for a line containing 20 contacts is 220ns.
It can be seen that the selection of test conditions is very important. The main contradiction of test complexity lies in the number of circuits that need to prove the necessary and sufficient conditions and the number of contacts of the circuit. The industrial standard is reflected in the program to retain the selectivity of the test, which is convenient for selection and modification in subsequent work. In addition, the algorithm of the control program, compound operations, and improving the efficiency of the test are also the key. The hardware block diagram of this system is shown in Figure 1.
2 Embedded Linux Operating System Migration
The setting of a cross compiler is the first step in embedded system development. Cross compilation is to compile a code on a machine with one architecture to run on a machine with another architecture. If you want to develop a program to run on an ARM target board, both the operating system and the application program must be binary code based on ARM system instructions [2]. However, developing programs directly on the ARM target board seriously restricts development efficiency, both in terms of program running speed and debugging methods. Some programs can only be written on a PC. The purpose of cross compilation is to develop programs on a PC, and then place them on the ARM target board for execution after cross compilation. The compilation sequence is shown in Figure 2.
The steps to build an ARM cross compiler are as follows: (1) compile and install binutils; (2) install the header files of Linux; (3) compile and install the C compiler of gcc; (4) compile and install glibc; (5) compile and install the C and C++ compilers of gcc.
Boot-loader is the boot program of the RAM chip, and its function is to load the operating system. There are two well-known open source boot-loaders, one of which is U-boot. It is in the form of a code package. According to the general programming habits of Linux and different target boards, the corresponding assembly and C language codes are listed in the corresponding folders, allowing developers to configure them by themselves.
The process of modifying U-boot is as follows: (1) basic hardware initialization; (2) jump to the C entry point of Stage 2; (3) define the function Nand_init; (4) jump to Kernel.
The Linux kernel is a collection of executable Linux operating system packages, referred to as kernel [3]. The selection of packages is the configuration of the kernel. The configuration of the kernel indicates the adjustability of the kernel. According to the development rules of Linux software, you can go to the path of the Linux kernel source code package and use the configuration command in the terminal to configure the kernel. When configuring the kernel, you need to define the command line for kernel startup.
3 LCU detection system application
3.1 Software design and its elements
Software application design is to determine the various parts of the software and the relationship between them, the information sent, transmitted and received in it, and the direction and trend of the development of the movement of the parts, and finally obtain a predictable result [4]. It should follow the following four basic elements: name, problem, solution effect.
Object-oriented software development can get solutions to different problems from different levels of problem treatment. Its basic workflow is shown in Figure 3.
3.2 Define basic classes and objects and design human-computer interface
In the description of demand analysis, the three most frequently used terms are contacts, tests, and coils. Each test contains different coils, and each coil is composed of contacts. Therefore, contacts, coils, and tests can be abstracted into separate classes. Contacts must have IDs, and the normally open/normally closed type and the value in operation should all appear in the attributes. The test ID should be able to distinguish which test it is, and record the initial values of the included contacts and the expected values of the results under standard conditions. Coils use contacts and tests as member variables.
First, design a two-dimensional array to simulate the relationship between tests and contacts. Assuming that the horizontal and vertical representations of the array are tests and contacts, respectively, the design of a coil is shown in Figure 4.
In contrast to the actual situation, a two-dimensional array can be used for description. The addition and deletion of contacts are the insertion and deletion operations of columns, and the addition and deletion of tests are the insertion and deletion operations of rows. The experiment of a certain coil is to traverse each row once, and the results are compared with the expected values for logical judgment. However, this only expresses the situation of a single coil. Multiple coils present a book page structure as shown in Figure 5.
Intuitively, the overlapping coils are like pages in a manual. The way to test the entire system is to flip through this "book" and go through all the coils from beginning to end.
3.3 Serialized storage class serial and linked list class
If we continue this idea, new problems will arise regarding array operations: in C language, the size of the array must be determined before the appropriate memory can be allocated. For example, to get an m×n two-dimensional array, the size of m and n must be determined at compile time, but in fact, m and n are required to be variable.
Since the file is an interface called internally by the test system, we should first analyze it along the conclusion of using files to register test items. Using serialization technology can simply and conveniently implement file storage. Serialization refers to the process of storing the state of an object instance to a physical device that can persist information, and its characteristic is linear storage. Serialization technology implements file storage, and it also provides an idea: treat everything as a unified main line. Applying it to the "two-dimensional structure" is to turn the two-dimensional table into a one-dimensional large table, and use pointers to maintain logical connections. As shown in Figure 6.
However, serialization only provides chain-type storage, and can only use one-dimensional linked lists to simulate two-dimensional arrays, because it is unknown how the pointers of two-dimensional linked lists should be arranged.
It is decided to use the chain connection method: use pointers to achieve connection. However, the transfer of pointers crosses the class, so it is necessary to directly abstract the chain structure into classes, generate and define contact linked list classes, test linked list classes, and coil linked list classes, and abstract them into a basic linked list class to implement basic linked list operations, and then derive the above three linked list classes from it.
3.4 Calculate expected values
The test changes the contacts it contains at will, and the expected values of the test change accordingly. This can be achieved by manual input, but if the expression string is used to express the logical calculation of the test, it can be implemented by the machine through character replacement.
The ID name of the contact must be in the middle of the expression string, and the name of the normally closed contact is preceded by "~". The "and" logic of the test line is represented by the character "*", or the logic is represented by the character "|" (other calculation characters can also be selected), and the priority line logic is represented by brackets. The space is a humanized adaptive definition. In this way, the logic of the line can be expressed.
The algorithm for calculating the expected value is as follows:
(1) Enter the target string.
(2) Remove spaces first.
(3) Replace the contact ID with the contact status value. If it is FALSE, replace it with F; if it is TRUE, replace it with T.
(4) Start the loop: F*F replaced with F
F*T replaced with F
T*F replaced with F
T*T replaced with T
F|F replaced with F
F|T replaced with T T|
F
replaced with T
T|T replaced with T
(T) replaced with T
(F) replaced with F
Measure the length of the string. If it is smaller than the last time, restart the loop; if there is no change, jump out of the loop and proceed to the next step.
(5) Judgment: If the string == T, it means the expected value is TRUE; if the string == F, it means the expected value is FALSE; if the string is any other value, it means the input expression is incorrect, and prompt to re-determine the expression. [page]
3.5 Data Compression
According to the design, the contact can be intuitively defined as a class like this: the content includes a BOOL variable and a pointer. The BOOL variable represents the state value of the contact, and the pointer points to the position of the next contact. However, this will cause the file to be too large, so data compression is required.
The BOOL variable uses the last position 0 or 1 to indicate the FALSE or TRUE state, but all the previous bits of the BOOL variable are not used. Therefore, all the previous bits of the BOOL variable can be used to indicate the state of the contact, which is the basic idea of compression. The pointer is also compressed at the same time. Because it is not an array, the memory address may not be continuous, so there is no need for a pointer to indicate the position of the next contact, so the pointer can also be omitted.
Compression efficiency analysis: Because the Boolean value is usually defined as 8 bits in length, it is now represented by only 1 bit, so the compression limit should be able to reach 8 times. This compression ratio can effectively save the storage size of the test data.
3.6 Data storage method examination
The data storage method must be considered, and different storage methods directly affect the bit operation. Therefore, before performing bit operations, the storage method must be clear. The little-endian mode stores data from low byte to high byte, while the big-endian mode stores data from high byte to low byte. The storage order
of the union is that all members are stored from the low address. Integer definitions usually occupy 4 bytes and 32 bits, and char definitions usually only occupy 1 byte and 8 bits. It is generally believed that the expression of the big-endian mode is more in line with the mathematical thinking habits in life, so it is better to do the conversion work on the little-endian mode platform and convert the expression into the big-endian mode. Define a SWAP conversion work macro, which swaps the corresponding bytes (the highest and the lowest are intermodulated, and the middle two are intermodulated) to obtain different modes.
This system is a general LCU detection software developed based on the Linux operating system, which has the characteristics of versatility, portability and flexibility. Using the Linux operating system platform can further reduce costs. The ARM embedded system itself has good confidentiality measures for software and data information, which is suitable for storing commercial information. This system also adopts a software module design that separates test items from programs, which greatly increases the types of tests. Whether it is a change in test items for the same vehicle model, testing of other vehicles, or testing of a wider range of general LCU systems, all can be solved one by one, with significant economic and social benefits.
Previous article:Design of embroidery machine control system based on ARM
Next article:Application of ARM in digital remote video monitoring system
Recommended ReadingLatest update time:2024-11-16 16:43
- 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
- Award-winning live broadcast: Application of TI millimeter-wave radar in cars is now open for registration~
- Modelsim10.4 installation and adding crack files error solution
- TI - MCU - MSP430 User Guide 1 -> MSP430 Introduction and Selection Guide
- [BearPi-HM Nano, play Hongmeng "Touch and Go"] -1- Unboxing and preliminary data collection
- Adding your own C functions to MicroPython
- PCB production
- Sharing 10 common formulas for switching power supply design
- Battery Management System BMS Technical Data Transfer
- [Raspberry Pi Pico Review] LCD1602 4-bit mode display driver
- There are 10 digital tubes on a digital tube display board, which uses 1 74HC00D, 2 74HC04D and 10 74HC164D