A fault data exporting method, exporting circuit and mobile power supply
By integrating a control processing unit and a USB chip into the power bank, and utilizing a universal serial bus interface to achieve automatic or manual switching transmission of fault data, the problem of data extraction in the fault state of the power bank is solved, and fault data acquisition is achieved in a simple and efficient manner.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN LANHE TECHNOLOGIES CO LTD
- Filing Date
- 2026-03-24
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies make it difficult to quickly and easily extract fault data when a power bank is malfunctioning, especially when the system is frozen or crashed, resulting in low efficiency in problem localization.
By integrating a control processing unit, a universal serial bus interface, and a USB chip into the power bank, it communicates with external devices using the universal serial bus interface. When switching to data transmission mode, the control processing unit acquires fault data and transmits it to the external device after protocol format conversion via the USB chip. No special tools or drivers are required for operation.
It enables stable acquisition of fault data without special tools and drivers in the event of a power bank failure. It is easy to operate, suitable for on-site repair and after-sales service, and improves the efficiency of fault data extraction.
Smart Images

Figure CN122387902A_ABST
Abstract
Description
Technical Field
[0001] This patent relates to the field of portable power bank technology, and in particular to a fault data export method, export circuit and power bank. Background Technology
[0002] Portable power banks (such as power banks) are widely used in the consumer electronics field as portable energy storage devices. With the increasing integration of portable power banks, their internal operating status data is of great value for product quality control, after-sales maintenance, and fault location. When a portable power bank malfunctions, quickly extracting its internal data is a key step in problem localization.
[0003] To address the data extraction needs in power bank failure scenarios, existing technologies typically employ the following methods: First, connect the power bank to dedicated hardware devices such as a dedicated debugger, serial port debugging tool, or dedicated card reader to obtain the data stored inside; second, install specific drivers or software on a computer to establish communication with the power bank via a wired interface and then export the data.
[0004] However, the existing methods described above have significant limitations. Dedicated hardware requires technical personnel to operate, and the tools are inconvenient to carry, making it difficult to deploy quickly in non-laboratory scenarios such as fieldwork. Computer-based solutions rely on driver installation and configuration, which involves cumbersome procedures and requires a high level of technical expertise from users, making it difficult for ordinary after-sales personnel and end users to complete the operation independently.
[0005] A more critical issue is that most of the existing methods rely on the normal operation of the power bank's application layer communication function. When a power bank experiences a serious malfunction such as freezing, system crash, or inability to charge, its application layer communication fails, external devices cannot establish a valid communication link with the power bank, and key operational data at the fault location cannot be extracted, severely impacting the efficiency of problem reproduction and root cause analysis.
[0006] Therefore, there is an urgent need for a technical solution that can reliably acquire underlying data using ordinary mobile devices or tools, without the need for special tools and drivers, even when the power bank fails. Summary of the Invention
[0007] This patent provides a fault data export method, export circuit, and power bank to solve the problems in the prior art where fault data extraction from a power bank in a fault state relies on specialized tools and is complex to operate.
[0008] To address the aforementioned issues, this patent proposes a fault data export method applicable to portable power banks. The power bank includes a control processing unit and a Universal Serial Bus (USB) interface, with the control processing unit communicatively connected to the USB interface. The method for exporting fault data includes the following steps: S1: Connects to external devices via a universal serial bus interface to switch the power bank's communication mode from power supply mode to data transmission mode; S2: Obtain fault data through the control processing unit; S3: Convert the protocol format of the fault data transmitted by the control processing unit so that it can be transmitted through the universal serial bus interface; S4: Transmit fault information data to external devices to export fault data.
[0009] In some embodiments of this patent, the method further includes: in step S1, the communication mode switching method includes manual switching mode and / or automatic switching mode; The manual switching mode is activated by pressing a button on the power bank to enter the data transmission mode. The automatic switching mode establishes communication with external devices via a power bank, triggering the communication mode to enter the data transmission mode.
[0010] In some embodiments of this patent, the method further includes the step of switching the communication mode by manually switching modes, comprising: The power bank is electrically connected to external devices via a Universal Serial Bus interface. The control processing unit detects the duration of button press and determines the current operation type based on the duration of button press. In response to the operation type, switch the communication mode to data transmission mode.
[0011] In some embodiments of this patent, the method further includes: the operation type includes a short press operation or a long press operation; A short press operation is a button press duration that is less than a preset short press threshold, and the control processing unit responds to the short press operation. A long press operation is a button press duration that exceeds a preset long press threshold, and the control processing unit responds to the long press operation.
[0012] In some embodiments of this patent, the method further includes: the external device type includes mobile devices and storage devices. The power bank connects to external devices via a Universal Serial Bus interface; The control processing unit identifies the device type of external devices; In response to the device type being a storage device, the communication mode is automatically switched to data transfer mode.
[0013] In some embodiments of this patent, the method further includes the step of controlling the processing unit to identify the device type, which includes: Detect changes in the pin voltage of the Universal Serial Bus interface to determine if an external device is connected; The control processing unit detects the access of an external device, initiates a handshake communication with the external device through the universal serial bus interface, and receives handshake information; The type of external device can be determined based on the handshake information.
[0014] In some embodiments of this patent, the method further includes: the power bank further includes a battery management unit and a USB chip, and the control processing unit is communicatively connected to the battery management unit and the USB chip respectively. The step of obtaining fault data through the control processing unit includes: The control processing unit reads the raw data from the registers of the battery management unit; The raw data is converted into physical quantity data, and abnormal data is identified to generate fault data; The fault data is encapsulated according to a preset communication protocol format; The packaged fault data is output to the USB chip.
[0015] In some embodiments of this patent, the method further includes the step of converting the protocol format of the fault data transmitted by the control processing unit, comprising: Receive fault data sent by the control processing unit; The fault data is converted from the first communication protocol format to a second communication protocol format suitable for transmission via a universal serial bus interface.
[0016] In some embodiments of this patent, the method further includes: the power bank is equipped with an indicator light, and in step S4, the fault data is successfully exported, and the indicator light displays a preset color.
[0017] In some embodiments of this patent, the method further includes a communication mode that allows the power bank to charge while transmitting data, so that the power bank is charged while transmitting data.
[0018] Based on the same inventive concept, this patent proposes an output circuit, which includes a control processing unit, a battery management unit, a USB chip, and a universal serial bus interface. The control processing unit communicates with the battery management unit and the USB chip respectively through the internal communication protocol interface bus. The universal serial bus interface communicates with the control processing unit through the USB chip and is used to communicate with external devices. The control processing unit is used to read the register data of the battery management unit and obtain fault data; The USB chip is used to convert the protocol format of fault data transmitted by the control processing unit and transmit the converted fault data to external devices.
[0019] Based on the same inventive concept, this patent proposes a mobile power supply, including a computer storage medium and the aforementioned export circuit. The computer storage medium and the export circuit are communicatively connected. The computer storage medium stores a computer program. The export circuit is configured to execute the steps of any of the aforementioned fault data export methods when executing the computer program.
[0020] The beneficial effects of this patent are as follows: This patent proposes a fault data export method, export circuit, and power bank. After connecting the external device to the power bank through the power bank's control processing unit, USB chip, and Universal Serial Bus interface, the fault data of the power bank is acquired. The fault data is then transmitted to the external device through the USB chip and Universal Serial Bus interface, realizing the acquisition and export of fault data of the power bank in a fault state. No special debugging tools or drivers are required throughout the process. The operation is simple and suitable for on-site repair and after-sales service scenarios. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the circuit composition of an embodiment of the fault derivation circuit provided in this patent; Figure 2 This is a schematic diagram of the export process of an embodiment of the fault data export method provided in this patent; Figure 3 This is a flowchart illustrating an embodiment of the fault data reading method provided in this patent; Figure 4 This is a flowchart illustrating an embodiment of the fault data conversion format in the fault data export method provided in this patent; Figure 5 This is a flowchart illustrating an embodiment of the fault data export method provided in this patent, specifically a method for manually switching communication modes. Figure 6 This is a flowchart illustrating an embodiment of the fault data export method provided in this patent for determining the key operation type. Figure 7 This is a flowchart illustrating an embodiment of the fault data export method provided in this patent, specifically the automatic switching of communication modes. Figure 8 This is a flowchart illustrating an embodiment of the fault data export method provided in this patent, in which the control processing unit identifies the device type. Figure 9 This is a schematic diagram of the hardware structure of the device used to perform the fault data export method provided in this patent. Detailed Implementation
[0022] To facilitate understanding of this patent, a more detailed description is provided below with reference to the accompanying drawings and specific embodiments. The drawings illustrate preferred embodiments of this patent. However, this patent can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of this patent.
[0023] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this patent belongs. The terminology used in this patent specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this patent. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0024] As described in the background section, existing portable power banks, when malfunctioning, typically require dedicated hardware devices such as debuggers, serial port debugging tools, or dedicated card readers to connect to the power bank and retrieve its internally stored data; or specific drivers or software must be installed on a computer to establish communication with the power bank via a wired interface to export the data. Existing export methods have limitations: dedicated hardware requires technical personnel assistance and is inconvenient to carry, making rapid deployment in non-laboratory scenarios such as fieldwork; computer-based solutions rely on driver installation and configuration, involving cumbersome procedures and requiring a high level of technical expertise from users, making it difficult for ordinary after-sales personnel and end users to complete the operation independently.
[0025] To address the aforementioned issues, this patent proposes a fault data export method for portable power banks. This patent will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0026] I. Hardware Architecture of Power Bank 100 According to one embodiment of this patent, such as Figure 1 As shown, the internal hardware architecture of the portable power bank 100 includes a control processing unit 110, a battery management unit 120, a power metering unit 130, a universal serial bus interface 140, a USB chip 150, a button 160, and an indicator light 170.
[0027] The control processing unit 110 is communicatively connected to the battery management unit 120, the power metering unit 130 and the USB chip 150 respectively. The USB chip 150 is communicatively connected to the universal serial bus interface 140. The button 160 and the indicator light 170 are respectively set on the outer shell of the power bank 100.
[0028] The control processing unit 110 is the core control chip of the power bank 100, namely the MCU (Microcontroller Unit). It is responsible for coordinating the work of each unit, exchanging data with the battery management unit 120, the power metering unit 130, and the USB chip 150 through internal communication interfaces, and managing the communication mode switching of the universal serial bus interface 140. In the embodiments of this patent, the "internal communication interface" refers to the chip's internal communication protocol interface used for data exchange between the control processing unit 110 and the battery management unit 120, the power metering unit 130, and the USB chip 150, including but not limited to the I2C bus interface (this patent uses the I2C bus interface as an example) and the serial port (UART) interface. The control processing unit 110 supports bidirectional transmission of the I2C protocol to external devices via the universal serial bus interface 140, which is plug-and-play and requires no driver installation on external devices.
[0029] The battery management unit 120 is a BMS (Battery Management System) chip responsible for managing and protecting the charging and discharging process of the battery pack. It monitors and records key parameters such as battery voltage, current, cell temperature, charging and discharging status, protection events, and fault flags in real time. All of these parameters are stored in the battery management unit 120 in the form of registers. The control processing unit 110 communicates with the battery management unit 120 via the I2C bus and reads its register data.
[0030] The power metering unit 130 is a coulomb counter or other chip used to measure power data. It is responsible for accurately measuring parameters such as the battery's state of charge, remaining power, full charge capacity, cycle count, and health status. These parameters are also stored in the power metering unit 130 in the form of registers. The control processing unit 110 communicates with the power metering unit 130 via the I2C bus and reads its register data.
[0031] The Universal Serial Bus interface 140 is a USB-A interface (this patent takes the USB-A interface as an example) and / or a TYPE-C interface, etc. It can work in power supply mode to supply power to external devices, or work in data transmission mode to communicate with external devices through the mode switching mechanism described in this patent, or work in charging and data transmission mode to receive external charging and transmit data at the same time.
[0032] The USB chip 150 is electrically connected to the control processing unit 110 and the universal serial bus interface. The USB chip 150 receives fault data sent by the control processing unit 110, performs communication protocol format conversion on the fault data, and transmits the converted fault data to an external device. The external device can be a mobile device such as a mobile phone or tablet, or a storage device such as a USB flash drive or hard drive. The USB chip 150 enables bidirectional transmission from I2C or serial port to a USB-A interface and / or a TYPE-C interface. Through the USB chip 150, information such as voltage, current, power, battery level, cycle count, and battery temperature of the portable power bank can be directly transmitted to mobile phones and computer terminals via the USB-A or TYPE-C interface. Commonly used chips for the USB chip 150 include, but are not limited to, the Qinheng CH9347 series and the Xinhai CS32G030.
[0033] Button 160 is located on the casing of the power bank 100, providing users with a physical operation entry point for manually triggering communication mode switching. Button 160 can be used for mode switching and power on / off, including but not limited to, for example, pressing and holding for 3 seconds to turn the power bank on or off, and pressing briefly for 1 second to switch communication modes. The functionality of button 160 can be configured according to specific needs.
[0034] Indicator light 170 is located on the casing of power bank 100 and is used to provide users with intuitive feedback on the current working status and the results of fault data export, or the status of the power bank. For example, if indicator light 170 is solid green, it means that power bank 100 is supplying power; if indicator light 170 is solid red, it means that power bank 100 is charging; if indicator light 170 is flashing green, it means that fault data of power bank 100 has been successfully exported; if indicator light 170 is flashing red, it means that fault data export of power bank 100 has failed; if indicator light 170 is flashing yellow, it means that fault data of power bank 100 is being exported.
[0035] Therefore, it can be seen that the mobile power supply 100 in the above embodiment of this patent provides a hardware foundation for each step of the subsequent fault data export method by integrating the bidirectional transmission mechanism of the integrated control processing unit 110 and the universal serial bus interface 140, as well as human-computer interaction components such as the button 160 and the indicator light 170.
[0036] Example 1 like Figure 2 As shown in the accompanying drawings, this embodiment provides a method for exporting fault data, applied to a portable power bank 100. The specific implementation of each step of the method is described in detail below.
[0037] Step S1: Connect the power bank to an external device via the universal serial bus interface and switch the communication mode of the power bank from power supply mode to data transmission mode.
[0038] Step S2: Obtain the fault data through the control processing unit.
[0039] Step S3: Convert the fault data transmitted by the control processing unit into a protocol format so that it can be transmitted through the universal serial bus interface.
[0040] Step S4: Transmit the fault information data to the external device to export the fault data.
[0041] Specifically, in step S1, when the power bank 100 is not connected to an external device, the USB-A interface is in power supply mode by default. In this mode, the interface only provides power output and does not establish a data communication link. When fault data needs to be exported, the user connects an external device, such as a mobile device or storage device, to the power bank 100 via the USB-A interface. After the power bank's MCU detects the external device connection, it switches the USB-A interface's operating mode from power supply mode to data transmission mode according to the currently preset switching strategy. In data transmission mode, a bidirectional data communication link is established between the USB-A interface and the external device, allowing the power bank's MCU to send fault information data to the mobile device or storage device through this communication link.
[0042] In this embodiment, communication mode switching supports both manual and automatic switching. Manual switching involves pressing a button on the power bank 100 to trigger the data transmission mode. Automatic switching occurs when the power bank 100 establishes communication with an external device, triggering the data transmission mode. In manual mode, the power bank 100 switches to power supply mode or data transmission mode by changing the state of button 160, such as a short press or long press. In automatic mode, when a storage device is inserted, the power bank 100 automatically switches to data transmission mode upon detecting the connection. Switching communication modes in different ways simplifies the operation and facilitates data export for the user. Reusing buttons reduces the number of components on the power bank's casing, improving aesthetics and reducing manufacturing costs.
[0043] In step S2, the fault data is acquired through the control processing unit.
[0044] After the power bank 100 enters the data transmission mode, the control processing unit 110 sends data read commands to the battery management unit 120 and the power metering unit 130 through the I2C bus interface, respectively, to read the currently stored raw data from their registers.
[0045] In this embodiment, the control processing unit 110 accesses the functional registers of the battery management unit 120 sequentially via the I2C bus, reading data including but not limited to: battery pack terminal voltage, charging / discharging current, cell temperature, current charging / discharging status flag, overvoltage / undervoltage / overcurrent / overtemperature protection event recording register, fault flag register, and historical fault log cache. The battery management unit 120 internally has multiple registers, each storing different data. Different BMSs use different register addresses, which can be found in their datasheets. For example: Register address 0x09: Stores the original value of the battery terminal voltage; Register address 0x0C: stores the original value of the charging and discharging current; Register address 0x08: Stores the original value of the battery cell temperature; Register address 0x0B: stores the remaining battery power; Register address 0x20: Stores the fault flag bit.
[0046] When the control processing unit 110 needs to obtain the corresponding register data from the battery management unit 120, the implementation steps are as follows: Figure 3 As shown: Step S21: The control processing unit reads the raw data from the register of the battery management unit; Before scanning the registers of the battery management unit 120, the control processing unit 110 configures its built-in I2C, timer, and other modules, and determines the address of the target register of the battery management unit 120. The control processing unit 110 sends the address of the target register to the battery management unit 120 via I2C, informing the battery management unit 120 which register's data to read. After receiving the address of the target register sent by the control processing unit 110, the battery management unit 120 sends the data of the target register to the control processing unit 110 via the I2C bus, and the control processing unit 110 receives and stores the data.
[0047] Step S22: Convert the raw data into physical quantity data, and identify abnormal data to generate the fault data.
[0048] In this step, the control processing unit 110 reads the raw register data, such as binary or hexadecimal values, through the I2C bus interface and temporarily stores it in an internal buffer as the data source for subsequent format conversion. The control processing unit 110 converts the raw register values into data with actual physical meaning according to the conversion rules corresponding to the registers of the battery management unit 120 and the power metering unit 130. For example, the conversion method for voltage data is: physical quantity value (mV) = original register value × conversion factor. For example, if the original value is 16384 and the conversion factor is 0.25mV / LSB, then the physical quantity voltage value is 4096mV. The conversion method for current data is similar; positive values represent discharge current, and negative values represent charging current. Metering data such as cycle count and remaining power are directly read from the register integer values without conversion. After physical quantity conversion, all data are represented in a unified physical quantity unit, facilitating subsequent encapsulation and parsing.
[0049] Step S23: Encapsulate the fault data according to a preset communication protocol format.
[0050] In this step, the control processing unit 110 encapsulates the parsed and processed fault data and assembles the discrete fault data and related auxiliary information into a complete and stable data message according to the preset communication protocol format, so as to ensure that the storage device can accurately identify and parse the data message after it is transmitted through the USB chip 150.
[0051] Step S24: Output the packaged fault data to the USB chip.
[0052] In this embodiment, the control processing unit 110 accesses the registers of the power metering unit 130 sequentially via the I2C bus, reading data including but not limited to: current state of charge, remaining power, full charge capacity, battery cycle count, battery health status, and cumulative charge / discharge energy. The MCU reads the register data from the power metering unit 130 using the steps described above, and will not be repeated here.
[0053] The aforementioned data is stored in the registers of the battery management unit 120 and the power metering unit 130, and does not depend on the normal operating status of the power bank 100's application layer. Therefore, even if the power bank 100 experiences a serious malfunction such as a system crash or freeze, causing the application layer function to fail, the control processing unit 110 can still access the registers of the battery management unit 120 and the power metering unit 130 through the internal communication interface to complete data reading.
[0054] Step S3: Convert the fault data transmitted by the control processing unit into a protocol format so that it can be transmitted through the universal serial bus interface.
[0055] The USB chip 150 performs protocol adaptation on the data packet encapsulated in step S32, converting it into a data frame format that can be transmitted via the Universal Serial Bus interface 140. The specific steps are as follows: Figure 4 As shown: Step S31: Receive the fault data sent by the control processing unit.
[0056] Step S32: Convert the fault data from the first communication protocol format to a second communication protocol format suitable for transmission via the universal serial bus interface.
[0057] The control processing chip 110 and the USB chip 150 are connected via the data line SDA and clock line SCL of the I2C bus. The USB interface (D+, D- pins) of the USB chip 150 is connected to the mobile device or storage device via the USB interface.
[0058] USB chip 150 sends a read request to control processing chip 110. Control processing chip 110 sends packaged fault data to USB chip 150 through the data line SDA of the I2C bus. USB chip 150 receives the data and stores it in its cache.
[0059] After completing I2C data reception, the USB chip 150 checks its own USB interface status to confirm that the USB connection with the mobile device or storage device is normal, and that the mobile device or storage device has completed driver recognition and is in receiving state.
[0060] The USB chip 150 reads the received fault data from the cache and converts the fault data format using a preset communication protocol.
[0061] The first communication protocol format is the communication protocol format between the control processing chip 110 and the USB chip 150. In this embodiment, the first communication protocol format is the I2C bus communication format, and the data is transmitted in bytes through the I2C bus data lines SDA and SCL clock lines.
[0062] The second communication protocol format is a communication protocol format suitable for USB interface transmission. In this embodiment, the USBCDC (Communication Device Class) virtual serial port protocol format is adopted. This format can be automatically recognized by mainstream storage devices such as mobile phones and computers without the need for manual driver installation, and it meets the requirements of full platform compatibility.
[0063] After the format conversion process described above, the original register data of the battery management unit 120 and the power metering unit 130 are finally converted into fault information data that can be directly received, parsed and stored by mobile devices or storage devices.
[0064] Step S4: Transmit the fault information data to the external device to export the fault data.
[0065] After format conversion, the USB chip 150 transmits the fault information data from step S3 to the connected mobile device or storage device via the Universal Serial Bus interface 140. If the target is a mobile device, the mobile device can directly read and display the fault information data through its system file manager or a dedicated application. If the target is a storage device (such as a USB flash drive), the fault information data is written to the storage device's file system in file format. The file naming rules include the power bank model identifier and the export timestamp for easy archiving and traceability.
[0066] After data transmission is complete, the control processing unit 110 verifies the transmission result. If the verification passes, the faulty data is determined to have been successfully exported, and the control indicator light 170 will turn green to provide the user with intuitive feedback on the successful export status. If the verification fails, the indicator light 170 will flash red to indicate a transmission error, and the control processing unit 110 will automatically initiate a retransmission process until the transmission is successful or the maximum number of retries is reached.
[0067] Therefore, the above embodiments of this patent realize the automatic collection and export of fault data of the power bank 100 in a fault state through the complete process of steps S1 to S4. No special debugging tools or drivers are required throughout the process. The operation is simple and suitable for on-site repair and after-sales service scenarios.
[0068] Example 2 Based on Example 1, this embodiment provides a more detailed explanation of how to switch the communication mode by manually switching the power supply mode and data transmission mode of the mobile power supply.
[0069] like Figure 1 As shown, in manual switching mode, the power bank 100 has a button 160 on its casing, which is electrically connected to the control processing unit 110. When a user discovers a malfunction in the power bank 100, they first electrically connect the external device to the power bank 100 via the Universal Serial Bus interface 140. After completing the physical hardware connection, the user sends a communication mode switching command to the control processing unit 110 by operating the button 160, triggering the Universal Serial Bus interface 140 to switch from power supply mode to data transmission mode.
[0070] like Figure 5 As shown, the steps for switching communication modes manually include: Step S11: The power bank is electrically connected to the external device through the Universal Serial Bus interface.
[0071] Step S12: The control processing unit detects the duration of the button press and determines the current operation type based on the duration of the button press.
[0072] Step S13: In response to the operation type, switch the communication mode to the data transmission mode.
[0073] In this embodiment, after the power bank 100 is connected to an external device, the control processing unit 110 uses an internal timer to measure the duration of the button 160 being pressed. The current operation type is determined by measuring the duration of the press. Specific detection steps are as follows: Figure 6 As shown: Step S121: The short press operation is when the duration of pressing the button is less than a preset short press threshold, and the control processing unit responds to the short press operation.
[0074] Step S122: The long press operation is when the duration of pressing the button is greater than a preset long press threshold, and the control processing unit responds to the long press operation.
[0075] When the control processing unit 110 detects that the button 160 is pressed, it immediately starts the internal timer to begin timing; when the control processing unit 110 detects that the button 160 is released, it stops the timer and reads the duration of the button press; then the control processing unit 110 compares the duration with a preset threshold to determine whether the button press operation is a short press or a long press, and executes the subsequent process according to the operation type.
[0076] Specifically, a short press operation is defined as a press duration of button 160 that is less than a preset short press threshold, which is set to 500 milliseconds in this embodiment. After detecting the short press operation, the control processing unit 110 switches the communication mode of the universal serial bus interface 140 from power supply mode to data transmission mode, and immediately triggers the routine fault data export process, i.e., executes steps S2 to S4.
[0077] A long press operation is defined as a duration of pressing button 160 that is greater than or equal to a preset long press threshold, which is set to 2000 milliseconds in this embodiment. After detecting a long press operation, the control processing unit 110 also switches the communication mode of the universal serial bus interface 140 to data transmission mode. The preset thresholds for short press and long press operations can be set according to actual needs; this embodiment is merely illustrative and does not constitute a limitation.
[0078] Furthermore, to prevent false triggering of button 160 due to mechanical jitter, the control processing unit 110 employs a combination of hardware filtering and software delay to debounce the input signal of button 160. Specifically, after detecting a change in the level of button 160, the control processing unit 110 delays for a preset debounce time (set to 20 milliseconds in this embodiment) and then resamples the level state of button 160. If the two sampling results are consistent, it is confirmed as a valid button event and a timer is started. If the two sampling results are inconsistent, it is determined to be jitter interference and the current level change is ignored. The above debounce processing effectively avoids the timer from being falsely started due to mechanical jitter, thereby ensuring the accuracy of short press and long press judgments.
[0079] The manual switching mode is suitable for scenarios where users actively initiate data export. For example, after discovering that the power bank is malfunctioning, users can actively connect their mobile devices or storage devices to the power bank 100 and then trigger the export of fault data through button operation. The operation steps are simple and intuitive, requiring no professional technical background.
[0080] Therefore, the above embodiments of this patent provide a flexible manual mode switching mechanism by integrating a button 160 on the power bank 100 and supporting both short press and long press operation modes, thus meeting the user's need to actively trigger data export in different usage scenarios.
[0081] Example 3 This embodiment, based on Embodiment 1, provides a further detailed explanation of the automatic switching mode in step S1.
[0082] In automatic switching mode, the control processing unit 110 continuously monitors the device connection status on the Universal Serial Bus interface 140. When the Universal Serial Bus interface 140 detects a storage device connection, the control processing unit 110 identifies the type of the connected device and automatically switches the communication mode of the Universal Serial Bus interface 140 to the data transmission mode based on the identification result, without requiring manual button operation by the user.
[0083] like Figure 7 As shown, the steps for switching communication modes via automatic mode switching include: Step S11': The power bank is connected to the external device through the Universal Serial Bus interface.
[0084] Step S12': The control processing unit identifies the device type of the external device.
[0085] Step S13': In response to the device type being the storage device, the communication mode is automatically switched to the data transmission mode.
[0086] Specifically, the control processing unit 110 determines whether an external device is connected by detecting voltage changes on the Universal Serial Bus interface 140 and signal characteristics on the data lines (D+ / D-). In normal power supply mode, the VBUS pin of the Universal Serial Bus interface 140 continuously outputs voltage to power external devices, while the data lines D+ and D- are idle. When a mobile device or storage device is plugged into the Universal Serial Bus interface 140 via a data line, the voltage load on the VBUS pin changes. The voltage detection circuit of the control processing unit 110 collects the voltage fluctuations of the VBUS pin in real time. Once the detected voltage change exceeds a preset detection threshold, it determines that an external device is connected and triggers the subsequent device type identification process.
[0087] After completing the access detection, the control processing unit 110 identifies the device type of the external device, such as... Figure 8 As shown, the step of the control processing unit 110 identifying the device type includes: Step S121': The control processing unit communicates with the external device through the universal serial bus interface and receives handshake information.
[0088] Step S122': Determine the type of the external device based on the handshake information.
[0089] The control processing unit 110 establishes a handshake communication with external devices via the data lines D+ and D- of the Universal Serial Bus interface 140. During the handshake process, the control processing unit 110 reads the USB device descriptor reported by the external device and determines the type of the connected device based on the device category field in the descriptor. If the identification result is a storage device, the control processing unit 110 switches the operating mode of the Universal Serial Bus interface 140 to data transmission mode, automatically triggering steps S2 to S4 to complete the reading, format conversion, and transmission of fault data, without requiring any user intervention throughout the entire process.
[0090] In a preferred embodiment, when the control processing unit 110 simultaneously detects that both the mobile device and the storage device have been connected via the Universal Serial Bus interface 140, the control processing unit 110, after completing the communication mode switch, simultaneously transmits fault information data to both the mobile device and the storage device, achieving the effect of one-time export and dual-channel storage. The fault information data transmitted to the mobile device can be viewed and analyzed in real time by the user through an application on the mobile device; the fault information data written to the storage device is saved in file format, with the filename including the power bank model identifier and the export timestamp, facilitating subsequent archiving and traceability. This dual-channel storage mechanism effectively ensures the integrity of fault data in the event of a single device storage failure.
[0091] The automatic switching mode is suitable for rapid diagnostic scenarios for frontline repair personnel. Repair personnel only need to plug the storage device into the universal serial bus interface 140 of the power bank 100, and the system can automatically complete the collection, conversion, and export of fault data. This highly efficient operation is suitable for time-sensitive scenarios such as batch testing or emergency repairs. Alternatively, users without technical expertise can export fault data themselves and submit it online to after-sales service without needing to mail the power bank to an after-sales store, reducing after-sales time.
[0092] Therefore, the above embodiments of this application realize fully automatic switching of communication mode by controlling the processing unit 110 to monitor the VBUS voltage change on the universal serial bus interface 140 in real time and automatically identify the device type. This avoids the need for manual operation by the user, and greatly improves the convenience and timeliness of operation while ensuring the accuracy of fault data export. It is suitable for a variety of practical application scenarios.
[0093] Example 4 In some practical applications, the power bank 100 may be in a low-battery state when a malfunction occurs. If it only operates in data transmission mode and does not accept external charging at this time, data transmission may be interrupted due to depletion of power, resulting in the loss of faulty data. To solve the above problem, this patent further provides a charging and data transmission mode based on the data transmission mode.
[0094] In the simultaneous charging and data transmission mode, while the power bank 100 establishes a data communication link with an external device through the universal serial bus interface 140, the external charging device (e.g., a charger) charges the power bank 100 through another interface (e.g., a Type-C interface). The control processing unit 110 is responsible for coordinating the priority scheduling of charging management and data transmission: during data transmission, the control processing unit 110 ensures that the charging circuit and the data transmission circuit do not interfere with each other, the charging management unit maintains the normal charging process, and the data transmission module simultaneously maintains the stability of the data communication link of the universal serial bus interface 140.
[0095] In this embodiment, the switching triggering method for the simultaneous charging and data transmission mode is compatible with the manual and automatic switching modes described in Embodiments 2 and 3: the user can manually trigger this mode via button 160, or the control processing unit 110 can automatically identify and enter this mode after simultaneously connecting the charger and the mobile device. When the control processing unit 110 detects a data transmission request on the universal serial bus interface 140 and simultaneously detects a charging signal on the charging interface, it automatically switches to the simultaneous charging and data transmission mode to ensure power supply throughout the data transmission process.
[0096] Therefore, the above embodiments of this patent effectively solve the problem of data export interruption of the power bank 100 in the low power fault state by using the charging and data transmission mode, ensuring the integrity of fault data and improving the reliability of the fault data export solution in extreme scenarios.
[0097] Example 5 Combination Figure 2 - Figure 8 The fault data export method and terminal for mobile power supplies described in the embodiments of the present invention can be implemented by a device. Figure 9 This is a schematic diagram illustrating the hardware structure of a device according to an embodiment of the invention.
[0098] The device may include a processor 901 and a computer storage medium 902 storing computer program instructions.
[0099] Specifically, the processor 901 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.
[0100] Computer storage medium 902 may include a mass storage medium for storing data or instructions. For example, and not limitingly, computer storage medium 902 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, computer storage medium 902 may include removable or non-removable (or fixed) media, or computer storage medium 902 may be a non-volatile solid-state computer storage medium.
[0101] In one instance, the computer storage medium 902 may be a read-only computer storage medium (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0102] In this embodiment, the device is a power bank 100, which includes a computer storage medium 902 and an integrated circuit for exporting data. The method steps for exporting fault data are encapsulated as an executable program and stored in the computer storage medium 902. The integrated circuit for exporting data is an integrated circuit composed of chips such as a control processing unit 110, a battery management unit 120, and a power metering unit 130, serving as the processor 901 of the power bank 100.
[0103] The processor 901 reads and executes computer program instructions stored in the computer storage medium 902 to achieve... Figure 2-8 The method in the illustrated embodiment achieves... Figure 2-8 The example shown demonstrates the corresponding technical effects achieved by executing its methods / steps.
[0104] In one example, the device may also include an input / output interface 903, a communication interface 904, and a bus 905. For example, Figure 9 As shown, the processor 901, computer storage medium 902, input / output interface 903 and communication interface 904 are connected through bus 905 and complete communication with each other.
[0105] The input / output interface 903 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0106] The communication interface 904 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of the present invention.
[0107] Bus 905 includes hardware, software, or both, that couples components of an online data flow metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a Computer Storage Media Bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 905 may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.
[0108] It should also be noted that the exemplary embodiments mentioned in this invention describe methods or systems based on a series of steps or apparatus. However, this invention is not limited to the order of the steps described above; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0109] The above description is merely a preferred embodiment of this patent and is not intended to limit this patent in any way. Although this patent has been disclosed above with reference to preferred embodiments, it is not intended to limit this patent. Any person skilled in the art can make some modifications or alterations to the disclosed technical content to create equivalent embodiments without departing from the scope of this patent's technical solution. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of this patent without departing from the scope of this patent's technical solution shall still fall within the scope of this patent's technical solution.
Claims
1. A fault data export method, applied to a portable power bank, the portable power bank including a control processing unit and a universal serial bus interface, the control processing unit being communicatively connected to the universal serial bus interface, characterized in that, The fault data export method includes the following steps: S1: The power bank communicates with external devices through the universal serial bus interface, switching the communication mode from power supply mode to data transmission mode; S2: Obtain the fault data through the control processing unit; S3: Convert the fault data transmitted by the control processing unit into a protocol format so that it can be transmitted through the universal serial bus interface; S4: Transmit the fault information data to the external device to export the fault data.
2. The fault data export method according to claim 1, characterized in that, In step S1, the communication mode switching method includes manual switching mode and / or automatic switching mode; The manual switching mode is achieved by operating a button located on the power bank to trigger the communication mode and enter the data transmission mode. The automatic switching mode is achieved by establishing communication between the power bank and the external device, triggering the communication mode to enter the data transmission mode.
3. The fault data export method according to claim 2, characterized in that, The steps for switching the communication mode via the manual switching mode include: The power bank is electrically connected to the external device via the Universal Serial Bus interface; The control processing unit detects the duration of the button press and determines the current operation type based on the duration of the button press. In response to the operation type, the communication mode is switched to the data transmission mode.
4. The fault data export method according to claim 3, characterized in that, The operation types include short press or long press; The short press operation is when the duration of pressing the button is less than a preset short press threshold, and the control processing unit responds to the short press operation. The long press operation is defined as the duration of pressing the button being greater than a preset long press threshold, and the control processing unit responds to the long press operation.
5. The fault data export method according to claim 2, wherein the device type of the external device includes mobile devices and storage devices, characterized in that, The power bank is connected to the external device via the Universal Serial Bus interface; The control processing unit identifies the device type of the external device; In response to the device type being the storage device, the communication mode is automatically switched to the data transmission mode.
6. The fault data export method according to claim 5, characterized in that, The step of the control processing unit identifying the device type includes: The control processing unit communicates with the external device via the universal serial bus interface and receives handshake information. The type of the external device is determined based on the handshake information.
7. The fault data export method according to claim 1, wherein the power bank further comprises a battery management unit and a USB chip, and the control processing unit is communicatively connected to the battery management unit and the USB chip respectively, characterized in that, The step of acquiring the fault data through the control processing unit includes: The control processing unit reads the raw data from the registers of the battery management unit; The raw data is converted into physical quantity data, and abnormal data is identified to generate the fault data; The fault data is encapsulated according to a preset communication protocol format; The packaged fault data is output to the USB chip.
8. The fault data export method according to claim 1, characterized in that, The step of converting the protocol format of the fault data transmitted by the control processing unit includes: Receive the fault data sent by the control processing unit; The fault data is converted from a first communication protocol format to a second communication protocol format suitable for transmission via the universal serial bus interface.
9. The fault data export method according to claim 1, wherein the power bank is equipped with an indicator light, characterized in that, In step S4, the fault data is successfully exported, and the indicator light displays a preset color.
10. The fault data export method according to claim 1, characterized in that, The communication mode also includes a charging while transmitting data mode, so that the power bank charges while transmitting data.
11. An export circuit based on the fault data export method as described in any one of claims 1-10, characterized in that, The output circuit includes a control processing unit, a battery management unit, a USB chip, and a universal serial bus interface. The control processing unit is connected to the battery management unit and the USB chip via an internal communication protocol interface bus. The universal serial bus interface is connected to the control processing unit via the USB chip. The universal serial bus interface is used to communicate with the external device. The control processing unit is used to read the register data of the battery management unit and obtain the fault data; The USB chip is used to convert the fault data transmitted by the control processing unit into a protocol format and transmit the converted fault data to the external device.
12. A portable power bank, comprising a computer storage medium and a discharge circuit as described in claim 11, wherein the computer storage medium is communicatively connected to the discharge circuit, and the computer storage medium stores a computer program, characterized in that... The export circuit is configured to implement the steps of the fault data export method according to any one of claims 1-10 when executing the computer program.