The development of very large-scale integrated circuit technology, especially the development of PLD and FPGA technology, has made it possible to realize the entire embedded system on a programmable chip. SOPC (System on a programmable chip) technology integrates the modules required for system design, such as CPU, memory, I/O interface, etc., on a single FPGA, with the features of flexible design, scalability, expandability, upgradeability, and in-system programmability of software and hardware [1].
This paper designs a portable positioning system based on SOPC technology, and proposes a solution using GPS/digital compass combined positioning to solve the problem of GPS blind spots in urban high-rise buildings and underground parking lots. This paper first introduces the system composition and hardware implementation, then makes a detailed analysis of software development, and gives the source code. Finally, the experimental prototype is tested to verify the feasibility of the system.
1 Basic system structure
The portable combined positioning system based on NIOSⅡ consists of two parts: the receiving terminal and the monitoring center. The receiving terminal receives the GPS/digital compass combined positioning signal and sends it to the monitoring center through the GPRS module. The monitoring center fuses the received combined positioning signal and adopts the map matching method based on fuzzy pattern recognition technology. It uses the high-precision road information in the GIS electronic map library as a classification template to perform pattern recognition. According to the recognition results, the positioning accuracy of the GPS received data is improved, and the real-time matching of data and electronic maps is achieved. The location of the receiving terminal wearer is displayed in real time. Authorized users can also view the location of the terminal wearer anytime and anywhere through the Internet. In the event of an emergency, the terminal wearer can trigger the alarm button on the terminal, and the monitoring center will handle it accordingly in real time.
2 Receiving Terminal Hardware Design
The system receiving terminal hardware consists of an FPGA chip and GPS module, GPRS module, digital compass module, alarm module, etc. The FPGA chip mainly implements the functions of NIOSⅡ soft-core processor, on-chip memory and digital interface circuit.
NIOSⅡ is a 32-bit RISC embedded processor launched by Altera. It can be combined with user logic and programmed into Altera FPGA. The processor has a 32-bit instruction set, a 32-bit data channel and configurable instruction and data buffers. It has low implementation cost, and the implementation cost in FPGA is only 35 cents. It is flexible and uses a soft core. It has fully customizable features. Designers can choose from a variety of system setting combinations according to actual needs to achieve performance, features and cost optimization. It has a performance of more than 200DMIP [2]. It can be updated by downloading the hardware configuration file to the FPGA, which is very convenient.
According to the functional requirements of the system and the high configurability of the NIOS II soft-core processor, the NIOS II soft-core processor system customized by the hardware development tool SOPC Builde is shown in Figure 1. NIOSⅡ soft-core CPU, OnChip RAM, Timer, UART, Epcs controller and other modules are implemented on an Altera EP1C12Q240C8 FPGA. The NIOSⅡ soft-core CPU and other IP modules are connected through the Avalon on-chip bus, which specifies the ports for connection between the master and slave components and the timing of communication.
Figure 1 Customized NIOSⅡ processor system
The UART serial communication module is used for communication between the NIOSⅡ processor and the outside. This system collects the positioning signals of GPS and digital compass through the serial port, and sends the positioning signals and alarm signals to the GPRS module through the serial port to the monitoring center. On Chip RAM improves the on-chip storage unit for the system. CY1C12Q240C8 provides 239,616 bits of RAM unit, and the system does not need to expand external memory. The Epcs controller module is used to control the hardware configuration file and program to be downloaded from the serial configuration chip to the FPGA when the system is powered on. The Timer module provides system timing interrupts, and the alarm module consists of a button. When the terminal wearer encounters an emergency, the button is triggered to alarm the monitoring center. The power module provides system power to the system, and the crystal oscillator module provides system clock to the system.
3 Receiving Terminal Software Implementation
The receiving terminal software is developed in the integrated development environment Nios II IDE, which mainly completes the collection of positioning data and communication with the monitoring center.
3.1 Software Development Environment Nios II IDE
Nios II IDE is the main development tool for the Nios II soft-core processor. It is based on the open and extensible Eclipse platform and provides a complete C/C++ design and development environment for software development. It includes a graphical user interface (GUI) with project management, source code development, and JTAG-based debugging functions. With the help of HAL (Hardware Abstraction Layer), C-like library functions can be used to access hardware devices or files [3], shortening the software development cycle.
3.2 HAL system library
The HAL (Hardware Abstraction Layer) system library can provide a simple device driver interface for embedded software developers to access the underlying hardware. The NIOS II soft-core processor supports HAL, which provides the following support for users: standard library integrated with ANSI C - providing standard library functions similar to C language; device driver, providing drivers for accessing each device in the system; HAL API, providing standard interface programs such as device access, interrupt processing, etc.; system initialization and device initialization, providing initialization of the processor and system peripherals before the main() function. The system hierarchy based on HAL is shown in Figure 2.
Figure 2 System hierarchy based on HAL
3.3 Receiving terminal software development
According to the functions of the system, the software design flow chart is shown in Figure 3.
Figure 3 Software design flow chart
3.3.1 Terminal initialization program design
Terminal initialization mainly completes the download of hardware configuration files, system initialization, and device initialization when the system is powered on. Using the main() function, the HAL system library can automatically initialize the system. However, automatic initialization shields the underlying operations, and some unused device drivers are also initialized, which increases the length of the program code and reduces the system efficiency. The ANSI C standard provides a function alt_main() for users to freely initialize the system. Users can freely initialize the system in this function instead of the automatic initialization of main(). The alt_main() function of this system is as follows:
3.3.2 Design of positioning data collection program
The location data is mainly collected by GPS and digital compass, using the serial port receiving interrupt method. In NIOS II, the serial port includes 6 16-bit registers, and the corresponding data structure in the software is:
program
The serial port is treated as a character device. Access to it can be done through standard input (stdin) and standard output (stdio), or by opening and writing files. This system uses direct access to registers and access macros automatically generated by the system. This allows the use of streamlined Newlib C to reduce the length of program code, and uses serial port interrupts to receive data. To use interrupts in NIOS II, you must first register with the system and turn on hardware interrupts. The main procedures for interrupting GPS signal collection are as follows:
3.3.3 Timer interrupt program implementation
The system uses a timed interrupt method to communicate with the monitoring center and send the positioning data to the monitoring center. NIOS II provides two types of clocks, the HAL system clock and the clock based on the timestamp driver. The latter is suitable for occasions with high clock precision. The system clock provides a timing function. Using the timer is the same as using the interrupt method. First, you need to register a clock interrupt with the system through the alt_alarm_start() function, and then implement GPRS sending in the clock interrupt service program. The alt_alarm_start() function is declared as follows:
alt_alarm_start (&alarm, alt_ticks_per_second(), GPRS_ISR(), NULL)
Among them, alarm is the timer interrupt variable, which is automatically initialized by the system. The second parameter is the time after which the service program starts to execute after the clock interrupt is registered. alt_ticks_per_second () is the number of "ticks" of the system clock per second. Here, the execution starts after one second. GPRS_ISR () is the service program. NULL is the parameter of the service program, which is empty here.
After the timer interrupt service program is completed, the positioning data is sent to the monitoring center through the GPRS module. This is achieved by writing data to the GPRS through the serial port. This is achieved through the following statement: IOWR_ALTERA_AVALON_UART_TXDATA (BASE, DATA) //Write data to the serial port, BASE is the base address of the serial port, and DATA is the data to be written.
3.4 Issues that should be paid attention to in software development
In view of the characteristics of NIOS II soft core processing software development, the following points need to be noted:
(1) As a software package supported by the NIOSⅡ processor, the HAL system library can provide convenience to software developers, including automatic initialization of the system and the use of the ANSI C standard library, but this comes at the cost of increasing code length.
(2) When developing embedded software for the NIOSⅡ soft-core processor, there are many ways to reduce software code and improve work efficiency, including using a custom initialization function alt_main(), using a streamlined Newlib C library, optimizing software compilation parameters, custom instructions, etc. However, this undoubtedly places higher demands on software developers.
(3) When writing interrupt service routines, be careful to prevent system "deadlock", especially when using ANSI C standard library functions to access IO devices.
4 Test results
The prototype of this system was compared with the positioning system with GPS single positioning in the Xudong underground passage in Wuhan. The test results are shown in Figures 4 and 5. From the comparison results, it can be seen that the positioning system with GPS single positioning has a positioning blind spot in the underground passage area, while when the receiving terminal of this system walks in the underground passage, the trajectory can be displayed in real time on the map of the monitoring center, which overcomes the positioning blind spot of the previous single GPS positioning system, verifies the feasibility of the system and reflects its superiority.
Figure 5 GPS single positioning trajectory
Figure 6 Positioning trajectory of this system
5 Conclusion
This paper adopts SOPC technology to design and implement a portable combined positioning system based on NIOSII soft-core processor, and adopts GPS and digital compass combined positioning to overcome the blind spot of single GPS positioning. Compared with traditional portable positioning products, this system has the advantages of short development cycle, low development cost, long product life cycle and wide application range. The system is small in size, easy to carry, and can be sewn into clothes and accessories. It is suitable for the elderly, children, and mentally retarded people to wear in order to monitor them and prevent them from getting lost. It is also suitable for some special industries, such as postal, public security, electric power, and metallurgical industries, and has a promising market prospect.
Previous article:Converter input impedance calculation method and measurement techniques
Next article:USB-based home appliance automation
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- What is an Operational Amplifier?
- [N32L43X Review] 5. SPI driver LCD 1.3 ST7789
- Is the MCU program running out of control again? Analysis of three types of running out of control phenomena
- Some understanding of convolution
- Ultra-low power MCU-how to select low power MCU
- Analog circuit behavior model and simulation based on Verilog-A_.pdf
- The CH224K-EVT review + board is back, a success, one step closer to the SMT heating platform
- RFID, GPS, CPRS and temperature and humidity sensing technologies enable cold chain transportation monitoring
- How to understand the equivalent of capacitors passing AC
- SHT11 and SHT21 Sensors