Abstract: Design a DC motor control system in the master-slave control mode of embedded microprocessor ARM&DSP, focusing on the DC motor monitoring system interface designed based on QT/Embedded, including serial communication and motor control. Build a development environment based on embedded operating system Linux, use C++ language to develop application program interface, and realize data communication between master and slave controllers according to the application layer protocol based on serial port. And complete the transplantation of Linux operating system, and realize human-computer interaction through touch screen.
Keywords: S3C2440;
TMS320F2812
: Linux; QT/Embedded; DC motor; graphical user interface
0 Introduction
Embedded technology is widely used in the field of robot control. It concentrates the latest scientific research results of multiple disciplines such as mechanical engineering, automatic control and artificial intelligence, and has become the focus and center of current scientific and technological research and application. One of the key problems that need to be solved in robot control system is motor control technology. This topic is based on the hardware platform of the master-slave control mode of the embedded system processor ARM&DSP. Using the Linux operating system, the control of the DC motor is studied and an application development based on QT is designed to provide users with an operation interface in a graphical way to achieve a more intuitive state display and flexible control of the motor.
1 Overall design of the control system
The main controller of this system is composed of a Samsung S3C2440 embedded development board based on a 32-bit ARM.
920T RISC processor. It runs an embedded Linux operating system inside and is mainly responsible for the control of the system and the communication with the slave controller DSP. The main controller realizes data communication with the slave controller through the serial communication interface (UART), including sending control instructions in a specific data format and receiving sensor data returned by the DSP controller. The Linux operating system is used to build a platform and develop a QT-based graphical interface. The human-machine interface is realized through the touch screen to complete the control of the motor and the sensor and the display of the sensor data. The slave controller uses a 32-bit fixed-point controller TMS320F2812, which mainly completes the control of the motor and feeds back the current motion state to the main controller ARM9. The overall structural design block diagram of the control system is shown in Figure 1.
2 Serial Communication Design
In this system, the communication between the master controller ARM9 and the slave controller TMS320F2812 uses a serial communication interface, namely the UART port. The SCI module of TMS320F2812 uses interrupts for control. Its reception and transmission are double buffered, and the two can work independently in full-duplex mode. The serial port uses two I/O pins SCITXD and SCIKXD that can be reused and have priority to send and receive data respectively. The RS-232 and the TTL level in the DSP need to be equipped with a driver and isolation circuit to form a simple communication interface. The driver chip MAX3232 that complies with the RS-232 standard is used for serial communication between ARM9 and DSP. The MAX3232 chip has low power consumption, high integration, and two receiving and transmitting channels. The TMS320F2812 serial interface circuit is shown in Figure 2.
When the serial communication interface of TMS320F2812 is working, its functions can be realized through software programming. After receiving data, the direction and speed of the motor are controlled through the general timer, PWM unit and capture unit in the event manager module.
3 Design of QT Graphical Interface
3.1 QT/Embedded
Most embedded systems need to communicate with people, and have formed human-machine interface products based on graphical display and touch screen control, with fully customized software and hardware. QT/Embedded is a cross-platform application and UI development framework that supports rich graphical controls and provides beautiful interface development, fully meeting the interface display requirements of human-machine interaction products. The implementation structure diagram of QT/Embedded is shown in Figure 3.
QT applications are developed in C++. QT's API is divided into three parts: controls, frameworks, and tools. Its efficient performance is inseparable from its signal and slot mechanism. The QT/Embedded development process is shown in Figure 4.
Establish the QT development environment on the host machine, install cross-compilation tools, including compilers, linkers, library functions, etc. The application runs on the host machine, and the generated target code is for a specific hardware platform. And using QtCreator's cross-platform Qt integrated development environment helps improve development efficiency. The development of QT applications is transplanted to the target board after debugging on the host machine.
3.2 Serial communication interface
The serial communication interface provides serial port property settings, serial port data communication interface functions, and motor status information fed back to ARM9 by DSP. The serial communication interface is shown in Figure 5. Click the 'Edit Parameter' button in the interface to configure various serial port parameters. After configuring the parameters correctly, click the 'Connect' button to connect the serial port and prepare for communication. The motor status can be obtained by clicking 'Receive'. The 'Motor' menu can open the motor control interface, and its control is also transmitted through the effective serial port.
When designing the serial port configuration interface, first define the structure serial config, as follows:
After setting the serial port parameters, click 'Connet' to send the QPushButton signal clicked() to call the custom slot function setup_serial() to read the parameters in the QT control and configure the corresponding serial port according to the parameters. The member function currentText() of the control portNameComboBox obtains the set serial port number, reads the serial port name, and assigns it to the property serial.dev. The code segment for setting the serial port name is as follows:
Similarly, read other corresponding parameters of serial communication. Next, you need to open the serial port. The code segment is as follows:
Among them, the open function is used to open the serial port and obtain the file descriptor fd_serial of the serial port device file.
In the slot function setup_serial(), after completing the parameter reading and opening the serial port operation, the baud rate is set by calling the custom sub-function set baudrate(int), while the sub-function set Parms(int) is used to set other parameters. The termios data structure for Linux serial port communication is mainly used to configure the serial port. Since the serial port is used to read or control the motor, waiting is not allowed, so for any serial port opened, it needs to be set to non-blocking working mode. In the program, fcntl(fd serial, F_SETFL, O_NONBLOCK) is used to set the buffer that defaults to blocking read under Linux to non-blocking read.
When designing the motor status reading part, the structure motor_status is first defined:
When the motor is in normal working state, click 'Receive' on the interface, and the custom slot function receive data() will respond to read the motor status. The format of the data packet fed back by the DSP to ARM9 is shown in Table 1. The data format size is a 16-bit char array. In the slot function, use the read(fd_serial, buff16) function to read the 16-bit data with motor status information through the serial port and assign it to the array buff[].
Pass each field of the character array buff[] to the corresponding motor_status attribute, and send custom signals respectively. The QLabel control used to display the motor status is a subclass of QWidget, and its slot function setText(QString) receives the signal and displays it. For example, the process of displaying the motor speed status is: emit the custom signal speed_changed(QString), trigger the slot function setText(OString) of the QL-abel type control label_DiskSpced_value, and display the current motor speed on the interface. The statement connecting the signal and the slot function is connect(this,SIGNAL(speed_changed(Qstring)), ui->label DiskSpeed value, SLOT(setText(QString)), which realizes the data display of the motor speed.
The motor control interface provides the configuration of motor control instructions. The motor control interface is shown in Figure 6 below.
Click the 'Edit' button to edit the parameters, then click 'Send' to make them effective through the serial port transmission.
First, define the motor parameter structure motor config:
After clicking 'Send', the signal clicked() of the QPushButton control is sent, which triggers the custom slot function send_data() to pass the control command to the DSP through the serial port. Define the data format of the motor control received by the DSP, as shown in Table 2, and a 13-bit char array is required to store the motor control information. In the slot function send_data(), the value is assigned to
the char buff[] array according to the format, and then the data is written to the serial port through the function write(fd_serial, buff, sizeof(buff)).
3.4 Experimental results
The simulation of the QT application under Linux on the PC is completed, and the binary executable file executed on the development board is compiled. The final running effect on the embedded ARM board is shown in Figure 7, which realizes the serial communication between ARM and DSP and the monitoring of the motor.
4 Conclusion
The GUI application based on QT/Embedded runs on the embedded operating system Linux, which is efficient and stable. The UI design provides a good user experience and meets the interface display requirements of embedded devices. This project uses the technical solution of ARM&DSP+Linux+QT/Embedded to design and implement the motor control interface, showing the feasibility of high-performance embedded processors, intelligent embedded operating systems, and graphical applications in embedded product applications.
Previous article:Design and implementation of an embedded system upgrade
Next article:Implementation and Application of MODBUS Protocol Based on ARM Cortex-M3
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Brief Introduction to the Principle and Design of Flyback Converter
- WIFI development software tool sharing
- 【Renovation of old things】Graffiti lamp 1 Material preparation
- [TI recommended course] #[High Precision Laboratory] Interface: RS-485#
- Crazy Shell AI Open Source Drone I2C (Laser Ranging)
- Is Apple’s 145-yuan polishing cloth a waste of money?
- Input overvoltage and quiescent current of TPS62150
- Raspberry Pi PICO Macro Keyboard
- EEWORLD University Hall----Live Replay: Qorvo, muRata, Keysight Collaboration- New Opportunities in UWB Market
- RIGOL Live Replay | China's "Core" flagship digital oscilloscope is launched