Modularized design method of control unit based on new-generation low-voltage high-performance internet-of-things switch
By designing a hot-swap management module based on RTOS in an embedded system, the module is safely plugged in and unplugged, which solves the problem of restarting in traditional systems, improves the stability and flexibility of the system, and is suitable for high-performance embedded systems. application.
Patent Information
- Application Number
- CN202411094352.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-09
AI Technical Summary
Traditional embedded systems need to restart the system when plugging and unplugging the module, resulting in reduced availability and data loss, and lack of an effective exception handling mechanism, resulting in system instability.
A modular design of a control unit based on a new generation of low-voltage and high-performance IoT switch is designed, using real-time operating system RTOS and hot-swap management modules, monitoring module insertion and removal events, loading and unloading module drivers, supporting HPLC, The hot plugging of peripherals such as Bluetooth, 485, 4G networking modules and screens can be used to enable the secure insertion and removal of modules through monitoring submodules, driver management submodules and communication submodules, and rollback operations are performed in abnormal situations.
It realizes the secure insertion and removal of modules without restarting the system, ensures system stability and reliability, improves the flexibility and reliability of the system, and makes up for the lack of peripheral hot plugging in embedded systems. It is applicable In high-performance embedded applications.
Smart Images

Figure CN118915583A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded systems, and in particular to a modular design of a control unit based on a new generation of low-voltage and high-performance Internet of Things switches. Background Art
[0002] With the development of embedded systems, modular design plays an important role in improving system flexibility and maintenance convenience. However, traditional embedded systems usually need to restart the system when plugging and unplugging modules, which not only affects the availability of the system, but may also cause data loss and system instability.
[0003] In the prior art, some systems implement hot swapping of modules by combining software and hardware, but these systems are usually targeted at specific hardware platforms and are not very versatile. In addition, the existing systems often lack effective exception handling mechanisms during module plugging and unplugging, which can easily lead to system crashes or data corruption.
[0004] For example, from the prior art CN200910190432-A CPCI hot-swap system, CN202310924387-Hot-swap method, PCIE device and management controller and other documents, it can be seen that in scenarios such as PC and Linux systems, the implementation of hot-swap is a mature solution, but for embedded systems, there is no reliable solution. Summary of the invention
[0005] Considering that currently, embedded systems based on the RT-Thread operating system are widely used in various industrial and consumer devices, it is of great significance to develop a system that supports the hot-swap function of modules. Therefore, in view of the defects and shortcomings of the prior art, the present invention proposes a modular design method for a control unit based on a new generation of low-voltage, high-performance IoT switches, mainly to achieve the safe insertion and removal of modules without restarting the system, thereby ensuring the stability and reliability of the system. By monitoring module insertion and removal events, loading and unloading module drivers, the hot-swap function of the module is realized, and peripherals such as HPLC, Bluetooth, 485, 4G networking modules and screens are supported, thereby improving the reliability and flexibility of the system, making up for the lack of hot-swap of peripherals in embedded systems, and being suitable for high-performance embedded applications.
[0006] The present invention specifically adopts the following technical solutions: A modular design approach for control units based on a new generation of low voltage, high performance IoT switches: Based on the real-time operating system RTOS, a hot-swap management module is set in the middleware layer to monitor and manage the insertion and removal events of the module; The hot-swap management module comprises: Monitoring submodule: used to monitor the insertion and removal events of modules in real time; Driver management submodule: used to load and unload module drivers to ensure that the module can be initialized correctly when inserted and release resources when unplugged; Communication submodule: used to provide a communication interface with the operating system and application layer to ensure the real-time transmission of plug-in and unplug events and status.
[0007] Further, when a new module is detected to be inserted, the monitoring submodule sends an insertion event notification, and the driver management submodule loads the corresponding driver and initializes the module; When it is detected that the module is unplugged, the monitoring submodule sends an unplugging event notification, and the driver management submodule uninstalls the driver and releases resources.
[0008] Furthermore, during the process of inserting or removing a module, if an abnormal situation occurs, a rollback operation is performed to ensure stable operation of the system.
[0009] Furthermore, during each hot-swap operation, log information is recorded, including at least the plug-in time, module type, plug-in status, whether it is successful, and an error code.
[0010] Furthermore, if the peripheral hardware supports hot-plugging, but the embedded system does not support it, implementing the hot-plugging function includes the following steps: Enable peripheral SDIO; Enable DFS virtual file system; Enable the fatfs file system and register the registered device to the DFS virtual file system in the form of elm fatfs; Then call dfs_mount at the application layer to mount the peripheral hardware.
[0011] Furthermore, for the case where the peripheral hardware supports hot-plugging, but the embedded system does not support it: Get the plug-in and unplug-out status of peripheral hardware through external interrupt or timer polling: When the peripheral hardware is plugged in: Read the configuration parameter value when the hot-swap driver is loaded, and after verifying the correctness, pre-apply to the system for the resources and memory space required by the peripheral hardware during hot-swap; through the monitoring submodule, seize the semaphore of the peripheral hardware and send an insertion event notification, load the peripheral hardware driver and initialize the file system, and write the information to the log system; When the peripheral hardware is unplugged: detect the pin signal, release the semaphore of the peripheral hardware, the monitoring submodule sends a pull-out event notification, closes the peripheral hardware thread, uninstalls the driver, and writes the information into the log system.
[0012] Furthermore, for the case where the peripheral hardware does not support hot-plugging: Determine the device's plug-in and unplug-out status based on the peripheral hardware's own communication characteristics or protocols; By maintaining a thread for peripheral hardware detection, the thread periodically sends AT commands to the corresponding peripheral hardware. When the peripheral hardware does not respond, it is determined that the module has been unplugged or damaged. At this time, the monitoring submodule sends a module unplug event, closes the corresponding running thread, uninstalls the driver, and writes the information into the log system; when the module responds again, it is determined that the module has been reconnected or replaced. At this time, the monitoring submodule sends a module insertion event, creates a running thread corresponding to the peripheral hardware, reloads the module driver, and writes the information into the log system.
[0013] Furthermore, full hot swap and high reliability hot swap are supported; The implementation of full hot swap is to use the level judgment of the peripheral hardware pin as a switch. When the peripheral hardware is inserted or unplugged, before the peripheral hardware starts or stops working, the switch first changes state and generates a system enumeration signal to notify the operating system that a device module is to be inserted or unplugged. The operating system then performs bus enumeration to install or uninstall the device driver. The high reliability hot swap is based on full hot swap, and monitors whether each device module is operating normally in real time to isolate abnormal device modules and start alternative standby device modules.
[0014] And, a control unit based on a new generation of low-voltage, high-performance IoT switches, adopts the above modular design method, including a hardware layer, an operating system layer, a middleware layer and an application layer; wherein the hardware layer adopts a multi-core chip including a RISC-V core; the operating system adopts an RT-Thread operating system; the application layer interacts with the hot-swap management module through an API interface.
[0015] Furthermore, module management including: HPLC module, Bluetooth module, 485 communication module, mobile communication module and screen peripherals is achieved through hot plugging.
[0016] The present invention and its preferred solution realize the hot-swap function of the module by monitoring the module insertion and removal events, loading and unloading the module driver, and supporting peripherals such as HPLC, Bluetooth, 485, 4G networking modules and screens, thereby improving the reliability and flexibility of the system, making up for the lack of hot-swap of peripherals in embedded systems, and being suitable for high-performance embedded applications, especially for the control unit of a new generation of low-voltage and high-performance IoT switches. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments: Figure 1 Schematic diagram of the system architecture of an embodiment of the present invention.
[0018] Figure 2 Schematic diagram of a hot-swap management module according to an embodiment of the present invention.
[0019] Figure 3 This is a schematic diagram of the processing flow of module insertion according to an embodiment of the present invention.
[0020] Figure 4 The figure is a schematic diagram of the processing flow of module removal according to an embodiment of the present invention.
[0021] Figure 5 The figure is a schematic diagram of an exception handling process according to an embodiment of the present invention.
[0022] Figure 6 This is a diagram of the error log record structure of an embodiment of the present invention.
[0023] Figure 7 The figure is a schematic diagram of the entire process of the hot-swap management module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Hereinafter, the specific embodiments of the present application will be described in detail with reference to the accompanying drawings. According to these detailed descriptions, those skilled in the art can clearly understand the present application and can implement the present application. Without violating the principles of the present application, the features in the various embodiments can be combined to obtain new implementations, or certain features in certain embodiments can be replaced to obtain other preferred implementations.
[0025] In order to make the features and advantages of this patent more obvious and easy to understand, the following embodiments are specifically described in detail with the accompanying drawings as follows: like Figure 1 As shown, the control unit system of a low-voltage, high-performance IoT switch with modular design based on hot-swap technology provided by an embodiment of the present invention includes: a hardware layer, an operating system layer, a middleware layer, and an application layer. The hardware layer includes a multi-core chip, preferably a multi-core chip including a RISC-V core, the operating system layer is an RT-Thread operating system, the middleware layer includes a hot-swap management module, and the application layer is a user application.
[0026] The system architecture is: Hardware layer: multi-core chip with high main frequency, suitable for high-performance applications.
[0027] Operating system layer: RT-Thread operating system, providing real-time, multi-task scheduling, device driver and other functions.
[0028] Middleware layer: hot-swap management module, responsible for monitoring and managing module insertion and removal events.
[0029] Application layer: User application program that interacts with the hot-swap management module through the API interface.
[0030] like Figure 2 As shown in the figure, the hot-swap management module includes a monitoring submodule, a driver management submodule, and a communication submodule. The monitoring submodule is used to monitor the insertion and removal events of the module in real time and notify other parts of the system in time; the driver management submodule is responsible for loading and unloading the module driver to ensure that the module can be initialized correctly when inserted and release resources when unplugged; the communication submodule provides a communication interface with the operating system and application layer to ensure the real-time transmission of the plug-in and removal events and status.
[0031] like Figure 3 As shown, when a new module is detected to be inserted, the monitoring submodule sends an insertion event notification, and the driver management submodule loads the corresponding driver and initializes the module.
[0032] like Figure 4 As shown, when it is detected that the module is unplugged, the monitoring submodule sends an unplug event notification, and the driver management submodule uninstalls the driver and releases resources.
[0033] like Figure 5 As shown in the figure, during the process of inserting or removing the module, if an abnormal situation occurs, the system will automatically perform a rollback operation to ensure stable operation of the system.
[0034] like Figure 6 As shown, an error log recording module is also provided to record detailed log information during each hot swap operation, including the swap time, module type, swap status, success, error code, etc.
[0035] Log storage and query: The logging module stores log information in non-volatile memory and supports query and analysis through API interfaces.
[0036] The system designed above can at least support the hot-swap function of HPLC (carrier communication) module, Bluetooth module, 485 communication module, 4G networking module and screen peripherals.
[0037] in: a)HPLC (Carrier Communication) module: used for power line carrier communication, supports hot swapping without interrupting power line communication.
[0038] b) Bluetooth module: used for short-range wireless communication and supports hot-swapping without interrupting the existing Bluetooth connection.
[0039] c) 485 communication module: used for RS-485 bus communication in industrial control, supports hot swapping without interrupting 485 bus communication.
[0040] d) 4G networking module: used for cellular network communication, supports hot swapping without interrupting the 4G network connection.
[0041] e) Screen peripherals: used for display output, supports hot plugging without interrupting display output.
[0042] The specific hot-swap management function is designed as follows: a)HPLC (Carrier Communication) Module: i. In RT-Thread, the driver of the HPLC module is designed to be dynamically loaded and unloaded.
[0043] ii. When the HPLC module is inserted, the monitoring submodule detects the insertion event and notifies the drive management submodule.
[0044] iii. The driver management submodule calls the dynamic driver loading interface provided by RT-Thread to load the HPLC module driver into the system and initialize the communication parameters.
[0045] iv. When unplugged, the driver management submodule calls the dynamic driver unloading interface to unload the HPLC module driver and release resources.
[0046] b) Bluetooth module: i. The driver of the Bluetooth module is also designed to be dynamically loaded and unloaded in RT-Thread.
[0047] ii. The insertion event is detected by the monitoring submodule and notifies the driver management submodule, which loads the Bluetooth module driver and initializes the Bluetooth stack.
[0048] iii. When the device is unplugged, the driver management submodule uninstalls the Bluetooth driver and ensures that the current Bluetooth connection is disconnected normally to prevent data loss.
[0049] c) 485 communication module: i.485 module drivers can be dynamically loaded and unloaded in RT-Thread.
[0050] ii. When inserted, the monitoring submodule notifies the driver management submodule, which loads the 485 driver and configures the bus parameters.
[0051] iii. When unplugged, the driver management submodule unloads the 485 driver and releases related resources to ensure stable bus communication.
[0052] d)4G networking module: i.4G module driver supports dynamic loading and unloading.
[0053] ii. When inserted, the monitoring submodule notifies the driver management submodule to load the 4G driver and initialize the network connection.
[0054] iii. When unplugged, the driver management submodule uninstalls the 4G driver to ensure that the network connection is safely disconnected.
[0055] e) Screen peripherals: i. Screen peripheral driver supports dynamic loading and unloading.
[0056] ii. When inserted, the monitoring submodule notifies the driver management submodule to load the screen driver and initialize the display parameters.
[0057] iii. When unplugged, the driver management submodule uninstalls the screen driver and releases the display buffer resources In many systems, some peripherals have been widely supported in operating systems such as Linux, but have not yet been supported in embedded systems, especially real-time operating systems (RTOS). The following are some common peripherals that support hot-plugging, and the types of devices that are supported in Linux but not fully supported in RTOS: like Figure 7 As shown, based on different modules, the hot-swap management module of this embodiment provides the following two preferred embodiments of hot-swap modes: Category 1: Peripheral hardware supports hot-swapping, but the embedded system does not support it, such as SD cards, USB devices, PCIe devices, SATA devices, network devices, etc. Take SD cards as an example. In RTOS, using SD cards requires the following steps: 1. Enable peripheral SDIO, 2. Enable the DFS virtual file system 3 Enable the fatfs file system and register the registered sd0 block device to the DFS virtual file system in the form of elm fatfs 4. At this time, call dfs_mount in the application layer to mount sd0, so that the SD card and file system can be used.
[0058] Consider that if you pull out the card while the system is running, it will cause system failure and other problems.
[0059] Because there is a hardware pin pin_check on the SD card hardware (high level when inserted and low level when removed), modify the driver layer code of the device SD card and add signal judgment on the SD card pin_check pin to obtain the insertion and removal status of the SD card.
[0060] When the SD card is inserted: Read the user's configuration parameter values when the hot-swap driver is loaded, verify the correctness of these configuration parameters, pre-apply to the system for the resources and memory space required by the functional board device during hot-swap, monitor the module, seize the semaphore of the SD card, the monitoring submodule sends an insertion event notification, loads the SD card driver and initializes the file system, and writes the information to the log system. When unplugging, detect the pin signal, release the semaphore of the SD card, the monitoring submodule sends an unplug event notification, closes the SD card thread, uninstalls the SD card driver, and writes the information to the log system.
[0061] Category 2: Peripheral hardware does not support hot-swappable communication modules, such as 4G modules, carrier modules, etc. Use the device's own communication characteristics or protocols to determine whether the device is plugged in or unplugged. For example, for a UART device (4G module\carrier module, etc.), you can determine whether the device exists by detecting whether it responds to communication.
[0062] By maintaining a communication module detection thread, the thread periodically sends AT commands to the communication module (4G module). When the module does not respond, it is determined that the module has been unplugged or damaged. At this time, the monitoring submodule sends a module unplug event, closes the running thread of the 4G module, uninstalls the 4G module driver, and writes the information to the log system. When the module responds again, it is determined that the module has been reconnected or replaced. At this time, the monitoring submodule sends a module insertion event, creates a running thread for the 4G module, reloads the 4G module driver, and writes the information to the log system.
[0063] Based on the above design, the embodiment of the present invention can support full hot plugging and high-reliability hot plugging.
[0064] Among them, full hot plugging is based on basic hot plugging, adding a virtual micro switch (for example, by judging the level of the pin as a switch) in the device's insertion / removal mechanism. When the device is inserted or removed, before the device starts or stops working, the micro switch first changes its state and generates a system enumeration (#ENUM) signal, which notifies the operating system that a device is about to be inserted or removed, and the operating system then performs bus enumeration, installs device drivers, or uninstalls device drivers.
[0065] High-reliability hot-swap is built on the basis of full hot-swap, which can monitor whether the equipment can operate normally. The system can automatically isolate a bad device, start a replacement device, and then continue to work).
[0066] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0067] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0068] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0070] The above is a preferred embodiment of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
[0071] This patent is not limited to the above-mentioned optimal implementation mode. Anyone can derive other forms of modular design methods for control units based on a new generation of low-voltage, high-performance IoT switches under the inspiration of this patent. All equal changes and modifications made according to the scope of the patent application of the present invention should be covered by this patent.
Claims
1. A modular design method for a control unit based on a new generation of low-voltage, high-performance IoT switches, characterized in that: Based on the real-time operating system RTOS, a hot-swap management module is set in the middleware layer to monitor and manage the insertion and removal events of the module; The hot-swap management module comprises: Monitoring submodule: used to monitor the insertion and removal events of modules in real time; Driver management submodule: used to load and unload module drivers to ensure that the module can be initialized correctly when inserted and release resources when unplugged; Communication submodule: used to provide a communication interface with the operating system and application layer to ensure the real-time transmission of plug-in and unplug events and status.
2. According to claim 1, a modular design method for a control unit based on a new generation of low-voltage and high-performance IoT switches is characterized in that: When a new module is detected to be inserted, the monitoring submodule sends an insertion event notification, and the driver management submodule loads the corresponding driver and initializes the module; When it is detected that the module is unplugged, the monitoring submodule sends an unplugging event notification, and the driver management submodule uninstalls the driver and releases resources.
3. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 2 is characterized in that: During the process of inserting or removing a module, if an abnormal situation occurs, a rollback operation is performed to ensure stable operation of the system.
4. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 1 is characterized in that: During each hot swap operation, log information is recorded, including at least the swap time, module type, swap status, success or failure, and error code.
5. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 1 is characterized in that: If the peripheral hardware supports hot-plugging, but the embedded system does not, implementing the hot-plugging function includes the following steps: Enable peripheral SDIO; Enable DFS virtual file system; Enable the fatfs file system and register the registered device to the DFS virtual file system in the form of elm fatfs; Then call dfs_mount at the application layer to mount the peripheral hardware.
6. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 1 is characterized in that: For the case where the peripheral hardware supports hot-plugging, but the embedded system does not support it: Get the plug-in and unplug-out status of peripheral hardware through external interrupt or timer polling: When the peripheral hardware is plugged in: Read the configuration parameter value when the hot-swap driver is loaded, and after verifying the correctness, pre-apply to the system for the resources and memory space required by the peripheral hardware during hot-swap; through the monitoring submodule, seize the semaphore of the peripheral hardware and send an insertion event notification, load the peripheral hardware driver and initialize the file system, and write the information to the log system; When the peripheral hardware is unplugged: detect the pin signal, release the semaphore of the peripheral hardware, the monitoring submodule sends a pull-out event notification, closes the peripheral hardware thread, uninstalls the driver, and writes the information into the log system.
7. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 1 is characterized in that: If the peripheral hardware does not support hot-plugging: Determine the device's plug-in and unplug-out status based on the peripheral hardware's own communication characteristics or protocols; By maintaining a thread for peripheral hardware detection, the thread periodically sends AT commands to the corresponding peripheral hardware. When the peripheral hardware does not respond, it is determined that the module has been unplugged or damaged. At this time, the monitoring submodule sends a module unplug event, closes the corresponding running thread, uninstalls the driver, and writes the information into the log system; when the module responds again, it is determined that the module has been reconnected or replaced. At this time, the monitoring submodule sends a module insertion event, creates a running thread corresponding to the peripheral hardware, reloads the module driver, and writes the information into the log system.
8. The modular design method of a control unit based on a new generation of low-voltage and high-performance IoT switch according to claim 1 is characterized in that: Supports full hot-swap and high-reliability hot-swap; The implementation of full hot swap is to use the level judgment of the peripheral hardware pin as a switch. When the peripheral hardware is inserted or unplugged, before the peripheral hardware starts or stops working, the switch first changes state and generates a system enumeration signal to notify the operating system that a device module is to be inserted or unplugged. The operating system then performs bus enumeration to install or uninstall the device driver. The high reliability hot swap is based on full hot swap, and monitors whether each device module is operating normally in real time to isolate abnormal device modules and start alternative standby device modules.
9. A control unit based on a new generation of low-voltage, high-performance IoT switch, characterized in that: A modular design method according to any one of claims 1 to 8 is adopted, comprising a hardware layer, an operating system layer, a middleware layer and an application layer; wherein the hardware layer adopts a multi-core chip including a RISC-V core; the operating system adopts an RT-Thread operating system; and the application layer interacts with a hot-swap management module through an API interface.
10. The control unit based on a new generation low voltage and high performance IoT switch according to claim 9 is characterized in that: Module management including HPLC module, Bluetooth module, 485 communication module, mobile communication module and screen peripherals is achieved through hot plugging.
Citation Information
Patent Citations
Hot plug method, PCIE device and management controller
CN117194299A
CPCI (compact peripheral component interconnection) hot swapping system
CN102023940A
Driver-adaptive loading system
CN107315607A
SIM (Subscriber Identity Module) card hot plug dynamic detection method and communication terminal
CN117014820A
Solid state disk hot plug management system and method
CN117591458A
