Embedded micro universal controller and control system based on FreeRTOS
By designing an embedded micro universal controller based on FreeRTOS, the PLC has solved the problems of high cost and limited computing power in single-machine device control, and the low cost, high flexibility and scalability of device control are achieved, and multi-tasking concurrent processing and Flexible network communication.
Patent Information
- Application Number
- CN202411651147.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-02-18
AI Technical Summary
Existing PLCs have high costs in single-machine device control, limited computing power, limited control flexibility, inflexible network communication and difficulty in meeting the needs of multi-tasking concurrent processing.
Design an embedded micro universal controller based on FreeRTOS, and realize multi-task concurrent processing through the main chip MCU and multiple modules (such as RS485 serial port, RS232 serial port, CAN bus, SDRAM external memory, etc.). and flexible network communication.
It realizes low cost, high flexibility and scalability of equipment control, supports the parallel execution of multiple control tasks, and improves system response speed and resource utilization.
Smart Images

Figure CN119472439A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent stand-alone control, and in particular to an embedded micro-universal controller and a control system based on FreeRTOS. Background Art
[0002] In the field of automation control, some stand-alone equipment or simple equipment control usually adopts PLC for control. The detection signal is connected to the I0 module of PLC, and the user performs logic programming to control the movement, start and stop of the equipment. However, there are some shortcomings in the PLC control process:
[0003] The cost of PLC is too high. Some simple devices do not need to be controlled by industrial controllers, which results in a lot of redundant functions and cost waste.
[0004] The computing power of PLC in the control process is very limited, and some specific algorithms cannot be implemented, which limits the control flexibility.
[0005] In terms of network communication, there is no flexible network communication method to realize the collection and upload of some frequently repeated information;
[0006] Traditional embedded controllers or PLCs usually use a single thread operation, which makes it difficult to meet the needs of multi-task concurrent processing and cannot fully utilize the advantages of multi-threaded processors, resulting in slow system response and low resource utilization. Summary of the invention
[0007] The purpose of the present invention is to provide an embedded micro-universal controller and control system based on FreeRTOS to address the shortcomings and defects in the existing intelligent stand-alone and equipment control, so as to achieve the purpose of quickly realizing equipment control at a lower cost, higher flexibility and scalability. It can also provide data and realize interaction with the outside world through multiple communication protocols. It can support the parallel execution of multiple control tasks and improve the response speed and resource utilization of the system.
[0008] The technical solution of the present invention is as follows:
[0009] The invention discloses an embedded micro universal controller based on FreeRTOS, comprising a main chip MCU, wherein the main chip MCU is connected with a power supply system, a network coupling switching module, three RS485 serial ports, two RS232 serial ports, a real-time clock RTC, an optical coupling isolation input module, an analog input module, an isolation relay output module, an SDRAM external memory, a CAN bus, ten DC outputs, an EEPROM module and a JTAG download port through pin multiplexing; the main chip MCU adopts a microcontroller with an M4 core; the network coupling switching module is connected with a PHY chip through the network switching pins of the main chip MCU, and the pins of the PHY chip are coupled with a switch chip by voltage-type signals and current-type signals, so that the network communication function of the main chip MCU is expanded from one PHY chip to four PHY chips through the switch; the network coupling switching module communicates with a bus protocol stack chip by using an SPI communication protocol.
[0010] Furthermore, the power supply system adopts 24V power supply, and meets the electromagnetic compatibility requirements for internal and external interference through capacitor filtering and common mode filtering of the power supply.
[0011] Furthermore, the main chip MCU is connected to the serial port chip through multiplexing of the serial port pins, thereby connecting three RS485 serial ports and two RS232 serial ports.
[0012] Furthermore, the main chip MCU is connected to a real-time clock RTC with a power-off timing function through pin multiplexing.
[0013] Furthermore, the main chip MCU multiplexes the connection through the general GPIO pins to realize the optical coupler isolation input module, analog input module, and isolation relay output module for reading the sensor input signal and outputting the output voltage.
[0014] Furthermore, the main chip MCU is connected to the SDRAM external memory through pin multiplexing, and the main chip MCU communicates with the SDRAM external memory through the SFMC protocol.
[0015] Furthermore, the main chip MCU is connected to a CAN bus through CAN communication pin multiplexing.
[0016] Furthermore, the main chip MCU is connected via I 2 C communication pin multiplexing connects to EEPROM module, and the main chip MCU connects to EEPROM module through I 2 C protocol to communicate with the EEPROM module.
[0017] Furthermore, the main chip MCU is connected to a JTAG download port for programming and downloading the main chip MCU through pin multiplexing.
[0018] The present application also includes a control system, which adopts an embedded micro-universal controller based on FreeRTOS, including a hardware driver layer, a firmware library layer and a business logic layer; the hardware driver layer includes an MCU operating environment program, a network communication module driver, a three-way RS485 serial port driver, a two-way RS232 serial port driver, a real-time clock RTC driver, an optocoupler isolation input module driver, an analog input module driver, an isolation relay output module driver, an SDRAM external memory driver, a CAN bus driver, and an EEPROM module driver; the firmware library layer encapsulates the firmware operations of the hardware driver layer; the business logic layer calls the firmware library layer to perform business logic control according to the business scenario; and it is also equipped with an RMII lightweight network protocol stack.
[0019] Compared with the prior art, the present invention has the following beneficial effects:
[0020] 1. An embedded micro-universal controller and control system based on FreeRTOS, with strong versatility: the system can flexibly configure system parameters according to different application requirements and support a variety of control algorithms and communication protocols.
[0021] High real-time performance: Multi-task scheduling based on FreeRTOS can ensure the real-time response of each task and improve the stability of the system.
[0022] High resource utilization: Supports task logic processing, fully utilizes system resources, and improves task execution efficiency.
[0023] Easy to expand: The system architecture is well designed, and new functions and modules can be easily added to meet future expansion needs.
[0024] 2. An embedded micro-universal controller and control system based on FreeRTOS can realize the control of equipment at a relatively low cost. The GPIO signal and analog signal of the equipment can be directly connected to the controller. After the business logic is written, the controller can be used to directly control the equipment. In addition, the LWIP lightweight network protocol stack is used in this system, which can quickly realize network communication and various network protocols. In addition, the instruction set of the main chip is relatively comprehensive, and it can run some complex algorithms, data acquisition, and data analysis functions. It can effectively improve the intelligent control level of the equipment. It also has 4-way network communication capabilities, which can meet complex scenarios that require network exchange. It can quickly, flexibly and effectively realize the action control of the equipment, external data exchange, and is compatible with more third-party devices to participate in the operation control of the equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a schematic diagram of the general controller composition of this application.
[0026] Figure 2This is a schematic diagram of the control system architecture of this application.
[0027] Figure 3 This is a schematic diagram of the architecture of an embodiment of the present application. DETAILED DESCRIPTION
[0028] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0029] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.
[0030] See also Figure 1-3 , an embedded micro-universal controller based on FreeRTOS, such as Figure 1 As shown, it includes a main chip MCU, which is connected to a power supply system, a network coupling exchange module, three RS485 serial ports, two RS232 serial ports, a real-time clock RTC, an optocoupler isolation input module, an analog input module, an isolation relay output module, an SDRAM external memory, a CAN bus, ten DC outputs, an EEPROM module and a JTAG download port through pin multiplexing; the main chip MCU adopts a microcontroller with an M4 core of STM32 company, supports running the FreeRTOS system, and has the ability to process multi-threaded logic; the network coupling exchange module is connected to the PHY chip through the network exchange pin of the main chip MCU, and the pin of the PHY chip is coupled with the switch chip by voltage-type signals and current-type signals, so that the network communication function of the main chip MCU is expanded from one PHY chip to four through the switch, which increases the hardware requirements of the network exchange function in many scenarios; the network coupling exchange module uses the SPI communication protocol to communicate with the bus protocol stack chip. The communication of network protocol buses such as Ethernet, Modbus, CAN, and Profinet is realized.
[0031] The power supply system supplies power to the entire controller and provides external working voltage. The above modules, together with the supporting circuits, are packaged into a PCB board and a specially designed housing to form a universal controller.
[0032] The power supply system uses 24V power supply, and through the capacitor filtering and common mode filtering of the power supply, the internal and external interference meets the electromagnetic compatibility requirements. After the voltage conversion module is connected to the power supply pin of the main chip MCU, it also supplies power to other modules and peripherals, and directly connects to the DC output module to enable the controller to supply power to some third-party devices.
[0033] The main chip MCU is connected to the serial port chip through the multiplexing of the serial port pins, and then connected to three RS485 serial ports and two RS232 serial ports. It is used to realize the function of serial port communication and has the ability to communicate with other third-party devices through serial ports.
[0034] The main chip MCU is connected to the real-time clock RTC with power-off timing function through pin multiplexing, so that the controller can meet some control logic after power-off reconnection.
[0035] The main chip MCU multiplexes the connection through the general GPIO pins to realize the optical coupler isolation input module, analog input module, and isolation relay output module for reading the sensor input signal and outputting the output voltage.
[0036] The main chip MCU is connected to the SDRAM external memory through pin multiplexing, and the main chip MCU and the SDRAM external memory communicate through the SFMC protocol, so that the running memory of the entire controller is expanded to 128K+512K. It meets the complex business logic requirements and has sufficient running memory support when equipped with real-time systems and network protocol stacks.
[0037] The main chip MCU is connected to a CAN bus through CAN communication pin multiplexing, which can meet the needs of CAN communication with other devices.
[0038] The main chip MCU uses I 2 C communication pin multiplexing connects to EEPROM module, and the main chip MCU connects to EEPROM module through I 2 C protocol to communicate with the EEPROM module. It can store fixed data without losing it when power is off.
[0039] The main chip MCU is connected to the JTAG download port for main chip MCU program writing and downloading through pin multiplexing.
[0040] like Figure 2As shown, the present application also includes a control system, which adopts an embedded micro-universal controller based on FreeRTOS, including a hardware driver layer, a firmware library layer and a business logic layer; the hardware driver layer includes an MCU operating environment program, a network communication module driver, a three-way RS485 serial port driver, a two-way RS232 serial port driver, a real-time clock RTC driver, an optocoupler isolation input module driver, an analog input module driver, an isolation relay output module driver, an SDRAM external memory driver, a CAN bus driver, and an EEPROM module driver; the firmware library layer encapsulates the firmware operations of the hardware driver layer; the business logic layer calls the firmware library layer according to the business scenario to perform business logic control; it is also equipped with an RMII lightweight network protocol stack, which can implement different network protocols, such as TCP / IP protocol, MQTT protocol, etc. At the same time, multi-task scheduling is implemented based on FreeRTOS to manage system resources and ensure the real-time and stability of each task. The FreeRTOS real-time system implements task control of different logical divisions and realizes multi-threading in the control logic.
[0041] In another specific embodiment, Figure 3 As shown in the figure, the optocoupler isolation input module is connected to the sensor of a certain type of lifting equipment to receive the detection signal of the equipment. The isolation relay output module is connected to the power signal receiving point of the equipment. The analog signal of the equipment is connected to the analog input module, and the serial port and CAN bus of the equipment are connected to the serial port and CAN bus of the controller respectively. The DC output is connected to some low-voltage devices of the equipment for power supply. The real-time clock RTC of the controller ensures that the equipment keeps time normally after power failure and restores the state before power failure of the equipment after power is restored. The network of the controller is connected to the upper system through the network cable to report the equipment status and receive the control instructions of the upper system. The main chip MCU of the controller detects the input signal, network data, serial port data, CAN bus data, and performs internal algorithm calculation and FreeRTOS task scheduling to accurately control the output signal point, thereby controlling the operation of the equipment and the execution of some mechanisms, so as to achieve the purpose of equipment control.
[0042] The upper system and lifting equipment are not part of the invention device and are displayed in a virtual frame to illustrate the function of the invention device. The lifting equipment is equipped with photoelectric switches, proximity switches and other detection switches as needed, and a motor provides a power system. Other motion mechanisms together constitute the function of the device. The motor and the motion mechanism start and stop according to the output signal of the controller of the present invention.
[0043] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. An embedded micro universal controller based on FreeRTOS, characterized in that: The invention comprises a main chip MCU, wherein the main chip MCU is connected with a power supply system, a network coupling switching module, three RS485 serial ports, two RS232 serial ports, a real-time clock RTC, an optical coupling isolation input module, an analog input module, an isolation relay output module, an SDRAM external memory, a CAN bus, ten DC outputs, an EEPROM module and a JTAG download port through pin multiplexing; the main chip MCU adopts a microcontroller with an M4 core; the network coupling switching module is connected with a PHY chip through the network switching pins of the main chip MCU, and the pins of the PHY chip are coupled with a switch chip by voltage-type signals and current-type signals, so that the network communication function of the main chip MCU is expanded from one PHY chip to four channels through the switch; the network coupling switching module uses an SPI communication protocol to communicate with a bus protocol stack chip.
2. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The power supply system adopts 24V power supply, and through capacitor filtering and common mode filtering of the power supply, it meets the electromagnetic compatibility requirements for internal and external interference.
3. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected to the serial port chip through multiplexing of the serial port pins, and further connected to three RS485 serial ports and two RS232 serial ports.
4. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected to a real-time clock RTC with a power-off timing function through pin multiplexing.
5. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is multiplexed through the general GPIO pin to connect the optical coupler isolation input module, the analog input module, and the isolation relay output module for realizing the functions of reading the sensor input signal and outputting the output voltage.
6. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected to the SDRAM external memory through pin multiplexing, and the main chip MCU communicates with the SDRAM external memory through the SFMC protocol.
7. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected to a CAN bus through CAN communication pin multiplexing.
8. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected via I 2 C communication pin multiplexing connects to EEPROM module, and the main chip MCU connects to EEPROM module through I 2 C protocol to communicate with the EEPROM module.
9. The FreeRTOS-based embedded micro-universal controller according to claim 1, characterized in that: The main chip MCU is connected to a JTAG download port for programming and downloading the main chip MCU through pin multiplexing.
10. A control system, characterized in that: An embedded micro-universal controller based on FreeRTOS as claimed in any one of claims 1 to 9 is adopted, comprising a hardware driver layer, a firmware library layer and a business logic layer; the hardware driver layer comprises an MCU operating environment program, a network communication module driver, a three-way RS485 serial port driver, a two-way RS232 serial port driver, a real-time clock RTC driver, an optocoupler isolation input module driver, an analog input module driver, an isolation relay output module driver, an SDRAM external memory driver, a CAN bus driver, and an EEPROM module driver; the firmware library layer encapsulates the firmware operations of the hardware driver layer; The business logic layer calls the firmware library layer to perform business logic control according to the business scenarios; it is also equipped with the RMII lightweight network protocol stack.