Multi-state recognition and automatic mode switching system based on state recognition module

By designing a multi-state recognition and automatic mode switching system based on the state recognition module in the electronic whiteboard all-in-one machine, the problem of system instability caused by relying on manual operation in the existing technology is solved, and automatic recognition and switching of the USB OTG mode are realized, which improves the efficiency of the system. The degree of system intelligence.

CN119335927APending Publication Date: 2025-01-21GUANGZHOU LANGO ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411439019.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the prior art, electronic whiteboard all-in-one machines need to automatically switch USB OTG mode in different application scenarios, but relying on manual operations can easily lead to operational errors and system instability.

Method used

Design a multi -state recognition and automatic mode switching system based on state recognition modules, including system state initialization and monitoring unit, mode automatic switching logic unit, and compatible optimization units. Automatically recognize the system status through the state recognition module and switch the USB OTG mode.

Benefits of technology

The automatic switching of system state automatic recognition and the USB OTG mode has been realized, which improves the degree of intelligence of the system and avoids errors and instability caused by manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119335927A_ABST
    Figure CN119335927A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-state recognition and automatic mode switching system based on a state recognition module, and belongs to the technical field of automatic control. The system comprises a system state initialization and monitoring unit, a mode automatic switching logic unit and a compatibility optimization unit, when the system is started, the system state initialization and monitoring unit reads a state register of the system by calling an initialization function of a state identification module to obtain an operation state, and sets parameters of the state identification module; the mode automatic switching logic unit is used for acquiring update state information and triggering a detection mechanism of the USB OTG mode management module according to the update state information; the compatibility optimization unit is used for periodically calling the compatibility optimization module, the compatibility optimization module is used for detecting the matching between the current system operation state and the USB OTG mode to obtain a matching degree result, and the system conducts self-adaptive adjustment according to the matching degree result. The current state of the system is automatically identified, and the intelligent degree of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of automatic control, and in particular relates to a multi-state recognition and automatic mode switching system based on a state recognition module. Background Art

[0002] In the design of electronic whiteboard all-in-one machines, due to the different operational requirements of different application scenarios (such as EDLA testing, system burning, ordinary data transmission, etc.), the system is required to be able to automatically switch the USB OTG mode according to the current operating state to ensure the stability and compatibility of the system. In the prior art, many systems rely on manual operation for mode switching, which is prone to operational errors and system instability. When babble is detected or VBUS is lower than the valid level of the session, the USB OTG controller automatically terminates the session. If the device is connected to a high-current device, it may not be able to maintain host mode because some devices may temporarily reduce the VBUS voltage, causing the controller to exit host mode. In addition, when the device is told that it can start using its active configuration, the USB OTG controller may not be able to maintain host mode because the device may consume more current and reduce the VBUS voltage. If you want to dynamically switch the operating mode based on the queried device status or capabilities, the software driver must switch between the two operating modes cleanly. Some basic requirements for switching modes include: A soft reset must be issued before changing the mode. Summary of the invention

[0003] In order to solve the above problems existing in the prior art, the present invention provides a multi-state recognition and automatic mode switching system based on a state recognition module.

[0004] The purpose of the present invention can be achieved by the following technical solutions:

[0005] A multi-state recognition and automatic mode switching system based on a state recognition module, comprising: a system state initialization and monitoring unit, a mode automatic switching logic unit, and a compatibility optimization unit;

[0006] The system status initialization and monitoring unit is used to read the system status register to obtain the operating status by calling the initialization function of the status identification module when the system is started, and set the parameters of the status identification module according to the operating status;

[0007] The mode automatic switching logic unit is used to obtain the update status information of the state recognition module in the system state initialization and monitoring unit, and if the update status information is captured, the detection mechanism of the USB OTG mode management module is triggered;

[0008] The compatibility optimization unit is used to periodically call the compatibility optimization module, and detect the matching between the current system operation state and the USB OTG mode through the compatibility optimization module to obtain a matching result; if the matching result is mismatch, the system performs adaptive adjustment.

[0009] Specifically, the initialization function reading method is to obtain flag information by reading the flag of the status register, and the flag information includes EDLA mode, normal mode, and burning mode.

[0010] Specifically, the parameters of the state recognition module include a state recognition threshold and a state switching rule; the state recognition threshold is used to distinguish different operation modes, and the state switching rule is used to determine the switching conditions of the USB OTG mode under different states. The state switching judgment formula is:

[0011] M new =f(S current ),

[0012] Where: M new Indicates the switched USB OTG mode; S current represents the current system operating state; f represents the judgment function, which is used to determine the mode after switching according to the current operating state.

[0013] Specifically, the state identification module monitors the system state register at fixed time intervals during system operation, analyzes the flag information in the register, and determines the current system operation state according to a preset state machine model and conditional trigger mechanism, and updates the system state information.

[0014] Specifically, the detection mechanism of the USB OTG mode management module is: if the update status information shows that the system is in a specific operating state under the EDLA test mode, it switches to the host mode; if the update status information shows that the system is in an operating state under bin file burning, it switches to the slave mode.

[0015] Specifically, the switching method is: when the system detects the EDLA test mode, the host mode initialization function is called to set the USB OTG mode to the host mode, so that the system can actively control the connected external device through the USB interface; when the system detects the bin file burning mode, the slave mode initialization function is called to set the USB OTG mode to the slave mode, so that the system can receive data transmitted by the external device.

[0016] Specifically, the adaptive adjustment method is: the system will re-call the state recognition module to correct the error state.

[0017] Specifically, the compatibility optimization unit performs stability detection at the time node after the system completes mode switching. The stability detection is used to ensure that the system works normally after the mode switching. If the stability detection result is unstable, the system enters the exception handling process. The compatibility detection formula is:

[0018] C=δ(M current ,S current ),

[0019] Where C represents the compatibility test result; M current Indicates the current USB OTG mode; δ indicates the matching function between the mode and the state. When the mode and the state match, the return value is 1, otherwise it is 0.

[0020] Specifically, the exception handling process includes re-switching modes and prompting users.

[0021] Specifically, the switching method determines whether the current system operation state meets the switching condition through an if-else structure.

[0022] Specifically, the compatibility optimization module determines whether mode correction is required by comparing the current system operation state with the USB OTG mode.

[0023] Specifically, the update status information displays the current operation status and USB OTG mode in real time through the system interface, and the user can view the working status of the system through the interface.

[0024] Specifically, the stability detection result includes mode switching failure and data transmission error; the user can manually select the USB OTG mode through the interface, and the system will update the configuration of the status identification module.

[0025] The beneficial effects of the present invention are:

[0026] A solution for realizing multi-state recognition and automatic mode switching based on a state recognition module can automatically recognize the current state of the system and automatically switch the USB OTG mode based on the recognition result, thereby improving the intelligence of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.

[0028] Figure 1 The present invention is a flowchart of a multi-state recognition and automatic mode switching system based on a state recognition module. DETAILED DESCRIPTION

[0029] The example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein: on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. In addition, the described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure. The blocks shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices. The flowcharts shown in the accompanying drawings are only exemplary illustrations and do not necessarily include all the content and operations / steps, nor do they necessarily have to be executed in the order described. For example, some operations / steps may be decomposed, while some operations / steps may be combined or partially combined, so the actual execution order may change according to actual circumstances.

[0030] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.

[0031] See also Figure 1 , a multi-state recognition and automatic mode switching system based on state recognition module:

[0032] A multi-state recognition and automatic mode switching system based on a state recognition module, comprising: a system state initialization and monitoring unit, a mode automatic switching logic unit, and a compatibility optimization unit;

[0033] The system status initialization and monitoring unit is used to read the system status register to obtain the operating status by calling the initialization function of the status identification module when the system is started, and set the parameters of the status identification module according to the operating status;

[0034] The mode automatic switching logic unit is used to obtain the update status information of the state recognition module in the system state initialization and monitoring unit, and if the update status information is captured, the detection mechanism of the USB OTG mode management module is triggered;

[0035] The compatibility optimization unit is used to periodically call the compatibility optimization module, and detect the matching between the current system operation state and the USB OTG mode through the compatibility optimization module to obtain a matching result; if the matching result is mismatch, the system performs adaptive adjustment.

[0036] In this embodiment, the USB OTG standard is fully compatible with the USB2.0 standard and adds a power management (power saving) function, which allows the device to operate as both a host and a peripheral (dual-use OTG). USB OTG technology can realize data transmission between devices when there is no host. There are 5 lines in the USB OTG interface: 2 are used to transmit data (D+, D-); 1 is the power line (VBUS); 1 is the ground line (GND), and 1 is the ID line. The ID line is used to identify different cable endpoints. The ID pin in the mini-A plug (i.e., A peripheral) is grounded, and the ID pin in the mini-B plug (i.e., B peripheral) is floating. When the OTG device detects the grounded ID pin, it means that the default is the A device (host), and the device that detects the floating ID pin is considered to be the B device (peripheral). The USB_ID signal is only meaningful for devices that support USB OTG (i.e., devices that can be USB Hosts and Slaves). When the device detects that the USB_ID signal is low, it means that the device should be used as a Host (host, also called A device). When the device detects that the USB_ID signal is high, it means that the device is used as a Slave (peripheral, also known as B device). In the actual USB cable, there is no USB_ID line, which is directly blocked and closed at the interface. For the Host end, just short-circuit the USB_ID pin of the cable and the ground. For the Slave end, the USB_IDpin of the USB cable is suspended. (Pull-up inside the device).

[0037] Specifically, the initialization function reading method is to obtain flag information by reading the flag of the status register, and the flag information includes EDLA mode, normal mode, and burning mode.

[0038] In this embodiment, the EDLA mode is related to the Google Mobile Services (GMS) certification. EDLA (Enhanced Device Level Authentication) is a protocol for verifying whether a device complies with the Google Mobile Services certification standards. Devices that pass the EDLA certification can ensure that they meet Google's requirements at the hardware and software levels, thereby obtaining support for Google Mobile Services. Normal mode is usually used for general programming and burning tasks. For example, in the P800 Flash programmer, the normal mode does not have high requirements for the SD card, but its burning speed is slow. This mode is suitable for application scenarios that do not require high-speed burning, such as some low-frequency firmware updates or simple data writing operations. The burning mode is mainly used to write firmware or programs into the memory of the target device. Depending on the device and programmer, the burning mode may have different variants. In some programmers, the burning mode is divided into high-speed mode and normal mode. The high-speed mode requires the use of a high-speed SD card provided by the original manufacturer to achieve fast burning; while the normal mode does not have high requirements for the SD card, but the burning speed is slow. In other devices, the burning mode includes Loader mode and MaskRom mode. Loader mode is usually used to load firmware, while MaskRom mode is used to burn firmware when Loader mode cannot be entered. An important feature of the burning mode is that it can be executed outside the programming environment, that is, after the burning is completed, the program can run independently without being connected to a computer or mobile phone. In summary, EDLA mode is mainly used for device authentication, normal mode is suitable for general programming and burning tasks, and burning mode focuses on writing firmware or programs into the memory of the target device, and there may be multiple variants to suit different needs.

[0039] Specifically, the parameters of the state recognition module include a state recognition threshold and a state switching rule; the state recognition threshold is used to distinguish different operation modes, and the state switching rule is used to determine the switching conditions of the USB OTG mode under different states. The state switching judgment formula is:

[0040] M new =f(S current ),

[0041] Where: M new Indicates the switched USB OTG mode; S current represents the current system operating state; f represents the judgment function, which is used to determine the mode after switching according to the current operating state.

[0042] In this embodiment, the state recognition threshold is used to distinguish different operation modes. For example, in the USB OTG module, the state of the ID pin (ID bit) can be used to distinguish between the A device and the B device. When the ID signal is pulled low, the insertion of the A device is detected; when the ID signal is high, the insertion of the B device is detected. The state switching rule is used to determine the switching conditions of the USB OTG mode in different states. For example, in HNP (Host Negotiation Protocol), the OTG_FS module can dynamically switch roles according to the host negotiation protocol, such as switching from the A host to the A slave, or from the B slave to the B host. In addition, when the B device finishes using the bus, the application pauses by writing the port suspend bit in the host port control and status register, thereby triggering a state switch. The USB OTG module includes multiple interrupt registers and status registers for recording and processing interrupt events. For example, the OtgXcvrINT interrupt is used to indicate the state change of the operating condition of the external OTG transceiver. In addition, the connector ID status bit (CIDSTS bit) in the OTG control and status register and the global interrupt RM0090 are used to indicate the operating mode of the OTG module. The SOF threshold register is used to program the number of bytes at which the USB controller stops initiating token packet transmission. This register must be set to a value that ensures that other packets are not transmitted before the SOF counter counts down to zero. The control register of the USB OTG module contains multiple bits to indicate the status and activity of the USB OTG. For example, the ID bit indicates the status of the ID pin, and the line state stability bit indicates whether the USB line state is stable in the previous 1 millisecond.

[0043] Specifically, the state identification module monitors the system state register at fixed time intervals during system operation, analyzes the flag information in the register, and determines the current system operation state according to a preset state machine model and conditional trigger mechanism, and updates the system state information.

[0044] In this embodiment, the system status register is monitored: the state recognition module monitors the system status register at a predetermined time interval (such as every 100ms). These registers are usually used to store the system's operating status information, such as the CPU's operating status, memory usage, and the device's working status. Parsing flag information: After monitoring the system status register, the state recognition module will parse the flag information in the register. These flags usually indicate the current state of the system or the occurrence of a specific event, such as whether an error has occurred, whether a certain operation is being performed, etc. Applying a preset state machine model: Based on the parsed flag information, the state recognition module will apply a preset state machine model to determine the current system operating state. The state machine model usually includes four elements: current state, condition, action, and next state. The current state refers to the current state of the system, the condition is the condition that triggers the state transition, the action is the operation performed after the condition is met, and the next state is the new state after the state transition. Trigger condition judgment: In the state machine model, the condition is the key to triggering the state transition. The state recognition module will determine whether the condition is met based on the preset condition trigger mechanism. For example, if a flag indicates that the system is performing a certain operation, then when the flag is set, the system will enter the corresponding operation state. Update system status information: Once the current system operation state is determined, the state recognition module will update the system status information. This information may include the current state of the system, possible error information, and suggestions for the next operation. Feedback and monitoring: The updated system status information will be fed back to other parts of the system so that they can make corresponding adjustments or operations based on the new status information. At the same time, the state recognition module will continue to monitor the system status register to ensure the stable operation of the system.

[0045] Specifically, the detection mechanism of the USB OTG mode management module is: if the update status information shows that the system is in a specific operating state under the EDLA test mode, it switches to the host mode; if the update status information shows that the system is in an operating state under bin file burning, it switches to the slave mode.

[0046] In this embodiment, the initial functions of the host and slave devices are implemented by defining connectors. OTG defines a miniature jack called MiniAB, which can be directly connected to the MiniA or MiniB socket. MiniAB has an ID pin pulled up to the power supply terminal, the MiniA plug has an ID connected to the ground (R<10Ω), and the Mini B plug has an open ID pin connected to the ground (R>100kΩ). When two OTG devices are connected together, the ID pin on the MiniA plug side will be injected with a "0" state, and the ID pin on the MiniB plug side is "1". The OTG device with ID 0 defaults to the host (A device), and the OTG device with ID 1 defaults to the slave (B device).

[0047] Specifically, the switching method is: when the system detects the EDLA test mode, the host mode initialization function is called to set the USB OTG mode to the host mode, so that the system can actively control the connected external device through the USB interface; when the system detects the bin file burning mode, the slave mode initialization function is called to set the USB OTG mode to the slave mode, so that the system can receive data transmitted by the external device.

[0048] In this embodiment, the host mode is initialized in the EDLA test mode: when the system detects the EDLA test mode, the USB OTG mode needs to be set to the host mode. In the host mode, the system, as the master of the USB bus, is responsible for enumerating the connected devices, initiating transmission, allocating bus bandwidth and powering the USB devices directly connected to the bus. The initialization step includes programming the HPRTINT in the OTG_FS_GINTMSK register to cancel the shield, programming the OTG_FS_HCFG register to select the full-speed host, programming the PPWR bit in the OTG_FS_HPRT to 1 to provide VBUS, and waiting for the PCDET interrupt in the OTG_FS_HPRT0 to detect the device connection. Initialization of the slave mode in the bin file burning mode: when the system detects the bin file burning mode, the USB OTG mode needs to be set to the slave mode. In the slave mode, the system, as a slave device of the USB bus, is responsible for receiving data transmitted by the external device. The initialization step includes programming the device speed and other fields in the OTG_FS_DCFG register after the power is turned on or switched from the host mode to the device mode. In this embodiment, taking Android as an example, adding USB otg mode switching to host mode in Android11.0 system mainly involves modifying the / sys / devices / platform / fe8a0000.usb2-phy / otg_mode file on the device. After otg switches to host, adb cannot connect. You can use adb network connection debugging. After restarting, it will return to the default mode. Add a switching method in the custom service and add a custom property. The path is / device / rockchip / rk356x / rk356x.prop; add method definitions in ITestManager and TestManager, and add methods in TestManagerService; add corresponding methods in the encapsulated jar for third-party application developers to call; compile mmm vendor / yjz / to generate yjz-sdk-api.jar, import yjz-sdk-api.jar during application development, and call methods.

[0049] Specifically, the adaptive adjustment method is: the system will re-call the state recognition module to correct the error state.

[0050] In this embodiment, in USB OTG (On-The-Go) mode, the system needs to detect the compatibility of the current operating state with the OTG mode. According to USB OTG, there are two modes: ID line detection and HNP dual-role device. The system determines the current device state by reading the Connector ID Status bit and CMOD bit in the Global OTG control and status register and the current mode operation bit in the OTG_FS_GOTGCTL register. If a mismatch is detected, the system will re-call the state identification module to correct the error state. The code checks whether the device supports the USB OTG function and ensures that it is in the started state and there is no sequence in progress. If any parameter is invalid or does not meet the requirements, the corresponding error code will be returned. This indicates that when the system detects a mismatch, it will correct the error state by re-calling the state identification module; in negotiation mode, the OTG_FS core will detect suspension, disconnection and switch back to the host role. When the B device is connected, the HNP process is completed. This indicates that when the system detects a mismatch, it will correct the error state by re-calling the state identification module. When the system detects that the current operating state does not match the USB OTG mode, it will correct the error state by re-calling the state recognition module to ensure the normal operation of the system.

[0051] Specifically, the compatibility optimization unit performs stability detection at the time node after the system completes mode switching. The stability detection is used to ensure that the system works normally after the mode switching. If the stability detection result is unstable, the system enters the exception handling process. The compatibility detection formula is:

[0052] C=δ(M current ,S current ),

[0053] Where C represents the compatibility test result; M current Indicates the current USB OTG mode; δ indicates the matching function between the mode and the state. When the mode and the state match, the return value is 1, otherwise it is 0.

[0054] Specifically, the exception handling process includes re-switching modes and prompting users.

[0055] Specifically, the switching method determines whether the current system operation state meets the switching condition through an if-else structure.

[0056] Specifically, the compatibility optimization module determines whether mode correction is required by comparing the current system operation state with the USB OTG mode.

[0057] Specifically, the update status information displays the current operation status and USB OTG mode in real time through the system interface, and the user can view the working status of the system through the interface.

[0058] In this embodiment, a configuration diagram (HMI) is used to display and control the user interface of a machine device or system. The configuration diagram usually displays the status and information of the device or system in a graphical manner on a computer monitor, and provides the function of operation control. In addition, the monitoring module in the device management system can also display the operating status, fault alarm and maintenance records of the device in real time. These systems can use real-time data to insert into the database and update the panel data, thereby realizing the monitoring of system information. Using tools such as glances, various performance indicators of the system are displayed in real time, so that users can understand the operating status of the system in real time. For the display of USB OTG mode, it can be achieved by installing and opening the OTG assistant APP, connecting the U disk or storage hard disk through the OTG data cable, and clicking Mount to use the OTG function. This method can ensure that the user can view the status of the USB OTG mode through the system interface. By combining the configuration diagram, the device management system and the real-time monitoring tool, the user can view the working status and USB OTG mode of the system in real time.

[0059] Specifically, the stability detection result includes mode switching failure and data transmission error; the user can manually select the USB OTG mode through the interface, and the system will update the configuration of the status identification module.

[0060] In this embodiment, the OTG mode is modified through the device's settings menu. On an Android device, the user can enter the settings application and find the "About Phone" or "About Device" option, and then click the version number / build number seven times in succession to enable the developer options, thereby adding a USB mode switch in the settings. In addition, for the support of the OTG function, the Device / Host mode needs to be switched according to the USB ID pin, and the OTG mode setting can be achieved by modifying the configuration file.

[0061] For data transmission errors, the solution includes using technologies such as checksum, error correction code, timeout retransmission and sliding window protocol to ensure the reliability of data transmission. In addition, data transmission failures can be resolved by ensuring that the device and USB interface are working properly, confirming that the power management and transmission protocol settings are correct, and updating or reinstalling drivers and firmware.

[0062] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device.

[0063] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0064] The program code included on the computer readable medium can be transmitted with any appropriate medium, including but not limited to wireless, electric wire, optical cable, RF, etc., or any suitable combination of the above. The computer program code for performing the operation of the present invention can be written in one or more programming languages ​​or their combinations, and the programming language includes object-oriented programming languages-such as Java, Smalltalk, C++, and also includes conventional procedural programming languages-such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0065] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technical personnel in this field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still fall within the scope of the technical solution of the present invention.

Claims

1. A multi-state recognition and automatic mode switching system based on a state recognition module, characterized in that: include: System status initialization and monitoring unit, mode automatic switching logic unit, compatibility optimization unit; The system status initialization and monitoring unit is used to read the system status register to obtain the operating status by calling the initialization function of the status identification module when the system is started, and set the parameters of the status identification module according to the operating status; The mode automatic switching logic unit is used to obtain the updated state information of the state recognition module in the system state initialization and monitoring unit, and if the updated state information is captured, the detection mechanism of the USB OTG mode management module is triggered; The compatibility optimization unit is used to periodically call the compatibility optimization module, and detect the matching between the current system operation state and the USB OTG mode through the compatibility optimization module to obtain a matching result; if the matching result is mismatch, the system performs adaptive adjustment.

2. The system according to claim 1, characterized in that The initialization function reading method is to obtain flag information by reading the flag of the status register, and the flag information includes EDLA mode, normal mode, and burning mode.

3. The system according to claim 1, characterized in that The parameters of the state recognition module include a state recognition threshold and a state switching rule; the state recognition threshold is used to distinguish different operation modes, and the state switching rule is used to determine the switching conditions of the USB OTG mode under different states.

4. The system according to claim 1, characterized in that The state recognition module monitors the system state register at fixed time intervals during system operation, analyzes the flag information in the register, and determines the current system operation state according to the preset state machine model and conditional trigger mechanism, and updates the system state information.

5. The system according to claim 1, characterized in that The detection mechanism of the USB OTG mode management module is: if the update status information shows that the system is in a specific operating state under the EDLA test mode, it switches to the host mode; if the update status information shows that the system is in an operating state under bin file burning, it switches to the slave mode.

6. The system according to claim 5, characterized in that The switching method is as follows: when the system detects the EDLA test mode, calling the host mode initialization function to set the USB OTG mode to the host mode, so that the system can actively control the connected external device through the USB interface; When the system detects the bin file burning mode, it calls the slave mode initialization function to set the USB OTG mode to slave mode, so that the system can receive data transmitted by external devices.

7. The system according to claim 1, characterized in that The adaptive adjustment method is as follows: the system will re-call the state recognition module to correct the error state.

8. The system according to claim 1, characterized in that The compatibility optimization unit will perform a stability test at a time point after the system completes mode switching. The stability test is used to ensure that the system mode works normally after switching. If the stability test result is unstable, the system enters the exception handling process.

9. The system according to claim 8, characterized in that The exception handling process includes re-switching modes and prompting users.

10. The system according to claim 6, characterized in that The switching method determines whether the current system operation state meets the switching condition through an if-else structure.

11. The system according to claim 1, characterized in that The compatibility optimization module determines whether mode correction is required by comparing the current system operation state with the USB OTG mode.

12. The system according to claim 1, characterized in that The update status information displays the current operation status and USB OTG mode in real time through the system interface, and the user can view the working status of the system through the interface.

13. The system according to claim 1, characterized in that The stability detection results include mode switching failure and data transmission error; the user can manually select the USB OTG mode through the interface, and the system will update the configuration of the status recognition module.

14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, a multi-state recognition and automatic mode switching system based on a state recognition module as described in any one of claims 1 to 13 is implemented.

15. A storage medium containing computer executable instructions, characterized in that: The computer executable instructions are used to execute the multi-state recognition and automatic mode switching system based on the state recognition module as described in any one of claims 1 to 13 when executed by a computer processor.