1. Overall design of circuit hardware
The design mainly includes 3 modules: 1. Human-machine exchange module (S3C2410 chip expansion circuit), 2. Power output module (ATmega16L chip expansion circuit), 3. Magnetron working circuit. The human-computer exchange module is mainly used to receive the user's command data and then pass it to the power output module to output a given power. At the same time, it receives the information fed back by the power in the power output module circuit, so that the user can process the corresponding information. The overall framework is shown in Figure 1-1:
1.1 Control circuit design based on S3C2410X processor
The control system uses the S3C2410X processor of South Korea's Samsung Semiconductor Company as the main control chip. SBC2410X is a 16/32-bit RISC embedded microprocessor based on the ARM920T core, with high cost performance and low power consumption. Use this chip as the main control chip and expand 64M SDRAM, 64M Nand Flash, 1M Nor Flash, standard serial port, user button, LCD screen interface, JTAG module, and Ethernet interface (as shown in Figure 1-2).
1.2 Design of power output circuit based on ATmega16L microcontroller
The slave chip adopts AVR series microcontroller ATmega16L. ATmega16 has rich on-chip resources, including: 16k bytes of online programming, application programming Flash program processor, 512 bytes of EPROM, 1K bytes of SRAM, 32 general-purpose working registers, 32 general-purpose I/O ports, 3 A timer/data counter, 20 interrupt sources, 2 programmable serial ports USART, 15 power-saving modes selected through software.
The master and slave chip modules exchange data through their respective serial ports. Specifically, the main circuit module sends data to the slave chip module, and the slave chip generates corresponding waveforms based on the input data to obtain the corresponding output power. At the same time, the circuit module is collected from the chip application, and the actual power is collected and fed back to the main chip. The main chip hands over the data to the user for management. When necessary, a warning message will be issued to protect the circuit.
2. Driver writing and Linux kernel tailoring
The design uses Linux operating system as the operating platform. Judging from the development process of the Linux system, Linux has been an open system from the beginning and follows the principle of open source code. It is a stable network operating system and has the following advantages as an embedded system.
(1) The open source code of Linux allows anyone to modify its source code. This can reduce development costs, on the other hand it can increase development costs. (2) Linux supports multiple architectures such as X86, ARM, MIPS, and SH, and has been ported to multiple hardware platforms. (3) Linux has a unique kernel module mechanism, which can insert a module into the kernel or remove it from the kernel in real time according to user needs. (4) The Linux system kernel is streamlined, efficient and stable, and can give full play to hardware functions, so it runs more efficiently than other operating systems. (5) Linux is the first operating system to support the TCP/IP protocol stack, and its kernel is very complete in terms of networking.
Because the target environment of embedded development targets a specific operating system, the host/target machine method is used to install the Linux operating system on the PC and establish the cross-compilation environment arm-gcc. Then write specific drivers for the design system hardware, mainly including the driver functions of the display module and serial communication module.
2.1 The liquid crystal display module completes the data drive of the human-computer friendly interface and has the ability to display graphics. A modular approach is used to design the driver program. The content of LCD driver design is as follows:
(1) First, perform necessary initialization on the hardware managed by the driver. (2) Initialize device-related parameters. (3) Register the device in the kernel. The important structures involved are: static struct fb_ops s3c2410fb_ops; (4) Other initialization work. int __init s3c2410fb_init(void); int __init s3c2410fb_setup(char *options).
2.2 Serial port communication is completed. The master chip sends data and commands to the slave chip, so that the slave chip completes the waveform output of the port and controls the power of high-power equipment through the output waveform. At the same time, the high-power equipment feeds back the actual power to the slave chip through the measurement circuit, and the slave chip sends data to the main control chip through the serial port to display the correct power data, which is convenient for users to view. Serial port driver design content:
(1) Initialize serial port-related hardware devices. The important structures involved are:
static struct tty_driver normal, callout;
static struct tty_struct *s3c2410_table[UART_NR];
static struct termios *s3c2410_termios[UART_NR];
static struct *s3c2410_termios_locked[UART_NR]。
(2) Register the interrupt service routine. Accept interrupt service routine:
static void s3c2410uart_rx_interrupt(int irq, void *dev_id,,struct pt_regs *regs);
Send interrupt service routine:
static void s3c2410uart_tx_interrupt(int irq, void *dev_id, ,struct pt_regs *reg);
(3) Register the device in the kernel. uart_register_driver(&s3c2410_reg).
(4) Loading and unloading of equipment. module_init(s3c2410uart_init); module_init(s3c2410uart_init).
After designing the hardware driver, tailor the Linux kernel for the control main chip to suit the needs of the control device. Enter the PC Linux operating system, enter the ViVi original code directory, and execute the "make menuconfig" command to start configuring the kernel. After the configuration is complete, execute the "make" command to save ViVi. Burn the ViVi image file into the designed hardware circuit board through JTAG.
Enter the Linux kernel file and execute the "make menuconfig" command to start configuring the Linux kernel file. Select the driver options to be used and configure the kernel according to the actual chip module of the circuit board. Finally, use the "make" command to compile the kernel file. If there is a problem with compilation, you need to modify the kernel file. After successful compilation, download the generated image file to the circuit board through the serial port. ViVi can then start the downloaded kernel file. Kernel design and debugging flow chart 2-1.
3. Main chip control system programming and slave chip programming based on QT
Graphical user interface GUI is the most mature human-computer interaction technology in computer systems so far. Different from desktop systems, embedded GUI has the following characteristics:
* Small size; * Small system resource consumption during runtime; * Upper-layer interface has nothing to do with hardware and is highly portable; * High reliability;
During development, considering that the problem mainly focused on the hardware requirements of the graphical user interface, the final interface provided to the user in the design was simple and practical.
The embedded development platform QT/Embedded provided by TrollTech Company of Norway is used in the design as the software development platform for this design. The platform uses C++ language as the development language, and its core is called the signal and slot mechanism. In the design, the main chip mainly displays data on the LCD module, allowing users to intuitively control the operating status of the device. At the same time, the power set by the user is also sent to the slave chip, so that the slave chip outputs the power waveform. This work can be accomplished using QT's own class QLCDNumber, which inherits many display-related functions. The graphic control layout adopts the QWidget class, and the time calculation and display adopts the QTimer class. In the communication module, the Linux kernel function cfsetispeed() is used to set the baud rate, and the important serial port data structure struct termios Opt is used to set the check bit and stop bit of the serial port accordingly to achieve the purpose of sending and receiving data. Figure 3-1 shows the main chip programming process.
The slave chip uses an interrupt method to receive the data sent by the main chip, and after processing the received data, it outputs a waveform at the port pin, and the waveform generates a suitable power through the output circuit. At the same time, the slave chip continuously receives the current data collected by the acquisition module, processes the data, and then sends it to the main chip through the serial port, which is displayed on the LCD module of the main chip to provide users with monitoring and processing of dangerous signals.
4. Joint debugging of software and hardware of the control system
Compile the written main chip program with a cross-compiler to generate binary code, which is downloaded to the main circuit board using the network. At the same time, download the library files and connection files associated with the program to the corresponding location of the Linux kernel on the main circuit board through the network and link them accordingly.
The written slave chip program is compiled with a compiler to generate binary code and burned into the chip's Flash, so that the code is solidified in the chip.
In order to check the accuracy of the design circuit measurement and output, it is necessary to verify the relationship between the given power, the actual power, and the displayed feedback power. The final experiment shows: given power = calculated actual power = displayed feedback power, proving that the designed Linux-based control system can run accurately and the design meets the performance requirements.
5 Conclusion
The designed control system has a friendly graphical operation interface, which is easy and intuitive to operate. The design uses a master and slave chip solution to achieve the advantages of remote control and ensure the safety of the operator's operation.
Previous article:s3c2410/2440(armv4t) ported to Android
Next article:Implementation of digital north seeker application solution based on S3C2440A and WinCE 4.2 operating system
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- How to solve the problem of digital tube afterimage
- All-inclusive OLED
- c0000 28335 Program automatic upgrade problem
- TMS320C62x Boot Mode
- MM32F031 Development Board Review 6: PWM Breathing Light
- Want to learn about switching power supplies? Start by reading this book!
- Practical Application Skills of DC Motors
- Minimalist USB TYPE-C PD3.0/3.1 spoof trigger solution
- [Synopsys IP Resources] Using the ARC SEM130FS processor to meet the safety protection requirements of new automotive SOCs
- 【MicroPython】Using MCO as a clock