Log capturing circuit and method, communication module and electronic equipment
By combining an analog switch chip and a serial port data splitter, the ability to dynamically switch between wired and wireless serial port log data capture without affecting the normal operation of the communication module is realized. This solves the problems of device disassembly and operation interruption in traditional log capture, and improves user experience and device adaptability.
Patent Information
- Application Number
- CN202511508491.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-03-06
AI Technical Summary
Traditional serial port log capture requires disassembling the device or reserving a hardware interface, which cannot be adapted to sealed or mobile scenarios and affects the normal operation of the device, resulting in the loss of logs during critical periods.
Using analog switch chips and serial port data splitters, non-intrusive log capture is achieved by dynamically switching between multiplexed interfaces or cellular modules. The analog switch chip controls the on/off state of the serial port signal, and the signal is led to the multiplexed interface or cellular module to achieve wired or wireless log data capture.
It eliminates the need to disassemble or interrupt equipment operation, reducing equipment downtime, improving user experience, and enhancing equipment adaptability and data capture stability.
Smart Images

Figure CN121614422A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a log capture circuit, method, communication module and electronic device. Background Technology
[0002] Traditional UART log capture requires connecting to external devices via physical debugging interfaces (such as UART pins), necessitating device disassembly or the provision of hardware interfaces, increasing equipment maintenance costs, and is unsuitable for communication modules in sealed or mobile environments (such as automotive modules and IoT devices). Furthermore, the above methods require interrupting device operation for log capture (e.g., pausing services to access debugging tools), leading to the loss of logs during critical periods (such as before system crashes). Therefore, how to achieve serial port log capture without affecting the normal operation of the communication module has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a log capture circuit, method, communication module, and electronic device to solve the technical problem of how to capture serial port logs without affecting the normal operation of the communication module.
[0004] In a first aspect, this application provides a log capture circuit, the circuit comprising: an analog switch chip, a serial port data splitter, and a multiplexing interface; The analog switch chip's input terminal is connected to the serial port signal of the main control chip of the communication module; the analog switch chip's output terminal is connected to the input terminal of the serial port data splitter; and the analog switch chip's control terminal is connected to the control output terminal of the main control chip. The control output terminal is used to control the on / off state between the analog switch chip's input terminal and its output terminal. The wired output of the serial port data splitter is connected to the multiplexing interface and is used to send the serial port signal to the multiplexing interface when the on / off state is on, so as to capture serial port log data through the multiplexing interface; the wireless output of the serial port data splitter is connected to the cellular module of the communication module and is used to send the serial port signal to the cellular module when the on / off state is on, so as to capture the serial port log data through the cellular module.
[0005] Optionally, the circuit further includes a level converter; The level converter is connected in series between the multiplexing interface and the serial port data splitter to match the level difference between the adapted level of the serial port and the adapted level of the multiplexing interface.
[0006] Optionally, the analog switch chip includes a first input terminal, a second input terminal, a first output terminal, a second output terminal, and a control terminal; The first input terminal is connected to the serial port transmitter of the main control chip, and the first output terminal is connected to the first port of the differential signal line of the multiplexing interface through the serial port data splitter. The second input terminal is connected to the serial port receiver of the main control chip, and the second output terminal is connected to the second port of the differential signal line of the multiplexing interface through the serial port data splitter; The control terminal is connected to the control output terminal of the main control chip. When the control output terminal outputs a high level, the first input terminal is connected to the first output terminal and the second input terminal is connected to the second output terminal. When the control output terminal outputs a low level, the first input terminal is disconnected from the first output terminal and the second input terminal is disconnected from the second output terminal.
[0007] Optionally, the multiplexing interface is a universal serial bus interface or a high-speed serial computer expansion bus standard interface.
[0008] Secondly, this application provides a communication module, which includes a main control chip, a cellular module, and a log capture circuit as described in any one of the first aspects.
[0009] Thirdly, this application provides a log capture method, applied to the communication module described in the second aspect, the method comprising: In response to the serial port log capture signal, determine whether the multiplexed interface is idle; When the multiplexing interface is idle, the control output terminal of the main control chip drives the input terminal of the analog switch chip and the output terminal of the analog switch chip to a conducting state, so that the serial port signal of the main control chip is connected to the multiplexing interface through the wired output terminal of the serial port data splitter and connected to the cellular module of the communication module through the wireless output terminal of the serial port data splitter. Serial port log data can be captured through the multiplexing interface or through the cellular module.
[0010] Optionally, the serial port log capture signal is triggered based on a listening trigger condition; wherein the trigger condition includes at least one of module error information, remote command, or log buffer cache occupancy reaching a preset threshold.
[0011] Optionally, capturing serial port log data through the multiplexing interface or through the cellular module includes: The serial port log output mode is determined based on the serial port log capture signal. When the serial port log output mode is wired transmission mode, serial port log data is captured through the multiplexing interface; When the serial port log output mode is wireless transmission mode, the serial port log data is captured through the cellular module.
[0012] Optionally, during the process of capturing serial port log data through the multiplexing interface or the cellular module, the method further includes: If the multiplexing interface switching fails, an error log is recorded in the log buffer so that, in the event that the multiplexing interface switching is successful, the error log in the log buffer can be sent through the multiplexing interface. If the network of the cellular module is determined to be interrupted, the serial port log data is temporarily stored in the log buffer and the breakpoint resume is triggered so that the serial port log data can continue to be sent through the cellular module when the network of the cellular module is normal.
[0013] Fourthly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the log capture method described in any embodiment of the third aspect.
[0014] Compared with the prior art, the technical solution provided in this application has the following advantages: The log capture circuit provided in this application includes an analog switch chip, a serial port data splitter, and a multiplexing interface. The input terminal of the analog switch chip is connected to the serial port signal of the main control chip of the communication module; the output terminal of the analog switch chip is connected to the input terminal of the serial port data splitter; the control terminal of the analog switch chip is connected to the control output terminal of the main control chip; wherein, the control output terminal is used to control the on / off state between the input terminal and the output terminal of the analog switch chip; the wired output terminal of the serial port data splitter is connected to the multiplexing interface, used to send serial port signals to the multiplexing interface when the on / off state is on, so as to capture serial port log data through the multiplexing interface; the wireless output terminal of the serial port data splitter is connected to the cellular module of the communication module, used to send serial port signals to the cellular module when the on / off state is on, so as to capture serial port log data through the cellular module. This log capture circuit does not require disassembly or interruption of the device when capturing serial logs. Instead, it uses an analog switch chip and a serial data splitter to direct the serial port signal from the main control chip to the multiplexing interface and the cellular module. This allows serial log data to be captured via wired connection through the multiplexing interface or wirelessly through the cellular module. The analog switch chip dynamically switches between these modes to achieve non-intrusive log capture, reducing downtime of the communication module and improving the user experience. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0018] Figure 1 A schematic diagram of a log capture circuit provided in one embodiment of this application; Figure 2 A schematic diagram of an analog switch chip provided in one embodiment of this application; Figure 3 A flowchart illustrating a log capture method provided in one embodiment of this application; Figure 4 A schematic diagram illustrating a log capture method according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0021] To address the technical challenge of capturing serial port logs without disrupting the normal operation of the communication module, this application provides a log capture circuit, method, communication module, and electronic device. It can capture serial port log data via a wired connection using a multiplexed interface or wirelessly via a cellular module. Dynamic switching using an analog switch chip enables non-intrusive log capture, reducing downtime for the communication module and improving the user experience.
[0022] The first embodiment of this application provides a log capture circuit, such as Figure 1 The log capture circuit includes: an analog switch chip 101, a serial port data splitter 102, and a multiplexing interface 103.
[0023] The analog switch chip 101 has its input terminal connected to the serial port signal of the main control chip of the communication module; its output terminal is connected to the input terminal of the serial port data splitter 102; and its control terminal is connected to the control output terminal of the main control chip. The control output terminal is used to control the on / off state between the input terminal and the output terminal of the analog switch chip 101.
[0024] The wired output of the serial data splitter 102 is connected to the multiplexing interface 103, and is used to send serial signals to the multiplexing interface 103 when the on / off state is on, so as to capture serial log data through the multiplexing interface 103; the wireless output of the serial data splitter 102 is connected to the cellular module of the communication module, and is used to send serial signals to the cellular module when the on / off state is on, so as to capture serial log data through the cellular module.
[0025] This log capture circuit does not require disassembly or interruption of the device when capturing serial logs. Instead, it uses an analog switch chip and a serial data splitter to direct the serial port signal from the main control chip to the multiplexing interface and the cellular module. This allows serial log data to be captured via wired connection through the multiplexing interface or wirelessly through the cellular module. The analog switch chip dynamically switches between these modes to achieve non-intrusive log capture, reducing downtime of the communication module and improving the user experience.
[0026] In one embodiment, the multiplexed interface is a Universal Serial Bus (USB) interface or a Peripheral Component Interconnect Express (PCIe) interface.
[0027] For example, the main control chip can be the main chip of the communication module, and the communication module can be a wireless communication module. The serial port signal of the main control chip can be sent or received through the UART debug pin of the main control chip. The UART debug pin can be connected to the differential signal line of the multiplexing interface through the analog switch chip, such as connecting the D+ and D- of the USB interface, or connecting the reserved lane of the PCIe interface.
[0028] In this embodiment, minimizing the addition of new hardware can be achieved by reusing the resources of the communication module. The reusable interface can be used as a USB interface (or PCIe interface) when the communication module is in normal use, and as a virtual serial port when it is necessary to capture serial port logs. The serial port data splitter is set between the analog switch chip and the reusable interface. The serial port data splitter includes a wireless transmission channel and a wired transmission channel. The wired transmission channel connects the output terminal of the analog switch chip and the reusable interface, and the wired transmission channel connects the output terminal of the analog switch chip and the cellular module of the communication module. Serial port log data can be sent to the main control board through the wireless transmission channel of the serial port data splitter, and then uploaded to the cloud by the main control board through the cellular network.
[0029] In one embodiment, such as Figure 2 The analog switch chip includes a first input terminal (IN1), a second input terminal (IN2), a first output terminal (OUT1), a second output terminal (OUT2), and a control terminal (SEL).
[0030] The specific connection relationships are as follows: The first input terminal is connected to the serial port transmitter (UART_TX) of the main control chip. The first output terminal is connected to the first port of the differential signal line of the multiplexed interface through a serial port data splitter (taking a USB interface as an example, the first port is USB_D+). The second input terminal is connected to the serial port receiver (UART_RX) of the main control chip. The second output terminal is connected to the second port of the differential signal line of the multiplexed interface through a serial port data splitter (taking a USB interface as an example, the second port is USB_D-). The control terminal is connected to the control output terminal of the main control chip (e.g., GPIO12). When the control output terminal outputs a high level, the first input terminal and the first output terminal are connected, and the second input terminal and the second output terminal are connected. When the control output terminal outputs a low level, the first input terminal and the first output terminal are disconnected, and the second input terminal and the second output terminal are disconnected.
[0031] In this embodiment, the control terminal (SEL) of the analog switch chip can be driven by the general purpose input / output (GPIO) port of the communication module (such as GPIO12), and the signal path can be switched by high and low levels.
[0032] The operating modes of analog switch chips can include normal mode and log mode.
[0033] Normal mode (GPIO12 output is low): The analog switch chip disconnects the UART path, and the USB interface is used for regular data transmission.
[0034] Log mode (GPIO12 output high level): The analog switch chip conducts the UART signal path (i.e., the first input terminal is connected to the first output terminal, and the second input terminal is connected to the second output terminal). After level conversion, the data is transmitted to the USB interface. The firmware switches the USB interface to virtual serial port mode to realize log pass-through. Thus, serial port log data can be captured in a wired manner through the multiplexed interface, or in a wireless manner through the cellular module. The analog switch chip dynamically switches to achieve non-intrusive log capture, reducing the downtime of the communication module equipment and improving the user experience.
[0035] In one embodiment, the log capture circuit further includes a level shifter. The level shifter is connected in series between the multiplexing interface and the serial data splitter to match the level difference between the adapted level of the serial port and the adapted level of the multiplexing interface.
[0036] In this embodiment, a level converter is used to match the level difference between the serial port's adaptation level and the multiplexed interface's adaptation level. For example, if the multiplexed interface is a USB interface, typically only one level converter is needed. For instance, since the USB interface level is 3.3V, the UART level (1.8V / 3.3V / 5V) can be converted to 3.3V ± 0.3V using a level converter, thus ensuring signal compatibility. If the multiplexed interface is a PCIe interface, two level converters are typically required. Level converter 1 can use an SN74LVC8T245 to step down the UART level (1.8V / 3.3V / 5V) to 1.8V DC, and the second level converter can use a DS80PCI402 to convert it to AC 0.8V, thus ensuring signal compatibility.
[0037] Based on the same technical concept, the second embodiment of this application provides a communication module, which includes a main control chip, a cellular module, and a log capture circuit of any one of the components in the first embodiment.
[0038] This communication module does not require disassembly or interruption of the device when capturing serial port logs. Instead, it uses an analog switch chip and a serial port data splitter to direct the serial port signal of the main control chip to the multiplexing interface and the cellular module. This allows serial port log data to be captured via wired connection through the multiplexing interface or wirelessly through the cellular module. The analog switch chip dynamically switches between these modes to achieve non-intrusive log capture, reducing downtime of the communication module and improving the user experience.
[0039] The third embodiment of this application provides a log capture method, applied to the communication module of the second embodiment, such as... Figure 3 The methods include: Step 301: In response to the serial port log capture signal, determine whether the multiplexed interface is idle.
[0040] Serial port log capture signals can be triggered based on monitored conditions. These conditions can include module error messages, remote commands, or log buffer occupancy reaching a preset threshold. For example, a module error message could indicate a system crash, triggering the serial port log capture signal when a system freeze is detected. Remote commands can be AT commands, such as Message Queuing Telemetry Transport (MQTT) commands. Reaching a preset threshold for log buffer occupancy indicates the need to capture serial port log data, and the data in the log buffer should be cleared after capture. Upon receiving a serial port log capture signal, it can be determined whether the multiplexed interface is idle. If the multiplexed interface is idle (i.e., not occupied), it can be used as a virtual serial port to capture serial port log data. It should be noted that if multiple trigger conditions are met simultaneously, they can be processed in order of priority to prevent multiple event conflicts and improve system stability.
[0041] Step 302: When the multiplexing interface is idle, the control output terminal of the main control chip drives the on / off state between the input terminal and the output terminal of the analog switch chip to the on state, so that the serial port signal of the main control chip is connected to the multiplexing interface through the wired output terminal of the serial port data splitter and connected to the cellular module of the communication module through the wireless output terminal of the serial port data splitter.
[0042] Step 303: Capture serial port log data through the multiplexing interface or through the cellular module.
[0043] This log capture method does not require disassembling the device or interrupting its operation when capturing serial port logs. Instead, it uses an analog switch chip and a serial port data splitter to direct the serial port signal of the main control chip to the multiplexing interface and the cellular module. This allows serial port log data to be captured via wired connection through the multiplexing interface or wirelessly through the cellular module. The analog switch chip dynamically switches between these modes to achieve non-intrusive log capture, reducing downtime of the communication module and improving the user experience.
[0044] In one embodiment, capturing serial port log data via a multiplexed interface or a cellular module includes: determining the serial port log output mode based on the serial port log capture signal; capturing serial port log data via a multiplexed interface when the serial port log output mode is a wired transmission mode; and capturing serial port log data via a cellular module when the serial port log output mode is a wireless transmission mode.
[0045] In this embodiment, the corresponding serial port log output mode can be determined in advance based on different serial port log capture signals, or the serial port log capture signal can carry the corresponding serial port log output mode. For example, a remote command can carry the serial port log output mode specified by the command, so that serial port log data can be captured through a multiplexed interface or a cellular module according to the wireless transmission mode or wired transmission mode. It should be understood that serial port log data can also be captured through both wireless transmission mode and wired transmission mode at the same time to ensure the timeliness and accuracy of serial port log data capture.
[0046] In one embodiment, during the process of capturing serial port log data through the multiplexing interface or the cellular module, the method further includes: if the multiplexing interface switching fails, recording an error log to a log buffer, so that if the multiplexing interface switching is successful, the error log in the log buffer can be sent through the multiplexing interface; if the cellular module's network is interrupted, temporarily storing the serial port log data in the log buffer and triggering breakpoint resume transmission, so that if the cellular module's network is normal, the serial port log data can continue to be sent through the cellular module.
[0047] In this embodiment, the process of capturing serial port log data also includes handling abnormal situations. For example, when the multiplexing interface switching fails, error logs can be recorded in the log buffer. After the multiplexing interface switching is successful, the error logs stored in the log buffer can be sent through the multiplexing interface. When the cellular module's network is interrupted, the serial port log data can be temporarily stored in the log buffer and the breakpoint resume can be triggered. After the cellular module's network is restored, the serial port log data can be sent through the cellular module immediately, ensuring the stability of serial port log capture.
[0048] In one specific embodiment, the log capture method is as follows: Figure 4 ,include: Step 401, Begin.
[0049] Step 402, System Initialization. During initialization, configuration information can be initialized, such as configuring UART parameters: baud rate (115200bps), data bits (8 bits), stop bits (1 bit), and no parity. Register the AT command set: Define AT+LOGCTRL= <mode>(mode=0 indicates off, 1 indicates local wired transmission is enabled, 2 indicates wireless transmission is enabled), to implement dynamic switching logic.
[0050] Step 403: Monitor trigger conditions. Trigger conditions can be module error messages, remote commands, or log buffer cache usage reaching a preset threshold. After any event is triggered, check the idle status of the multiplexed interface (USB / PCIe). If multiple events trigger simultaneously, they enter a waiting queue and can be processed according to priority. The priority order is: module error message trigger > remote command trigger > log buffer cache usage reaching the preset threshold trigger. All trigger conditions are uniformly entered into the interface idle judgment, and log transmission is executed serially. Strict queuing is required to wait for the interface to become idle to prevent multiple event conflicts.
[0051] Step 404: Determine if the USB / PCIe is idle. If not, proceed to step 405; otherwise, proceed to step 407.
[0052] Step 405, wait for timeout (10ms), and then proceed to step 406.
[0053] Step 406: Retry or report an error.
[0054] Step 407: Switch log mode.
[0055] Step 408, pull GPIO high.
[0056] Step 409: The level converter matches the signal level and starts the virtual serial port protocol.
[0057] Step 410, Log Data Transmission (including wired and wireless transmission modes). In wired transmission mode, the captured log data can be output to the host by using a multiplexed interface as a virtual serial port. In wireless transmission mode, the captured log data can be encrypted and compressed before being sent to the cloud. Processing can be performed according to the wireless log transmission protocol stack. For example, the compression algorithm can use LZ4 real-time compression, with a compression rate of approximately 50% and a latency of less than 1ms. The encryption mechanism can use AES mode encryption, and the key can be dynamically distributed from the cloud. Regarding the transmission protocol, the application layer can use the MQTT protocol, with the topic format / device / IMEI / logs and QoS=1 (at least once). The transmission layer can establish a cellular network connection based on PPP dialing and keep it alive through a TCP long connection. Resume interrupted transmission is enabled; when the network is interrupted, the logs are temporarily stored in a buffer, and transmission resumes in sequence after the network is restored, avoiding duplication or loss.
[0058] Step 411, exception handling. For example, when the multiplexing interface switching fails, an error log can be recorded in the log buffer. After the multiplexing interface switching is successful, the error log stored in the log buffer can be sent through the multiplexing interface. When the cellular module's network is interrupted, the serial port log data can be temporarily stored in the log buffer and the breakpoint resume transmission can be triggered. After the cellular module's network is restored, the serial port log data can be sent through the cellular module immediately, ensuring the stability of serial port log capture.
[0059] Step 412, End.
[0060] This embodiment addresses the pain points of traditional serial port log capture, such as high invasiveness, high cost, low real-time performance, weak remote capability, and easy data loss, especially in device debugging scenarios, through interface reuse, wireless transparent transmission, and hardware-software collaboration. This embodiment achieves non-intrusive log data capture by dynamically switching analog switch chips, overcomes physical connection limitations through cellular network transparent transmission, and ensures data reliability and security through compression and encryption, ultimately forming a complete closed-loop system from signal acquisition and processing to transmission. For manufacturers, this reduces maintenance costs and enhances product competitiveness. For users, it reduces equipment downtime and improves the user experience. For maintenance personnel, it enables remote and efficient diagnostics, reducing workload.
[0061] For example, scenario 1: remotely triggered log capture The platform sends the MQTT command to the device: {"cmd": "upload_log", "trigger": "error_code_0xE1"}. The device firmware parses the command, and upon detecting error code 0xE1, automatically switches to wireless logging mode. The log is compressed and encrypted, then uploaded to the cloud via the 5G network and displayed in real-time on the operations and maintenance console.
[0062] Scenario 2: Log saving before system crash The watchdog detects a system crash and triggers an NMI (Non-Maskable Interrupt). After the device restarts, it reads the pre-crash logs from the Flash buffer and retransmits them wirelessly.
[0063] like Figure 5 As shown in the figure, this application provides an electronic device, including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114. Memory 113 is used to store computer programs; In one embodiment of this application, the processor 111, when executing the program stored in the memory 113, implements the log capture method provided in any of the foregoing method embodiments.
[0064] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0065] The communication interface is used for communication between the aforementioned terminal and other devices.
[0066] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0067] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0068] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the log capture method provided in any of the foregoing method embodiments.
[0069] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0070] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0071] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "a," "an," and "described" as used herein may also mean including the plural forms. The terms "comprising," "including," "containing," and "having" are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a specific order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0072] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application. In the description, suffixes such as "module," "part," or "unit" used to denote elements are used only for illustrative purposes and have no specific meaning in themselves. Therefore, "module," "part," or "unit" may be used interchangeably.
[0073] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.< / mode>
Claims
1. A log scraping circuit, comprising: The circuit comprises an analog switch chip, a serial port data shunt and a multiplexing interface. The input end of the analog switch chip is connected with the serial port signal of the master chip of the communication module; the output end of the analog switch chip is connected with the input end of the serial port data shunt; the control end of the analog switch chip is connected with the control output end of the master chip; the control output end is used to control the on-off state between the input end of the analog switch chip and the output end of the analog switch chip. The wired output end of the serial port data shunt is connected with the multiplexing interface, and is used to send the serial port signal to the multiplexing interface to capture serial port log data through the multiplexing interface when the on-off state is on; the wireless output end of the serial port data shunt is connected with the cellular module of the communication module, and is used to send the serial port signal to the cellular module to capture the serial port log data through the cellular module when the on-off state is on.
2. The circuit of claim 1, wherein, The circuit further comprises a level converter; The level converter is connected in series between the multiplexing interface and the serial port data shunt, and is used to match the level difference between the adaptive level of the serial port and the adaptive level of the multiplexing interface.
3. The circuit of claim 1, wherein, The analog switch chip comprises a first input end, a second input end, a first output end, a second output end and a control end. The first input end is connected with the serial port sending end of the master chip, and the first output end is connected with the first port of the differential signal line of the multiplexing interface through the serial port data shunt. The second input end is connected with the serial port receiving end of the master chip, and the second output end is connected with the second port of the differential signal line of the multiplexing interface through the serial port data shunt. The control end is connected with the control output end of the master chip; when the control output end outputs a high level, the first input end and the first output end are on, and the second input end and the second output end are on; when the control output end outputs a low level, the first input end and the first output end are off, and the second input end and the second output end are off.
4. The circuit of claim 1, wherein, The multiplexing interface is a universal serial bus interface or a high-speed serial computer expansion bus standard interface.
5. A communication module, characterized in that The communication module comprises a master chip, a cellular module and the log capturing circuit of any one of claims 1-4.
6. A log scraping method characterized by, The method is applied to the communication module of claim 5, and the method comprises: In response to a serial port log capturing signal, determining whether the multiplexing interface is idle; When the multiplexing interface is idle, driving the on-off state between the input end of the analog switch chip and the output end of the analog switch chip to be on through the control output end of the master chip, so that the serial port signal of the master chip is connected with the multiplexing interface through the wired output end of the serial port data shunt and connected with the cellular module of the communication module through the wireless output end of the serial port data shunt; Capturing serial port log data through the multiplexing interface or through the cellular module.
7. The method of claim 6, wherein, The serial port log grabbing signal is triggered based on a trigger condition of monitoring; wherein the trigger condition comprises at least one of module error information, remote instruction, or log buffer cache occupancy reaching a preset threshold.
8. The method of claim 6, wherein, The serial port log data is grabbed through the multiplexing interface or through the cellular module, comprising: determining a serial port log output mode according to the serial port log grabbing signal; in the case of the serial port log output mode being a wired transmission mode, grabbing serial port log data through the multiplexing interface; in the case of the serial port log output mode being a wireless transmission mode, grabbing serial port log data through the cellular module.
9. The method of claim 6, wherein, In the process of grabbing serial port log data through the multiplexing interface or through the cellular module, the method further comprises: determining that the multiplexing interface switching fails, then recording error logs to a log buffer, so as to send the error logs in the log buffer through the multiplexing interface in the case of the multiplexing interface switching successfully; determining that the network of the cellular module is interrupted, then temporarily storing serial port log data to the log buffer and triggering breakpoint resume transmission, so as to continue sending the serial port log data through the cellular module in the case of the network of the cellular module being normal.
10. An electronic device, comprising: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory is used for storing computer programs; the processor is used for executing the programs stored on the memory, and realizes the log grabbing method in any one of claims 6-9.