Method and device for processing voltameter integrated circuit (IC), equipment and storage medium
By sending CMD commands to the meter IC in the terminal device and acquiring the result data after waiting for the execution time, the problem of data collision between the terminal device and the meter IC is solved, and data accuracy and command execution success rate are improved.
Patent Information
- Application Number
- CN202510098610.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-16
AI Technical Summary
When the terminal device interacts with the power meter integrated circuit IC, data packet collision may occur, resulting in data disorder and command execution failure. How to improve the accuracy of interactive data is an urgent problem.
In the terminal device, a target CMD command is sent to the battery meter IC, and after the preset target execution time, execution result data is obtained from the battery meter IC, and the corresponding relationship between the preset CMD command and the execution time is determined whether the CMD command is successfully executed.
By acquiring execution result data after waiting for the target execution time, the data accuracy of the terminal device and the battery meter IC is improved, and the success rate of command execution is improved.
Smart Images

Figure CN120011018A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of integrated circuit technology, and relate to but are not limited to a processing method and device, equipment, and storage medium for an electric meter integrated circuit IC. Background Art
[0002] In the current related technologies, during the interaction between the application processor (AP) in the terminal device and the integrated circuit (IC) of the electric meter, since the electric meter IC has no interrupt method, the AP can only use the polling method to check the "result status" during the polling. When the polling method is used to obtain the command execution result data, there may be a "data collision" phenomenon. For example, the AP polls every 20ms, and when the IC receives the data read request, the data is not ready. However, when the IC is returning the unprepared data to the AP, the calculation result of the IC is suddenly ready, and then the data will be updated, which will cause data confusion and then cause the command execution to fail.
[0003] Therefore, how to improve the accuracy of data interacting between terminal equipment and the power meter IC is an urgent problem to be solved. Summary of the invention
[0004] The processing method, device, equipment, and storage medium of the fuel gauge integrated circuit IC provided in the embodiment of the present application can improve the accuracy of the data interacted between the terminal device and the fuel gauge IC. The processing method, device, equipment, and storage medium of the fuel gauge integrated circuit IC provided in the embodiment of the present application are implemented as follows:
[0005] The processing method of the fuel gauge integrated circuit IC provided in the embodiment of the present application is applied to a terminal device, wherein the terminal device includes a fuel gauge IC, and the method includes: sending a target command prompt CMD command to the fuel gauge IC; after waiting for the target execution time, obtaining target execution result data of executing the target CMD command from the fuel gauge IC, wherein the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; and determining whether the target CMD command is executed successfully according to the target execution result data.
[0006] The processing device of the fuel gauge integrated circuit IC provided in the embodiment of the present application is applied to a terminal device, wherein the terminal device includes a fuel gauge IC, and the device includes: a sending module, used to send a target command prompt CMD command to the fuel gauge IC; an acquisition module, used to acquire target execution result data of executing the target CMD command from the fuel gauge IC after waiting for the target execution time, wherein the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; a determination module, used to determine whether the target CMD command is executed successfully based on the target execution result data.
[0007] The computer device provided in the embodiment of the present application includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the method described in the embodiment of the present application is implemented.
[0008] The computer-readable storage medium provided in the embodiment of the present application stores a computer program thereon, and when the computer program is executed by a processor, the method provided in the embodiment of the present application is implemented.
[0009] The computer program product provided in the embodiments of the present application includes a computer program, and when the computer program is executed by a processor, the method provided in the embodiments of the present application is implemented.
[0010] In the processing method, device, equipment, and storage medium of the fuel gauge integrated circuit IC provided in the embodiment of the present application, the terminal device first sends a target CMD command to the fuel gauge IC, and then obtains the target execution result data of executing the target CMD command from the fuel gauge IC after waiting for the target execution time. The terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; finally, according to the target execution result data, it is determined whether the target CMD command is successfully executed. In the processing method of the fuel gauge integrated circuit IC, by obtaining the target execution result data of executing the target CMD command from the fuel gauge IC after waiting for the target execution time, the accuracy of the data exchanged between the terminal device and the fuel gauge IC can be improved, thereby improving the success rate of command execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0012] Figure 1 A schematic diagram of the system architecture of a terminal device provided for one embodiment of the present application;
[0013] Figure 2A schematic diagram of an implementation flow of a processing method for an electric meter integrated circuit IC provided by an embodiment of the present application;
[0014] Figure 3 A schematic diagram of an implementation flow of a processing method of an electric meter integrated circuit IC provided by another embodiment of the present application;
[0015] Figure 4 A schematic diagram of an implementation flow of a processing method of an electric meter integrated circuit IC provided in yet another embodiment of the present application;
[0016] Figure 5 An exemplary flowchart of a processing method of a fuel gauge IC provided by an embodiment of the present application;
[0017] Figure 6 A structural schematic diagram of a processing device of an electric meter integrated circuit IC provided by one embodiment of the present application;
[0018] Figure 7 A structural schematic diagram of a computer device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the specific technical scheme of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0021] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0022] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0023] In the current related technologies, many projects use the built-in power meter of the Qualcomm platform or MTK platform, and use the power meter integrated circuit (IC) to manage the battery cells. Its main work is to output the battery power by collecting battery voltage, battery current, and battery temperature information. However, for high-power charging, such as greater than 30w, it is necessary to determine whether it is a legal battery. The corresponding platform power meter needs to add a low-cost IC that simply performs battery authentication encryption. The encryption IC usually used is a single bus, and its timing is not based on a standard open protocol. The timing of the single bus is completely controlled by software. This is not "friendly" to the multi-tasking operating system of the mobile terminal, and special processing is required in the Linux kernel operating system, such as holding the central processing unit (CPU) lock, prohibiting CPU preemption, etc. Even so, the timing may not meet the single bus encryption requirements and will fail probabilistically. Therefore, the encryption IC of the single bus is currently done in the bootloader of the mobile terminal, and then the encryption result is passed to the kernel through shared memory. In other words, the timing of a single bus is completely controlled by software. If the system freezes for some reason, encryption will fail. Therefore, in order to improve data security, an encryption IC based on serial communication protocol (Inter-Integrated Circuit, I2C) bus encryption can be used.
[0024] The encryption IC based on I2C bus encryption uses the industry-wide elliptic curve digital signature (ecdsa) algorithm and elliptic curve encryption (ecw) algorithm. The command prompt (CMD) commands used include ecdsa, ecw, and CMD for operating IC memory. The data exchange length of different CMDs is different, so each CMD read reads a fixed 256 bytes, which includes the following parts in Table 1:
[0025] Table 1
[0026]
[0027] Among them, the first one is the data length of 1 byte, whose value is equal to n+1, including the total length of the result status and the real data. The result status occupies 1 byte, which indicates the status of the IC's execution of CMD. For example, result = 0x11 means that the device is always busy (device busy), and result = 0x22 means that the command is executed successfully and other status results. The data occupies n bytes, such as this ecdsa command, where n is equal to 128 bytes. The cyclic redundancy check (CRC) is 2 bytes. Before transmitting the result status and data, the IC uses the result status and data to calculate the two-byte value.
[0028] Furthermore, when the application processor (AP) of the subsequent terminal device interacts with the power meter IC, after receiving the data, it will use the same formula to calculate the CRC check value of the data, and then compare the CRC check value in the IC. If the comparison is consistent, it indicates that the data transmission is successful.
[0029] Since the fuel gauge IC has no interrupt mode, the AP can only use the polling mode. During polling, check the "result status". If the result status is result = 0x22, find the data end address and the start address of the CRC check value according to the data length, calculate the CRC check value according to the obtained result status and data, and then compare it with the obtained CRC check value. If the comparison does not match, it is considered that the command execution has failed, and the data will be sent back to the server.
[0030] Since the method of polling at a prescribed time of 20ms is usually used to check whether the result is successful, and the maximum waiting time is 200ms, that is, 10 attempts, the existing power meter IC solution may cause the phenomenon of "data packet collision". For example, the AP polls every 20ms, and when the IC receives a data read request, the data is not ready. However, when the IC is returning the unprepared data to the AP, the IC's calculation result is suddenly ready, and then the data will be updated, which will cause data confusion and then cause the command execution to fail.
[0031] For example, when the mobile phone AP accesses the ecdsa signature verification result of the encryption IC, since the typical time for ecdsa calculation is 100ms, the AP will poll every 20ms in 100ms to see if the result is good. The IC will reply (0x01-0x11-0x4b-0x62), indicating that 1 byte of data has been received, and the value of result is 0x11. 0x4b and 0x62 are the CRC check values for 0x11. 0x11 indicates that the IC is still calculating and the device is busy. If the result is calculated after the IC replies to the length 0x01, the data sent back to the AP will become (0x01-0x22-128 bytes of data-2 bytes of CRC check value). After receiving the data, the AP finds that the result status is 0x22, which is OK, and then uses the length 0x01 to guide the search for data and the CRC check value passed by the IC, and compares them. This situation will inevitably fail.
[0032] Therefore, how to improve the accuracy of data interacting between terminal equipment and the power meter IC is an urgent problem to be solved.
[0033] In view of this, an embodiment of the present application provides a method for processing an electric meter integrated circuit IC, which is applied to a terminal device, wherein the terminal device includes an electric meter IC, and the method specifically includes: sending a target CMD command to the electric meter IC, and then obtaining target execution result data of executing the target CMD command from the electric meter IC after waiting for the target execution time, wherein the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; and finally, determining whether the target CMD command is successfully executed based on the target execution result data. In the method for processing the electric meter integrated circuit IC of the present application, by obtaining the target execution result data of executing the target CMD command from the electric meter IC after waiting for the target execution time, the accuracy of the data interacting between the terminal device and the electric meter IC can be improved, thereby improving the success rate of command execution.
[0034] It should be understood that the terminal device involved in the embodiments of the present application may be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a smart screen, an artificial intelligence (AI) speaker, a headset, a terminal in industrial control, a terminal in self driving, a terminal in remote medical surgery, a terminal in a smart grid, a terminal in transportation safety, a terminal in a smart city, a terminal in a smart home, a personal digital assistant (PDA), etc., and the embodiments of the present application are not limited to this.
[0035] For example, Figure 1 A schematic diagram of the system architecture of a terminal device provided in one embodiment of the present application. Figure 1 As shown, the terminal device includes components such as a processor 110, a memory 120, a transceiver 130, a display unit 140, an input unit 150, and a power module 160.
[0036] The processor 110 is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, the processor 110 performs various functions of the terminal device and processes data, thereby monitoring the terminal device as a whole. Optionally, the processor 110 may include one or more processing units; optionally, the processor 110 may integrate an application processor, which mainly processes operating devices, user interfaces, and application programs, etc. Of course, other processors may also be included, which are not listed here one by one.
[0037] The memory 120 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing of the terminal device by running the software programs and modules stored in the memory 120. The memory 120 mainly includes a program storage area and a data storage area, wherein the program storage area can store operating devices, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the terminal device (such as audio data, a phone book, etc.), etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0038] The transceiver 130 can provide wireless communication solutions for terminal devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The transceiver 130 can be one or more devices integrating at least one communication processing module, for example, an antenna and a baseband processor are integrated into the transceiver 130, or an antenna and a modem processor are integrated into the transceiver 130, etc., which are not limited here.
[0039] The display unit 140 can be used to display information input by the user or information provided to the user and various menus of the terminal device. The display unit 140 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc., which is not limited here.
[0040] The input unit 150 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the terminal device. Specifically, the input unit 150 can collect the user's operations on or near it, and drive the corresponding connection device according to a pre-set program. In addition, the input unit 150 may include a touch panel, which can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel, the input unit 150 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of function keys (such as volume control keys, switch keys, etc.), trackballs, joysticks, etc.
[0041] The terminal device also includes a power module 160 for supplying power to various components. Optionally, the power module 160 can be logically connected to the processor 110 through a power management device, so that functions such as charging, discharging, and power consumption management can be managed through the power management device.
[0042] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0043] In order to make the purpose and technical solution of the present application clearer and more intuitive, the processing method, device, equipment, and storage medium of the electric meter integrated circuit IC provided in the embodiment of the present application will be described in detail below in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] Please refer to Figure 2 , is a schematic diagram of an implementation flow of a processing method for an electric meter integrated circuit IC provided in an embodiment of the present application. The method can be applied to Figure 1 The terminal device shown in the embodiment of the present application is an AP Figure 1 The processor 110 shown in FIG. 1 is located at Figure 1 In the power module 160 shown in FIG. Figure 2 As shown, the method may include the following steps 201 to 203:
[0045] Step 201: Send a target CMD command to the fuel gauge IC.
[0046] It should be noted that the method of sending the CMD command in the embodiment of the present application is implemented through the I2C bus, usually by specifying the register address and sending the command and data.
[0047] As an example, the process of sending a CMD command using the I2C protocol may include the following steps: selecting an I2C address, writing the register address of the target CMD command, and finally sending the CMD command and any related data (such as parameters).
[0048] In some embodiments, the fuel gauge IC is typically used to monitor the battery charge, health, voltage, and temperature, etc. The AP in the terminal device can interact with the fuel gauge IC, such as sending control commands or instructions to the fuel gauge IC. These commands may involve different operations, such as setting battery charge thresholds, obtaining battery status, calibrating batteries, etc.
[0049] Optionally, the target CMD command may be a specific instruction used to execute the operation of the fuel gauge IC. Different commands correspond to different functions, for example, reading the battery voltage, obtaining the current battery charging status, starting battery calibration, setting thresholds and warnings, and obtaining the remaining battery capacity, etc., which is not limited in this application.
[0050] In some embodiments, the terminal device sends a target CMD command to the fuel gauge IC. Accordingly, the fuel gauge IC usually responds to the received target CMD command, which may be to confirm that the command has been received or to return data, such as battery voltage, remaining capacity, etc., to ensure that the response data is read and processed.
[0051] Step 202, after waiting for the target execution time, obtain the target execution result data of executing the target CMD command from the power meter IC. The terminal device has preset correspondences between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command.
[0052] In some embodiments, the terminal device presets a correspondence between different CMD commands and different execution times. For example, an array, a dictionary, or a table may be created, wherein each CMD command corresponds to an execution time, which may also be referred to as a typical execution time. Generally, after the execution time, the command is executed.
[0053] Exemplarily, assuming that the correspondence between different CMD commands preset in the terminal device and different execution durations is presented in a table form, the table may be as shown in Table 2 below:
[0054] Table 2
[0055] Command Name Execution time CMD_1 100 ms CMD_2 50 ms … … CMD_n 20 ms
[0056] In some embodiments, after waiting for the target execution time, the terminal device reads the target execution result data from the fuel gauge IC, and the fuel gauge IC stores the target execution result data and provides it to the terminal device via I2C.
[0057] Step 203, determining whether the target CMD command is executed successfully based on the target execution result data.
[0058] In some embodiments, the target execution result data of the target CMD command executed by the fuel gauge IC may include the result status of the command execution, such as whether the execution is completed or not, the result data and the corresponding CRC check data, etc. Accordingly, after obtaining the target execution result data, the terminal device may check it and finally determine whether the target CMD command is executed successfully.
[0059] Exemplarily, assuming that the target execution result data includes result status, result data and CRC check value, after receiving the target execution result data, the terminal device can calculate a new CRC check value based on the result status and result data, and then compare the new CRC check value with the obtained CRC check value. If the comparison is successful, it indicates that the data transmission is successful, and accordingly, the command is also executed successfully.
[0060] In this embodiment, the terminal device sends a target CMD command to the power meter IC, and then obtains the target execution result data of executing the target CMD command from the power meter IC after waiting for the target execution time. The terminal device presets the correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; finally, according to the target execution result data, it is determined whether the target CMD command is successfully executed. In the processing method of the power meter integrated circuit IC of the present application, by obtaining the target execution result data of executing the target CMD command from the power meter IC after waiting for the target execution time, the accuracy of the data exchanged between the terminal device and the power meter IC can be improved, thereby improving the success rate of command execution.
[0061] Based on the above embodiments, Figure 3 A schematic diagram of an implementation flow of a processing method of an electric meter integrated circuit IC provided in another embodiment of the present application is shown in FIG. Figure 3 As shown, the method may include the following steps 301 to 305:
[0062] Step 301: Send a target CMD command to the fuel gauge IC.
[0063] It should be noted that the method of sending the CMD command in the embodiment of the present application is implemented through the I2C bus, usually by specifying the register address and sending the command and data.
[0064] In some embodiments, the fuel gauge IC is typically used to monitor the battery charge, health, voltage, and temperature, etc. The AP in the terminal device can interact with the fuel gauge IC, such as sending control commands or instructions to the fuel gauge IC. These commands may involve different operations, such as setting battery charge thresholds, obtaining battery status, calibrating batteries, etc.
[0065] In some embodiments, the terminal device sends a target CMD command to the fuel gauge IC. Accordingly, the fuel gauge IC usually responds to the received target CMD command, which may be to confirm that the command has been received or to return data, such as battery voltage, remaining capacity, etc., to ensure that the response data is read and processed.
[0066] Step 302, after waiting for the target execution time, obtain the target execution result data of executing the target CMD command from the power meter IC. The terminal device presets the correspondence between different CMD commands and different execution times. The target execution time corresponds to the target CMD command. The target execution result data includes first sub-data and second sub-data, and the second sub-data is used to indicate the first CRC check value.
[0067] In some embodiments, the terminal device presets a correspondence between different CMD commands and different execution times. For example, an array, a dictionary, or a table may be created, wherein each CMD command corresponds to an execution time, which may also be referred to as a typical execution time. Generally, after the execution time, the command is executed.
[0068] In some embodiments, after waiting for the target execution time, the terminal device reads the target execution result data from the fuel gauge IC, and the fuel gauge IC stores the target execution result data and provides it to the terminal device via I2C.
[0069] In a possible implementation, the first sub-data may include data length, result status and result data, wherein the data length is the total length including the result status and the actual result data, the result status indicates the state of the IC executing CMD, for example, result = 0x11 indicates that the device is always busy (device busy), result = 0x22 indicates that the command is successfully executed and other status results, and the result data is the data obtained after the command is executed. The second sub-data is used to indicate the first CRC check value, which is the value calculated by the fuel gauge IC using the result status and result data before transmitting the result status and result data. For example, the fuel gauge IC performs CRC calculation on each input byte, and performs XOR operation on each byte bit by bit according to the algorithm; if the transmitted data stream is long, the CRC algorithm will operate on each byte in turn until the calculation is completed.
[0070] Step 303: Calculate and obtain a second CRC check value according to the first sub-data.
[0071] In some embodiments, after obtaining the target execution result data, the terminal device calculates a second CRC check value based on the first sub-data therein. For example, when the first sub-data includes data length, result status and result data, the terminal device can first find the end position of the result data based on the data length, determine the result data, and then perform a CRC algorithm calculation based on the result status and result data to obtain a second CRC check value.
[0072] Step 304: compare the first CRC check value and the second CRC check value.
[0073] Step 305: When the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, determine whether the target CMD command is executed successfully according to the number of checks on the first CRC check value.
[0074] In some embodiments, when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has been verified, it is determined that the target CMD command execution has failed. That is to say, if the first CRC check value has been verified, a mark that the first CRC check value has been verified is stored in the terminal device. At this time, when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and there is a mark in the terminal device that the first CRC check value has been verified, then there may be a problem with the transmitted data, and the target CMD command execution is considered to have failed. Furthermore, the terminal device can record the value of the result status and transmit it back to the tracking server.
[0075] In some embodiments, when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has not been verified, new execution result data corresponding to the target CMD command is obtained from the fuel gauge IC again; the new execution result data is verified, and based on the verification result of the new execution result data, it is determined whether the target CMD command is executed successfully.
[0076] Among them, the implementation method of the terminal device obtaining new execution result data corresponding to the target CMD command from the power meter IC again can be as follows: when the waiting time for obtaining the target execution result data is less than or equal to the preset time threshold, the terminal device obtains new execution result data from the power meter IC again; or, after updating the preset time threshold to the target time threshold, the terminal device obtains new execution result data from the power meter IC again, and the target time threshold is greater than the preset time threshold.
[0077] That is to say, when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has not been verified, it is possible that the "data packet collision" caused the CRC check value to be abnormal and the comparison failed, so the new execution result data corresponding to the target CMD command can be obtained from the power meter IC again, and then the new execution result data can be verified. For example, the new execution result data includes the third sub-data and the fourth sub-data, and the fourth sub-data is used to indicate the third CRC check value calculated by the power meter IC. After the terminal device obtains the new execution result data, it performs CRC algorithm calculation according to the third sub-data to obtain the fourth CRC check value, and compares the third CRC check value with the fourth CRC check value. When the third CRC check value and the fourth CRC check value are consistent, it is determined that the target CMD command is executed successfully; when the third CRC check value and the fourth CRC check value are inconsistent, it is determined that the target CMD command fails to execute.
[0078] Exemplarily, assuming that the preset time threshold is 200 milliseconds, the terminal device can obtain new execution result data from the power meter IC again when the waiting time for obtaining the target execution result data is less than or equal to 200 milliseconds; or 200 milliseconds can be updated, for example, set to 201 milliseconds, and then obtain new execution result data from the power meter IC again.
[0079] In a possible implementation, when the comparison result indicates that the first CRC check value and the second CRC check value are consistent, it is determined that the target CMD command is executed successfully.
[0080] It should be noted that, in the case where the first sub-data includes data length, result status and result data, the terminal device in the above embodiment performs CRC algorithm calculation based on the result status and result data, and the premise for obtaining the CRC check value is that the result status indicates that the target CMD command has been executed. If the result status indicates that the target CMD command has not been executed, that is, it is in a busy state, then you can first determine whether the current waiting time of the terminal device exceeds the preset time threshold for command execution. If it exceeds, it means that the power meter IC has not been executed after waiting for a sufficient limit time. At this time, it is considered that the target CMD command has failed to execute, and then the terminal device records the value of the result status and transmits it back to the burying point server. If the current waiting time of the terminal device does not exceed the preset time threshold for command execution, you can continue to wait for the preset time, re-acquire new execution result data, and then verify.
[0081] In this embodiment, the terminal device first sends a target CMD command to the power meter IC, and then obtains the target execution result data of executing the target CMD command from the power meter IC after waiting for the target execution time. The terminal device presets a correspondence between different CMD commands and different execution times. The target execution time corresponds to the target CMD command. The target execution result data includes first sub-data and second sub-data. The second sub-data is used to indicate a first CRC check value, and then the second CRC check value is calculated based on the first sub-data, and the first CRC check value and the second CRC check value are compared. When the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, it is determined whether the target CMD command is successfully executed based on the number of checks on the first CRC check value. In the processing method of the electric meter integrated circuit IC, by obtaining the target execution result data of the target CMD command from the electric meter IC after waiting for the target execution time, the accuracy of the data exchanged between the terminal device and the electric meter IC can be improved; by introducing the CRC check mechanism, the terminal device can effectively detect whether an error has occurred in the data transmission process, especially when comparing the first CRC check value and the second CRC check value, if the two values are inconsistent, then further combined with the number of checks on the first CRC check value, it can be determined that the data is damaged or the transmission error exists, thereby effectively reducing the occurrence of data errors and improving the stability of the overall system; by judging whether the target CMD command is successfully executed through the number of checks, it can be intelligently determined whether the command needs to be retried based on the historical check records. This dynamic adjustment method based on the number of times can not only improve the fault tolerance capability, but also avoid premature or unnecessary retries, reduce unnecessary resource consumption, and enable the terminal device to perform tasks more stably, avoid execution failures due to occasional transmission errors or device instability, and thus improve the overall reliability of the system.
[0082] Based on the above embodiments, Figure 4 A schematic diagram of an implementation flow of a processing method for an electric meter integrated circuit IC provided in another embodiment of the present application, in which the target CMD command is any command in the target operation, and the target operation includes one or more commands as an example, Figure 4 As shown, the method may include the following steps 401 to 407:
[0083] Step 401, turning on the CPU power lock in the terminal device, the CPU power lock is used to control the terminal device to continue running and not enter a sleep state.
[0084] It should be noted that since the Linux system of the mobile terminal is a multi-tasking operating system, the system may fall asleep between CMDs, causing the entire operation to fail. Therefore, you can turn on the CPU power lock in the terminal device to ensure that the system does not sleep and ensure the normal execution of the command.
[0085] In some embodiments, when there is no CPU power lock, the terminal device may enter energy-saving mode or sleep state, especially when there is no external input for a long time. After turning on the CPU power lock, the CPU will continue to run to ensure that the terminal device can always respond to external commands when needed without interrupting or delaying tasks due to sleep. At the same time, for some tasks that require real-time processing, such as data transmission, device control, or sensor monitoring, the terminal device must avoid sleep to ensure the continuity and stability of the task. The CPU power lock can ensure that the device maintains efficient operation throughout the execution cycle and is not affected by any unexpected sleep state. In this way, the reliability of the system and the accuracy of task completion are guaranteed, avoiding the situation where commands cannot be responded to or data cannot be processed in time due to sleep.
[0086] Optionally, although enabling the CPU power lock can improve system stability and response speed, you also need to pay attention to the energy consumption issues it may cause. When the CPU is working continuously, it consumes a lot of energy. Therefore, in some cases, the system may need to decide whether to enable the CPU power lock based on the priority of the task, so as to balance system performance and energy efficiency and meet user needs.
[0087] Step 402: Send a target CMD command to the fuel gauge IC.
[0088] It should be noted that the method of sending the CMD command in the embodiment of the present application is implemented through the I2C bus, usually by specifying the register address and sending the command and data.
[0089] In some embodiments, the fuel gauge IC is typically used to monitor the battery charge, health, voltage, and temperature, etc. The AP in the terminal device can interact with the fuel gauge IC, such as sending control commands or instructions to the fuel gauge IC. These commands may involve different operations, such as setting battery charge thresholds, obtaining battery status, calibrating batteries, etc.
[0090] In some embodiments, the terminal device sends a target CMD command to the fuel gauge IC. Accordingly, the fuel gauge IC usually responds to the received target CMD command, which may be to confirm that the command has been received or to return data, such as battery voltage, remaining capacity, etc., to ensure that the response data is read and processed.
[0091] It should be noted that the terminal device can also send a target operation request to the electricity meter IC. The target operation corresponding to the target operation request includes one or more commands, and the target CMD command is any command in the target operation. At the same time, each CMD command in the target operation can be uniformly executed through a preset operation. For example, the actions of the interactive commands CMD_1 to CMD_n are uniformly executed through "a certain CMD operation process".
[0092] Exemplarily, the target operation may be an ecdsa operation, which may include three CMD commands: a CMD for obtaining a hardware identification code (ID), a CMD for executing ecdsa, and a CMD for obtaining signature information.
[0093] Step 403: Control the data related to the target CMD command in the fuel gauge IC to be in a read-only state.
[0094] In some embodiments, the data related to the target CMD command in the control fuel gauge IC is in a read-only state, and external commands or systems cannot modify these data, which can avoid data modification at critical moments as much as possible, ensuring the stability and security of the system.
[0095] Step 404, after waiting for the target execution time, obtain the target execution result data of executing the target CMD command from the power meter IC, the terminal device has preset correspondences between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command.
[0096] In some embodiments, the terminal device presets a correspondence between different CMD commands and different execution times. For example, an array, a dictionary, or a table may be created, wherein each CMD command corresponds to an execution time, which may also be referred to as a typical execution time. Generally, after the execution time, the command is executed.
[0097] In some embodiments, after waiting for the target execution time, the terminal device reads the target execution result data from the fuel gauge IC, and the fuel gauge IC stores the target execution result data and provides it to the terminal device via I2C.
[0098] Step 405 , controlling the data related to the target CMD command in the fuel gauge IC to be in a read-write state.
[0099] In some embodiments, after the terminal device interacts with the fuel meter IC, the fuel meter IC can update relevant data, that is, control the data related to the target CMD command in the fuel meter IC to be in a read and write state, thereby allowing the device or controller to change, configure or update the relevant data in order to adjust the battery status or parameters.
[0100] Step 406, determining whether the target CMD command is executed successfully based on the target execution result data.
[0101] In some embodiments, the target execution result data of the target CMD command executed by the fuel gauge IC may include the result status of the command execution, such as whether the execution is completed or not, the result data and the corresponding CRC check data, etc. Accordingly, after obtaining the target execution result data, the terminal device may check it and finally determine whether the target CMD command is executed successfully.
[0102] Exemplarily, assuming that the target execution result data includes result status, result data and CRC check value, after receiving the target execution result data, the terminal device can calculate a new CRC check value based on the result status and result data, and then compare the new CRC check value with the obtained CRC check value. If the comparison is successful, it indicates that the data transmission is successful, and accordingly, the command is also executed successfully.
[0103] Step 407: When all commands in the target operation are executed, turn off the CPU power lock.
[0104] In some embodiments, if there are multiple CMD commands in the target operation, the CPU power lock can be released after all CMD commands are executed so that the system can sleep and wake up normally, reducing unnecessary power consumption.
[0105] In this embodiment, the terminal device first turns on the CPU power lock in the terminal device, and the CPU power lock is used to control the terminal device to continue running and not enter a sleep state. Then, a target CMD command is sent to the power meter IC to control the data related to the target CMD command in the power meter IC to be in a read-only state, and after waiting for the target execution time, the target execution result data of executing the target CMD command is obtained from the power meter IC. Further, the data related to the target CMD command in the power meter IC is controlled to be in a read-write state. Finally, according to the target execution result data, it is determined whether the target CMD command is executed successfully, and when all commands in the target operation are executed, the CPU power lock is turned off. Turning on the CPU power lock in the terminal device can ensure that the CPU of the device continues to work and avoid entering sleep mode. This can ensure that the device is not interrupted during the execution of commands, avoid operation failures or delays caused by sleep, and ensure stable execution of commands; by controlling the data in the fuel gauge IC to enter read-only mode, accidental data modification during execution can be avoided, ensuring that the target execution result data obtained is accurate and secure; after waiting for the target execution time, the target execution result data of the target CMD command is obtained from the fuel gauge IC, which can improve the accuracy of the data exchanged between the terminal device and the fuel gauge IC; by turning off the power lock, energy can be saved, avoiding keeping the CPU running for a long time, and increasing the energy efficiency of the device.
[0106] Based on the above examples, please refer to Figure 5 , is an exemplary flow chart of a method for processing an electric meter IC provided by an embodiment of the present application. In this embodiment, the target operation is an operation between an AP of a terminal device and an electric meter IC, and the operation includes multiple CMD commands, namely CMD_1 to CMD_n, as an example. The specific process is as follows Figure 5 As shown:
[0107] In step 501, a certain operation between the AP and the fuel gauge IC begins.
[0108] Step 502, turn on the CPU power lock.
[0109] Step 503, interacting CMD_1 to CMD_n.
[0110] Step 504, turn off the CPU power lock.
[0111] Step 505: a certain operation between the AP and the fuel gauge IC ends.
[0112] The detailed implementation process of step 503 is as follows:
[0113] Step 5031, unify the operation target CMD command.
[0114] The target CMD command is any one of the commands CMD_1 to CMD_n.
[0115] Step 5032, sending the target CMD command to the fuel gauge IC.
[0116] Step 5033, obtain the target execution time of the target CMD command.
[0117] In some embodiments, the terminal device has preset correspondences between different CMD commands and different execution times, such as CMD_1 corresponds to 100ms, CMD_2 corresponds to 50ms, ..., CMD_n corresponds to 20ms, and the target execution time corresponds to the target CMD command.
[0118] Step 5034, wait for the target execution time, obtain the target execution result data of the target CMD command from the power meter IC, and parse out the data length, result status, result data and CRC check value.
[0119] Step 5035, determine whether the result status indicates that the command execution is completed. If the result status indicates that the command execution is completed, execute step 5036; otherwise, execute step 50312.
[0120] Step 5036, calculate the AP_CRC check value according to the result status and the result data, and compare the AP_CRC check value with the CRC check value of the fuel gauge IC.
[0121] Step 5037, determine whether the comparison is consistent. If the AP_CRC check value and the CRC check value of the power meter IC are consistent, execute step 5038, otherwise execute step 5039.
[0122] Step 5038, the target CMD command is executed successfully.
[0123] Step 5039, determine whether the CRC check value of the fuel gauge IC has been compared once. If it has been compared once, execute step 50313, otherwise, execute step 50310.
[0124] Step 50310, set the preset duration threshold as the target duration threshold, and continue to wait for the preset duration.
[0125] Exemplarily, if the preset duration threshold is 200 milliseconds, the target duration threshold may be 201 milliseconds, and the preset duration may be 20 milliseconds.
[0126] Step 50311, obtaining the new execution result data from the fuel gauge IC again, and executing step 5035 again.
[0127] Step 50312, determine whether the waiting time exceeds the preset time threshold. If the waiting time exceeds the preset time threshold, execute step 50313, otherwise, execute step 50314.
[0128] Step 50313, the target CMD command fails to execute, the result status is recorded, and the tracking point is returned.
[0129] Step 50314, continue to wait for the preset time, and then return to step 50311, and obtain the new execution result data from the power meter IC again.
[0130] It should be noted that the specific implementation methods of the steps in this embodiment can refer to the above Figures 2 to 4 The method in the illustrated embodiment will not be described in detail in this application.
[0131] In this embodiment, by introducing the CRC check mechanism, the terminal device can effectively detect whether an error occurs in the data transmission process, especially when the comparison check value is inconsistent, it can be judged that the data is damaged or the transmission error exists, thereby effectively reducing the occurrence of data errors and improving the stability of the overall system; when comparing the CRC check value, the target CMD command is judged by the number of checks to determine whether it is successfully executed, and it can be intelligently determined whether it is necessary to retry the command according to the historical check record. This dynamic adjustment method based on the number of times can not only improve the fault tolerance, but also avoid premature or unnecessary retries, reduce unnecessary resource consumption, and perfectly solve the problem that the result status returned by CMD is OK but the CRC is incorrect due to the "data collision" defect; the corresponding relationship between different CMD commands and execution time is preset, so that the terminal device can reasonably plan the execution time according to the characteristics of the command, reduce the waiting time, avoid excessive waiting or too fast timeout, and effectively improve the system efficiency and response speed. By adding the optimization mechanism of CRC check and execution time between the terminal device and the power meter IC, the accuracy, reliability and fault tolerance of command execution are improved; for the multi-task system, the CPU power lock mechanism is turned on to enable the operation containing multiple CMDs to run correctly.
[0132] It should be understood that, although the steps in the above-mentioned flowcharts are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flowcharts may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0133] Based on the foregoing embodiments, an embodiment of the present application provides a processing device for an electric meter integrated circuit IC, and the processing device for the electric meter integrated circuit IC includes the modules included, and the units included in the modules, which can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit, a microprocessor, a digital signal processor or a field programmable gate array, etc.
[0134] Figure 6 A structural schematic diagram of a processing device of an electric meter integrated circuit IC provided by an embodiment of the present application, such as Figure 6 As shown, the processing device 600 of the fuel gauge integrated circuit IC includes a sending module 601, an acquisition module 602 and a determination module 603, wherein:
[0135] A sending module 601 is used to send a target command prompt CMD command to the power meter IC; an obtaining module 602 is used to obtain target execution result data of executing the target CMD command from the power meter IC after waiting for the target execution time, and the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; a determining module 603 is used to determine whether the target CMD command is executed successfully based on the target execution result data.
[0136] In some embodiments, the target execution result data includes first sub-data and second sub-data, and the second sub-data is used to indicate a first cyclic redundancy check CRC check value; the determination module 603 is specifically used to: calculate a second CRC check value based on the first sub-data; compare the first CRC check value and the second CRC check value; when the comparison result indicates that the first CRC check value and the second CRC check value are consistent, determine that the target CMD command is executed successfully; when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, determine whether the target CMD command is executed successfully based on the number of checks on the first CRC check value.
[0137] In some embodiments, the determination module 603 is further specifically used to: determine that the target CMD command execution fails when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent and the first CRC check value has been checked.
[0138] In some embodiments, the determination module 603 is also specifically used for: when the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has not been checked, obtaining new execution result data corresponding to the target CMD command from the power meter IC again; verifying the new execution result data, and determining whether the target CMD command is executed successfully based on the verification result of the new execution result data.
[0139] In some embodiments, the acquisition module 602 is specifically used to: when the waiting time for acquiring the target execution result data is less than or equal to a preset time threshold, acquire the new execution result data from the power meter IC again; or, after updating the preset time threshold to the target time threshold, acquire the new execution result data from the power meter IC again, and the target time threshold is greater than the preset time threshold.
[0140] In some embodiments, the target CMD command is any one of the target operations, the target operation includes one or more commands, and the device further includes: an enabling module. The enabling module is used to enable a central processing unit CPU power lock in the terminal device, and the CPU power lock is used to control the terminal device to continue to run and not enter a sleep state.
[0141] In some embodiments, the device further comprises: a closing module, which is used to close the CPU power lock when all commands in the target operation are executed.
[0142] In some embodiments, the device further comprises: a control module, which is used to control the data related to the target CMD command in the fuel gauge IC to be in a read-only state; and the control module is also used to control the data related to the target CMD command in the fuel gauge IC to be in a read-write state.
[0143] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0144] It should be noted that in the embodiments of this application Figure 6The division of modules by the processing device of the electric meter integrated circuit IC shown is schematic, which is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. It can also be implemented in the form of a combination of software and hardware.
[0145] It should be noted that in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0146] The embodiment of the present application provides a computer device, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0147] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the above embodiment are implemented.
[0148] An embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.
[0149] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0150] In one embodiment, the processing device of the fuel gauge integrated circuit IC provided by the present application can be implemented in the form of a computer program. The computer program can be used in the following manner: Figure 7 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the above-mentioned device. The computer program composed of various program modules enables the processor to execute the steps in the method of each embodiment of the present application described in this specification.
[0151] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0152] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.
[0153] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0154] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0155] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.
[0156] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed on multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0157] In addition, all functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may be a separate unit, or two or more modules may be integrated into one unit; the above-mentioned integrated modules may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0158] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0159] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0160] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0161] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0162] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0163] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for processing an electric meter integrated circuit IC, characterized in that: Applied to a terminal device, the terminal device includes a power meter IC, and the method includes: Sending a target command prompt CMD command to the fuel gauge IC; After waiting for the target execution time, obtaining target execution result data of executing the target CMD command from the power meter IC, the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; Determine whether the target CMD command is executed successfully based on the target execution result data.
2. The method according to claim 1, characterized in that The target execution result data includes first sub-data and second sub-data, wherein the second sub-data is used to indicate a first cyclic redundancy check CRC check value; The step of determining whether the target CMD command is executed successfully according to the target execution result data includes: Calculate and obtain a second CRC check value according to the first sub-data; Comparing the first CRC check value with the second CRC check value; If the comparison result indicates that the first CRC check value and the second CRC check value are consistent, determining that the target CMD command is executed successfully; When the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, it is determined whether the target CMD command is executed successfully according to the number of checks on the first CRC check value.
3. The method according to claim 2, characterized in that The determining, according to the number of times the first CRC check value is checked, whether the target CMD command is executed successfully includes: When the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has been checked, it is determined that the execution of the target CMD command has failed.
4. The method according to claim 2, characterized in that: The determining, according to the number of times the first CRC check value is checked, whether the target CMD command is executed successfully includes: When the comparison result indicates that the first CRC check value and the second CRC check value are inconsistent, and the first CRC check value has not been checked, obtaining new execution result data corresponding to the target CMD command from the fuel gauge IC again; The new execution result data is verified, and according to the verification result of the new execution result data, it is determined whether the target CMD command is executed successfully.
5. The method according to claim 4, characterized in that The step of again acquiring new execution result data corresponding to the target CMD command from the electric power meter IC includes: When the waiting time for obtaining the target execution result data is less than or equal to the preset time threshold, obtaining the new execution result data from the power meter IC again; or, After the preset duration threshold is updated to the target duration threshold, the new execution result data is obtained from the power meter IC again, and the target duration threshold is greater than the preset duration threshold.
6. The method according to claim 1, characterized in that The target CMD command is any one of the target operations, and the target operation includes one or more commands. Before sending the target CMD command to the fuel gauge IC, the method further includes: The central processing unit CPU power lock in the terminal device is turned on, and the CPU power lock is used to control the terminal device to continue running and not enter a sleep state.
7. The method according to claim 6, characterized in that After determining whether the target CMD command is executed successfully according to the target execution result data, the method further includes: When all commands in the target operation are executed, the CPU power lock is turned off.
8. The method according to claim 1, characterized in that Before acquiring the target execution result data of executing the target CMD command from the fuel gauge IC, the method further includes: Controlling the data related to the target CMD command in the fuel gauge IC to be in a read-only state; After acquiring the target execution result data of executing the target CMD command from the fuel gauge IC, the method further includes: The data related to the target CMD command in the fuel gauge IC is controlled to be in a read-write state.
9. A processing device for an electric power meter integrated circuit IC, characterized in that: Applied to a terminal device, the terminal device includes an electric meter IC, and the device includes: A sending module, used for sending a target command prompt CMD command to the fuel gauge IC; An acquisition module, configured to acquire target execution result data of executing the target CMD command from the power meter IC after waiting for the target execution time, wherein the terminal device is preset with a correspondence between different CMD commands and different execution times, and the target execution time corresponds to the target CMD command; The determination module is used to determine whether the target CMD command is executed successfully according to the target execution result data.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Intelligent battery data simulation transmission method and device, electronic equipment and storage medium
CN121585489A