Design and implementation of a typical embedded sy

  • Detail

The design and implementation of a typical embedded system

with the rapid development of computer, interconnection and communication technology, the technology of measuring the size of samples in the development of embedded system has also made rapid development, and the application scope of embedded technology has expanded sharply. This paper introduces the design and implementation of a MVB embedded system based on arm and FPGA, which is completely self-developed from software to hardware

system design and implementation

generally speaking, the development process of an embedded system is as follows: determine the requirements of the embedded system; Design the system architecture: select the processor and related external devices, operating system, development platform, software and hardware segmentation and overall system integration; Detailed software and hardware design, RTL code and software code development; Joint debugging and integration of software and hardware; System test

step 1: determine the requirements of the system:

the typical characteristics of embedded systems are user-oriented, product-oriented and application-oriented. Market application is the guidance and premise of embedded system development. The design of an embedded system depends on the requirements of the system

1. Introduction to MVB bus

train communication network (TCN) is an IEC international standard for train data communication that integrates the internal measurement and control tasks and information processing tasks of the whole train. It includes two bus types: stranded train bus (WTB) and multi-function carriage bus (MVB)

the position of TCN in train control system is equivalent to that of CAN bus in automotive electronics. MVB is a standard communication medium used to transmit and exchange data between equipment on the train. The devices attached to the bus may differ from each other in function, size and performance, but they are all connected to the MVB bus, through which information is exchanged to form a complete communication network. In MVB system, according to iec-61375-1 train communication standard, MVB bus has the following characteristics:

topology: the structure of MVB bus follows OSI mode and absorbs ISO standards. It supports up to 4095 devices and is controlled by a central bus manager. Simple sensors and intelligent stations coexist on the same bus

data type: MVB Bus supports three data types:

a. process data: process variables represent the status of the train, such as speed, motor current, and operator commands. The value of a process variable is called process data. Their transmission time is definite and bounded. To ensure this delay time, these data are transmitted periodically

b. message data: messages are divided into small packets, which are numbered respectively and confirmed by the destination station. The message packet and its related control data form message data. Message data is transmitted in command mode. Function messages are used by the application layer; Service messages are used for the management of the train communication system itself

c. monitoring data: it is a short frame, which is used by the main equipment for status verification of equipment in the same bus, detection of online equipment, sovereign transmission, initial train operation and other management functions

media access mode: MVB Bus supports RS485 copper media and optical fiber. The data format of its physical layer is 1.5mbps serial Manchester encoded data. The media access of MVB is managed by bus Manager BA, which is the only bus master device, and all other devices are slave devices. The master device polls the ports periodically in a predetermined order. During the interval of the cycle, the master device turns to handle occasional requests

reliability measures: MVB fault-tolerant measures include

transmission integrity: the link layer has an extended error detection mechanism, which provides a Hamming code distance of 8, and can detect bit, frame and synchronization errors

independence of fault: generally, the copper medium is fully configured in two parts to ensure the independence of equipment fault

sending availability: availability can be improved through media redundancy, power redundancy, manager redundancy and other measures

2. The basic requirements of MVB system are as follows:

a. it is fully compatible with iec- (TCN) international standards and supports three data types defined by MVB bus: process data, message data and monitoring data

b. the system can be configured as:

i. bus manager (BA) function

ii Bus manager (BA) function and communication function

iii. independent communication function

c. processor using ARM7TDMI

d. real time operating system

e. real time protocol stack protocol (RTP) for TCN

f. process data supporting 4096 logical port

g. dual port RAM interface with upper PC104 host

h. Input Voltage 5V

i. working environment temperature: - 40 ℃ ~ 75 ℃

3 Other requirements are that the MVB system of multi-functional vehicle bus is designed synchronously with the user's train control system, which has strict time limits

second, step 2: design the system architecture and jointly allocate the requirements of hardware/software

the embedded system includes two parts: the hardware architecture takes the embedded processor as the center, and configures necessary peripherals such as memory, i/o devices, communication modules, etc; The software part takes the software development platform as the core, provides the application programming interface (API) upward, and shields the board level support package BSP of specific hardware characteristics downward. In embedded systems, software and hardware work closely together to complete the predetermined functions of the system. According to the seven layer model of OSI, it can be determined that the link layer and physical layer are implemented by hardware, and the other layers are implemented by software, as shown in Figure 1

Figure 1: OSI model of MVB and software and hardware division of MVB system

1. Embedded operating system selection:

generally speaking, the following factors should be considered when selecting an operating system for an embedded system:

microprocessor supported by the operating system

performance of the operating system

software components and device drivers of the operating system

debugging tools of the operating system, development environment, emulator (ice), compiler Assemblers, connectors, debuggers, simulators, etc.

standard compatibility of the operating system

degree of technical support of the operating system

whether the operating system provides source code or object code

licensed use of the operating system

reputation of the developer of the operating system

vxworks real-time operating system is adopted in the MVB system according to the requirements of the system and the above principles, VxWorks is one of the real-time operating systems developed by WinDriver company. With its excellent reliability, real-time performance and reducibility of the kernel, it is widely used in key industries such as communication, military, aerospace, aviation, industrial control and so on. Its development environment is tornado

2. Processor selection:

the following aspects need to be considered when selecting processors for embedded systems:

performance: processors must have sufficient performance to perform tasks and support product life cycle

tool support: supporting software creation, debugging, system integration, code adjustment and optimization tools is very critical to the success of the overall project

operating system support: embedded system applications need to use helpful abstractions to reduce their complexity

past processor experience of developers: having experience in the development of processors or processor family products can reduce considerable time to learn new processors, tools and technologies

cost, power consumption, time to market, technical support, etc.

in the design of this system, taking into account the above factors, taking into account the processor performance, operating system support and the harsh industrial environment on the train, ATMEL is selected in the MVB system for the industrial control field of industrial grade at91 series arm processor AT91M40800, which is based on ARM7TDMI core and contains high-performance 32-bit RISC processor 16 bit highly integrated instruction set, 8KB on-chip SRAM, programmable external bus interface (EBI), 3-channel 16 bit counter/timer, 32 programmable i/o ports, why is the price of the testing machine different? Interrupt controller, 2 USARTs, Programmable Watchdog Timer, master clock circuit and DRAM sequence control circuit, and equipped with advanced energy-saving circuit; At the same time, JTAG debugging can be supported, and the main frequency can reach 40MHz

3. Selection of relevant external devices:

after determining the operating system and processor, you can determine the relevant external devices, such as flash, ram, serial port, etc. In MVB system, MVB controller MVBC (multifunctional vehicle bus controller) is an interface controller between MVB circuit and actual physical equipment. Its main function is to realize the encoding and decoding, error correction and other functions of MVB bus signal and data frame. It is the key hardware module to be realized in this system. Due to the requirements of system scale, time to market and other aspects, the system temporarily does not consider the implementation of ASIC. Therefore, FPGA is used to implement this key module in MVB system. FPGA is the most flexible and cost-effective alternative to ASIC. Considering the system requirements and FPGA resources, cost, supply and other factors, we finally chose the cyclone series FPGA of Altera company, and its development tool is Quartus II

4. MVB system architecture

based on the above requirements analysis and selection, the complete system hardware architecture and software architecture are shown in Figure 2 and figure 3

Figure 2: MVB system hardware architecture

Figure 3: MVB system software architecture

where the processor and MVBC exchange communication data through traffic memory (TM), and all control information and data to be exchanged between software and MVBC can be found in the TM address space, This address space is accessible to both the processor and MVBC. Its schematic diagram 4 is as follows

Figure 4: traffic memory

Step 3: detailed software and hardware design and RTL code, software code development

on the basis that the basic company with the system architecture determined will also continue to maintain R & D innovation, the detailed software and hardware design can begin

1. Hardware design

the hardware design includes the FPGA design of MVB controller and the board level design of MVB bus system. The design of the key MVB controller is shown in Figure 5

Figure 5: the block diagram of MVB controller

is shown in the figure. MVB controller includes the following functional modules:

encoder: generate Manchester code, Transmit data frame

send buffer: as the buffer of the data to be sent and CRC detection value

decoder: receive, Manchester decoding, data extraction, data error detection

receive buffer: as the buffer of the receiving end data and CRC results

message analysis unit: detect the timeout of the master frame and slave frame, frame error detection Error status report

status control register: MVBC configuration

master control unit: supports MVBC to work as a master or slave device, supports queue message transmission

device address reading and storage unit: the device address defined by hardware can be overwritten by different values

address logic: parses the input address of CPU accessing the MVBC internal register; Generate the output address of MVBC access TM

bus multiplexing and conversion unit: process the data transmission inside MVBC

interrupt logic: support 16 interrupt sources

general timer: two timing output signals can be provided to the system for synchronous use

clock generation circuit: generate all MVBC working clocks and counters

2. Software design

in MVB system, process data, message data and monitoring data are three different communication mechanisms, so MVB system software

Copyright © 2011 JIN SHI