A communication method, power supply equipment, charging equipment, and storage medium
By combining hardware and software, the controller's control interface is shorted and the baud rate is configured, which solves the problems of high cost and long cycle in implementing the UFCS protocol, and improves scalability and ease of maintenance.
Patent Information
- Application Number
- CN202411981181.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Existing technologies for implementing the UFCS protocol are characterized by high cost, long development cycle, and poor scalability. Hardware implementation solutions have fixed circuit logic and poor scalability, while software implementation solutions are costly.
By combining hardware and software, the controller controls the short-circuiting of the positive and negative data lines of the interface to detect the voltage sequence, configure the baud rate, and enable communication between the power supply equipment and the charging equipment.
It reduces the cost of implementing the UFCS protocol, shortens the development cycle, improves scalability, and facilitates updates and maintenance.
Smart Images

Figure CN119966023B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a communication method, power supply equipment, charging equipment and storage medium. Background Technology
[0002] On May 28, 2021, the Telecommunication Terminal Industry Association released the converged fast charging standard, "Technical Specification for Converged Fast Charging of Mobile Terminals". The following year, the next-generation converged fast charging protocol—UFCS converged fast charging protocol—was officially launched.
[0003] Currently, there are two main approaches to implementing the UFCS protocol: 1) software implementation and 2) hardware implementation. In the software implementation, the controller's communication negotiation port interacts with the microcontroller via a serial port. However, limitations in microcontroller size and performance lead to high implementation costs. In the hardware implementation, the circuit is constructed using pure digital logic circuits. The finished circuit requires physical design and reliability verification, resulting in long design and development cycles, slow time to market, and a fixed basic logic, poor scalability, and difficulty in subsequent updates and maintenance. Summary of the Invention
[0004] In view of this, one objective of the embodiments of the present invention is to provide a communication method, power supply equipment, charging equipment and storage medium, which aims to solve the technical problems of high cost, long development cycle and poor scalability when implementing integrated fast charging protocols using only hardware or software in the prior art.
[0005] To address the aforementioned technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] In a first aspect, embodiments of the present invention provide a communication method applied to a power supply device connected to a charging device. The power supply device includes a first controller and a first interface and a first data module respectively communicatively connected to the first controller. The first data module includes a first transmitting unit and a first receiving unit, which are respectively connected to the first interface. The charging device includes a second interface and a second data module, which includes a second transmitting unit and a second receiving unit, which are respectively connected to the second interface. The first interface is used to connect to the second interface.
[0007] The method includes:
[0008] The first controller controls the positive and negative data lines of the first interface to be short-circuited to each other, so that the first interface is in a first state;
[0009] The first data module detects the first voltage sequence received on the negative data line of the first interface;
[0010] If the first voltage sequence conforms to a predetermined handshake sequence, the first data module generates a first interrupt signal and sends the first interrupt signal to the first controller;
[0011] The first controller responds to the first interrupt signal by controlling the data negative line and data positive line of the first interface to disconnect the short circuit, and sets the level of the data positive line of the first interface to the first level;
[0012] The first controller configures the baud rate of the first receiving unit;
[0013] The first receiving unit receives the first unit of data sent by the charging device through the first interface at the baud rate.
[0014] Secondly, embodiments of the present invention provide a communication method applied to a charging device, wherein the charging device is connected to a power supply device, the power supply device includes a first interface and a first data module, the first data module includes a first transmitting unit and a first receiving unit, the first transmitting unit and the first receiving unit are respectively connected to the first interface, the charging device includes a second controller and a second interface and a second data module respectively communicatively connected to the second controller, the second data module includes a second transmitting unit and a second receiving unit, the second transmitting unit and the second receiving unit are respectively connected to the second interface, and the first interface is used to connect to the second interface;
[0015] The method includes:
[0016] The second controller controls the detection circuit of the second interface to detect the status of the first interface;
[0017] In response to the first interface being in the first state, the second data module sends a predetermined handshake sequence to the power supply device through the negative data line of the second interface;
[0018] The second controller acquires the voltage of the positive data line of the second interface;
[0019] If the voltage of the positive data line of the second interface is at the first level, the second controller configures the baud rate of the second transmitting unit and controls the second transmitting unit to transmit the first unit of data to the power supply device through the second interface at the baud rate.
[0020] Thirdly, embodiments of the present invention provide a power supply device, comprising:
[0021] The system comprises a first cache module, a first controller, a first interface and a first data module that are communicatively connected to the first controller. The first data module includes a first sending unit, a first receiving unit, a first computing unit and a second computing unit. The first sending unit and the second computing unit are connected. The first receiving unit is connected to the first cache module and the first computing unit respectively. The first sending unit and the first receiving unit are also connected to the first interface respectively.
[0022] The first controller includes:
[0023] A first processor and a first memory communicatively connected to the first processor;
[0024] The first memory stores computer program instructions executable by the first processor, which, when invoked by the first processor, cause the first processor to perform any of the communication methods described in the first aspect.
[0025] Fourthly, embodiments of the present invention provide a charging device, comprising:
[0026] The system comprises a second cache module, a second controller, a second interface and a second data module that are communicatively connected to the second controller. The second data module includes a second sending unit, a second receiving unit, a third computing unit and a fourth computing unit. The second sending unit and the third computing unit are connected. The second receiving unit is connected to the second cache module and the fourth computing unit, respectively. The second sending unit and the second receiving unit are also connected to the second interface, respectively.
[0027] The second controller includes:
[0028] A second processor and a second memory communicatively connected to the second processor;
[0029] The second memory stores computer program instructions executable by the second processor, which, when invoked by the second processor, cause the second processor to perform any of the communication methods described in the second aspect.
[0030] Fifthly, embodiments of the present invention provide a computer-readable storage medium storing processor-executable computer program instructions, which, when invoked by a processor, cause the processor to perform any of the communication methods described in the first aspect or any of the communication methods described in the second aspect.
[0031] The embodiments of the present invention have the following beneficial effects: Unlike the prior art, the communication method provided in the embodiments of the present invention is applied to a power supply device connected to a charging device. The power supply device includes a first controller and a first interface and a first data module respectively communicatively connected to the first controller. The first data module includes a first transmitting unit and a first receiving unit, which are respectively connected to the first interface. The charging device includes a second interface and a second data module, which includes a second transmitting unit and a second receiving unit, which are respectively connected to the second interface. The first interface is used to connect to the second interface. The method includes: the first controller controlling the positive and negative data lines of the first interface to short-circuit each other to put the first interface in a first state; the first data module detecting a first voltage sequence received on the negative data line of the first interface; if the first voltage sequence conforms to a predetermined handshake sequence, the first data module generating a first interrupt signal and sending the first interrupt signal to the first controller; the first controller responding to the first interrupt signal controlling the negative and positive data lines of the first interface to disconnect from the short-circuit, and setting the level of the positive data line of the first interface to a first level; the first controller configuring the baud rate of the first receiving unit; and the first receiving unit receiving the first unit data sent by the charging device through the first interface at the baud rate.
[0032] This invention combines software and hardware to achieve a unified fast-charging communication protocol between power supply equipment and charging equipment, which can reduce costs, shorten development cycles, improve scalability, and facilitate updates and maintenance. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the prior art or embodiments will be briefly introduced below. Obviously, the drawings described below only show some embodiments of the present invention and should not be considered as limiting the scope of protection. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 These are schematic diagrams of the communication system provided in some embodiments of the present invention;
[0035] Figure 2 These are schematic diagrams of the power supply equipment provided in some embodiments of the present invention;
[0036] Figure 3 These are schematic diagrams of the structure of a charging device provided in some embodiments of the present invention;
[0037] Figure 4 This is a schematic diagram of the structure of the first controller in the power supply equipment provided in some embodiments of the present invention;
[0038] Figure 5 This is a schematic diagram of the structure of the second controller in the charging device provided in some embodiments of the present invention;
[0039] Figure 6 This is a flowchart illustrating a communication method provided in some embodiments of the present invention, wherein the communication method is applied to a power supply device;
[0040] Figure 7 This is a flowchart illustrating a communication method provided in some embodiments of the present invention, wherein the communication method is applied to a charging device. Detailed Implementation
[0041] To make the objectives and advantages of the embodiments of the present invention more readily understood, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. The detailed description of the embodiments of the present invention in the accompanying drawings is not intended to limit the scope of protection claimed by the present invention, but only to illustrate selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] It should be noted that, unless there is a conflict, the various technical features involved in the embodiments of the present invention described below can be combined with each other, and all are within the protection scope of the present invention. Furthermore, although functional modules are divided in the device or structural schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. In addition, the terms "first," "second," "third," and other similar expressions used herein do not limit the data or execution order, but are only for illustrative purposes and to distinguish identical or similar items with substantially the same function and effect, and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features.
[0043] Unless otherwise defined, the technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. It should be understood that the term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0044] Please see Figure 1 , Figure 1 The schematic diagram illustrates the structure of a communication system provided by some embodiments of the present invention.
[0045] like Figure 1 As shown, the communication system 1000 includes a power supply device 100 and a charging device 200, which are connected to each other via a cable 101.
[0046] Specifically, the power supply equipment 100 includes a first controller and a first interface and a first data module that are communicatively connected to the first controller. Figure 1 (Not shown in the image), the first data module includes a first transmitting unit and a first receiving unit, which are respectively connected to a first interface. The charging device 200 includes a second controller and a second interface and a second data module communicatively connected to the second controller. Figure 1 (Not shown in the image), the second data module includes a second transmitting unit and a second receiving unit, which are respectively connected to a second interface. The first interface is connected to the second interface via cable 101, thereby enabling communication between the power supply device 100 and the charging device 200.
[0047] In some embodiments, the first interface, the first data module, the second interface, and the second data module are all implemented using hardware circuits, while the first controller and the second controller are implemented using software logic. This combination of hardware and software can reduce costs, shorten the development cycle, improve scalability, and facilitate updates and maintenance, while achieving a unified fast charging protocol between the power supply device 100 and the charging device 200.
[0048] In some embodiments, the charging device 200 can only establish a communication connection with the power supply device 100 when the first interface of the power supply device 100 is in a predetermined state. That is, the first controller of the power supply device 100 controls the positive and negative data lines of the first interface to be shorted together, so that the first interface is in a first state.
[0049] The second controller of the charging device 200 controls the detection circuit of the second interface to detect the current state of the first interface. If the detection circuit of the second interface determines that the first interface of the power supply device 100 is in the first state, the second data module of the charging device 200 sends a predetermined handshake sequence to the power supply device 100 through the data negative line of the second interface. That is, the second data module sends the predetermined handshake sequence to the data negative line of the first interface of the power supply device 100.
[0050] The first data module of the power supply device 100 detects the first voltage sequence received on the negative data line of the first interface. If the first voltage sequence conforms to a predetermined handshake sequence, it indicates that the charging device 200 can establish a communication connection with the power supply device 100. The first data module generates a first interrupt signal and sends the first interrupt signal to the first controller. The first controller responds to the received first interrupt signal by controlling the disconnection of the negative data line and the positive data line of the first interface, setting the level of the positive data line of the first interface to the first level, and configuring the baud rate of the first receiving unit.
[0051] The second controller of the charging device 200 obtains the voltage of the data positive line of the second interface. If the voltage of the data positive line of the second interface is at the first level, it indicates that the charging device 200 and the power supply device 100 have established a communication connection. Then, the second controller configures the baud rate of the second transmitting unit and controls the second transmitting unit to send the first unit of data to the power supply device 100 through the second interface at the configured baud rate.
[0052] The first receiving unit of the power supply device 100 receives the first unit data sent by the charging device 200 through the first interface at a configured baud rate.
[0053] In some embodiments, the first level can be a high level or a low level, and those skilled in the art can distinguish between high and low levels based on experimental data and actual needs. It is understood that, to ensure fast and accurate data transmission between the power supply device 100 and the charging device 200, the second transmitting unit and the first receiving unit should be configured with the same baud rate.
[0054] In some embodiments, the power supply device 100 may be a power adapter, energy storage device or system, device connector, device adapter, or other suitable type of device, apparatus, or component, etc., and the charging device may be a smartphone, laptop, tablet, cleaning robot, delivery robot, or other suitable type of device, apparatus, or component, etc. It is understood that a device or apparatus may be both a power supply device and a charging device. For example, when a charging device (such as a lithium battery) is charging a charging device (such as a robotic vacuum cleaner), the energy storage device acts as a power supply device. When the energy storage device is low on power and is being charged using an external power source, the energy storage device acts as a charging device.
[0055] It should be understood that, Figure 1 In the communication system shown, the power supply device is a power adapter and the charging device is a smartphone. However, this does not impose any limitations on the structure, type, or quantity of the power supply and charging devices. In other embodiments, the power supply and charging devices can be any other suitable type of device, and the power supply and charging devices in other embodiments can also be respectively... Figure 1 The power adapters and smartphones shown may include more or fewer components, or have similar features to... Figure 1 The power adapter and smartphone have different configurations shown.
[0056] To facilitate understanding of the communication method provided in the embodiments of the present invention, the power supply equipment and charging equipment provided in the embodiments of the present invention will first be described in detail.
[0057] Please refer to the following: Figure 2 and Figure 3 , Figure 2 and Figure 3 Schematic diagrams of the power supply equipment and charging equipment provided in some embodiments of the present invention are shown respectively.
[0058] like Figure 2 As shown, the power supply device 100 includes a first buffer module 140, a first controller 110, a first interface 120 and a first data module 130 that are communicatively connected to the first controller 110. The first data module 130 includes a first transmitting unit 131, a first receiving unit 132, a first computing unit 133 and a second computing unit 134. The first transmitting unit 131 and the second computing unit 134 are connected. The first receiving unit 132 is connected to both the first buffer module 140 and the first computing unit 133. The first transmitting unit 131 and the first receiving unit 132 are also connected to the first interface 120.
[0059] like Figure 3 As shown, the charging device 200 includes a second buffer module 240, a second controller 210, a second interface 220 and a second data module 230 communicatively connected to the second controller 210. The second data module 230 includes a second transmitting unit 231, a second receiving unit 232, a third computing unit 233 and a fourth computing unit 234. The second transmitting unit 231 and the third computing unit 233 are connected. The second receiving unit 232 is connected to both the second buffer module 240 and the fourth computing unit 234. The second transmitting unit 231 and the second receiving unit 232 are also connected to the second interface 220.
[0060] In some embodiments, the first interface 120 includes a positive data line and a negative data line, and the second interface 220 includes a positive data line and a negative data line. The first interface 120 is used to connect to the second interface 220 of the charging device 200 (i.e., the positive data line of the first interface 120 is connected to the positive data line of the second interface 220, and the negative data line of the first interface 120 is connected to the negative data line of the second interface 220), thereby enabling the power supply device 100 and the charging device 200 to communicate. The power supply device 100 sends data through the positive data line, and the charging device 200 sends data through the negative data line. The first data module 130 is used to send and receive data, and to perform some necessary processing on the data, such as calculating the verification code of the data using the first calculation unit 133 and the second calculation unit 134. The second data module 230 is used to send and receive data, and to perform some necessary processing on the data, such as calculating the verification code of the data using the third calculation unit 233 and the fourth calculation unit 234.
[0061] The first cache module 140 and the second cache module 240 are used to store the data received by the power supply device 100 and the charging device 200, respectively. That is, the power supply device 100 stores the data received by the first receiving unit 132 into the first cache module 140, and the charging device 200 stores the data received by the second receiving unit 232 into the second cache module 240.
[0062] It is understood that both the power supply device and the charging device can omit the calculation unit. That is, the power supply device may not include the first and second calculation units, and instead uses the first controller to calculate the data to obtain the verification code. The charging device may not include the third and fourth calculation units, and instead uses the second controller to calculate the data to obtain the verification code. Of course, in some embodiments, either the power supply device or the charging device may omit the calculation unit, while the other includes a calculation unit. Those skilled in the art can flexibly choose to configure the calculation units of the power supply device and the charging device, and the embodiments of the present invention do not impose any limitations on this.
[0063] Please see Figure 4 , Figure 4 The schematic diagram illustrates the structure of the first controller in the power supply equipment provided in some embodiments of the present invention.
[0064] like Figure 4 As shown, the first controller 110 includes at least one first processor 111 and a first memory 112 connected in communication. Figure 4Taking a processor connected via a bus system 113 as an example, the various components in the first controller 110 are coupled together through the bus system 113, which is used to realize communication between the various components. It is easy to understand that the bus system 113 may include not only a data bus, but also a power bus, a control bus, and a status signal bus, etc. However, for clarity and brevity, in... Figure 4 The general labels all buses as Bus System 113. This is understandable. Figure 4 The structures shown in the embodiments are merely illustrative and do not limit the structure of the first controller described above. For example, the first controller may also include components that are more... Figure 4 The structure shown has more or fewer components, or has the same as Figure 4 The diagram shows different configurations of the structure.
[0065] Specifically, the first processor 111 is used to provide computing and control capabilities to control the first controller 110 to perform corresponding tasks, such as controlling the first controller 110 to execute any of the communication methods provided in the first aspect of the present invention, or to execute the steps in any possible implementation of any of the communication methods provided in the first aspect of the present invention. Those skilled in the art will understand that the first processor 111 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0066] The first memory 112, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, instructions, and modules, such as the programs, instructions, and modules corresponding to the communication method provided in the first aspect of the present invention. In some embodiments, the first memory 112 may include a program storage area and a data storage area. The program storage area may store an operating system, an application program required for at least one function, and the data storage area may store data created according to the use of the first processor 111. The first processor 111 executes various functional applications and data processing of the first controller 110 by running the non-transitory software programs, instructions, and modules stored in the first memory 112, thereby implementing any of the communication methods provided in the first aspect of the present invention, or executing the steps in any possible implementation of any of the communication methods provided in the first aspect of the present invention. In some embodiments, the first memory 112 may include high-speed random access memory and may also include non-transitory memory. For example, at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the first memory 112 may also include memory remotely located relative to the first processor 111, and these remotely located memories may be connected to the first processor 111 through a communication network. Understandably, examples of the aforementioned communication networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0067] Please see Figure 5 , Figure 5 The schematic diagram illustrates the structure of the second controller in a charging device provided in some embodiments of the present invention.
[0068] like Figure 5 As shown, the second controller 210 includes at least one second processor 211 and a second memory 212 connected in communication. Figure 5 Taking a processor connected via a bus system 213 as an example, the various components in the second controller 210 are coupled together through the bus system 213, which is used to realize communication between the various components. It is easy to understand that the bus system 213 may include not only a data bus, but also a power bus, a control bus, and a status signal bus, etc. However, for clarity and brevity, in... Figure 5 The general designated all buses as Bus System 213. This is understandable. Figure 5 The structures shown in the embodiments are merely illustrative and do not limit the structure of the second controller described above. For example, the second controller may also include components that are more... Figure 5 The structure shown has more or fewer components, or has the same Figure 5 The diagram shows different configurations of the structure.
[0069] Specifically, the second processor 211 provides computational and control capabilities to control the second controller 210 to perform corresponding tasks, such as controlling the second controller 210 to execute any of the communication methods provided in the second aspect of the present invention, or to execute the steps in any possible implementation of any of the communication methods provided in the second aspect of the present invention. Those skilled in the art will understand that the second processor 211 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0070] The second memory 212, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, instructions, and modules, such as the programs, instructions, and modules corresponding to the communication method provided in the second aspect of the present invention. In some embodiments, the second memory 212 may include a program storage area and a data storage area. The program storage area may store an operating system, an application program required for at least one function, and the data storage area may store data created according to the use of the second processor 211. The second processor 211 executes various functional applications and data processing of the second controller 210 by running the non-transitory software programs, instructions, and modules stored in the second memory 212, thereby implementing any of the communication methods provided in the second aspect of the present invention, or executing the steps in any possible implementation of any of the communication methods provided in the second aspect of the present invention. In some embodiments, the second memory 212 may include high-speed random access memory and may also include non-transitory memory. For example, at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the second memory 212 may also include memories remotely located relative to the second processor 211, which can be connected to the second processor 211 via a communication network. Understandably, examples of the aforementioned communication networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0071] As can be understood from the above, the implementing entity of any communication method provided in the embodiments of the present invention can be any suitable type of power supply device and charging device with certain computing and control capabilities, such as the power supply device 100 and the charging device 200 described above. In some feasible implementations, any communication method provided in the embodiments of the present invention can be implemented by a processor calling computer program instructions stored in memory.
[0072] The following will describe in detail the communication method provided by the embodiments of the present invention, taking into account exemplary applications and implementations of the power supply equipment and charging equipment provided in the embodiments of the present invention.
[0073] First, the communication method provided in the first aspect of the embodiments of the present invention will be described in detail.
[0074] Please see Figure 6 , Figure 6 The schematic diagram illustrates a flowchart of a communication method provided in some embodiments of the present invention.
[0075] Those skilled in the art will understand that the communication method provided in the embodiments of the present invention can be applied to the above-mentioned power supply equipment, such as power supply equipment 100. Specifically, the execution subject of this communication method is one or at least two first processors of the power supply equipment.
[0076] like Figure 6 As shown, the communication method includes, but is not limited to, the following steps S100-S600:
[0077] S100: The first controller controls the positive and negative data lines of the first interface to be shorted together so that the first interface is in the first state.
[0078] In some embodiments, a controllable electronic switch (e.g., MOSFET, relay, or other switch) is configured between the positive and negative data lines of the first interface, and the control terminal of the electronic switch is connected to a first controller. The first controller outputs a control signal to the electronic switch to drive the electronic switch into and into a conducting state, so that the positive and negative data lines of the first interface are short-circuited to each other, thereby making the first interface in a first state.
[0079] In other embodiments, the first controller of the power supply equipment supports a programmable I / O module. The positive and negative data lines of the first interface are connected to two ports of the programmable I / O module. The first controller is software-programmed to put the two ports of the programmable I / O module in a short-circuit mode. For example, by setting the two ports of the programmable I / O module to the same level and connecting them directly, the two ports are put in a short-circuit state, thereby shorting the positive and negative data lines of the first interface to each other, and the first interface is in a first state.
[0080] It is easily understood that other methods can also be used to achieve the mutual shorting of the positive and negative data lines of the first interface controlled by the first controller. For example, a resistor circuit controllable by the first controller can be connected between the positive and negative data lines of the first interface. The first controller controls the conduction state of the resistor circuit to achieve the mutual shorting of the positive and negative data lines of the first interface. Those skilled in the art can choose any suitable method or approach according to actual needs to achieve the mutual shorting of the positive and negative data lines of the first interface controlled by the first controller. The embodiments of the present invention do not limit this in any way.
[0081] S200: The first data module detects the first voltage sequence received on the negative data line of the first interface.
[0082] Specifically, the input end of the first data module (i.e., the first receiving unit) is connected to the negative data line of the first interface, and the output end of the first data module (i.e., the first transmitting unit) is connected to the positive data line of the first interface.
[0083] The first data module uses a built-in ADC (analog-to-digital converter) or comparator to periodically sample the voltage value and voltage duration of the negative data line of the first interface at a preset sampling frequency, and forms a voltage sequence from the sampled voltage value and voltage duration, thereby detecting the first voltage sequence received on the negative data line of the first interface.
[0084] S300: If the first voltage sequence conforms to the predetermined handshake sequence, the first data module generates a first interrupt signal and sends the first interrupt signal to the first controller.
[0085] In some embodiments, a predetermined handshake sequence is used to confirm the initial communication connection between the power supply device and the charging device, wherein the predetermined handshake sequence is a voltage sequence sent by the charging device to the power supply device after detecting and determining that the first interface of the power supply device is in a first state.
[0086] Specifically, the power supply device compares the first voltage sequence with the predetermined handshake sequence. If the first voltage sequence matches the predetermined handshake sequence, that is, the voltage change of the first voltage sequence received on the negative data line of the first interface matches the voltage change of the predetermined handshake sequence (for example, the level change and time interval of the first voltage sequence are consistent with the level change and time interval of the predetermined handshake sequence), it indicates that the power supply device and the charging device have successfully handshaked. Then, the first data module generates a first interrupt signal and sends the first interrupt signal to the first controller.
[0087] In some embodiments, the first data module can generate a first interrupt signal by reserving an output signal line (e.g., a GPIO pin) in the first data module for outputting an interrupt signal. If the first voltage sequence conforms to a predetermined handshake sequence, the first data module triggers hardware logic to switch the state of the output signal line from low level to high level or generate a pulse signal to obtain the first interrupt signal. The first interrupt signal can be configured to be edge-triggered (e.g., rising edge or falling edge) or level-triggered (e.g., high level or low level).
[0088] S400: The first controller responds to the first interrupt signal, controls the data negative line and data positive line of the first interface to disconnect the short circuit, and sets the level of the data positive line of the first interface to the first level.
[0089] Specifically, upon receiving the first interrupt signal from the first data module, the first controller triggers the interrupt service routine (ISR), immediately stopping the current operation and executing the interrupt service routine. The first controller sends a disconnect command to the electronic switch (e.g., MOSFET, relay) or programmable I / O port to switch the electronic switch or programmable I / O port to the disconnect state, thereby disconnecting the negative data line and positive data line of the first interface.
[0090] In some embodiments, the positive data line of the first interface is connected to the I / O pin of the first controller. The I / O pin can be configured in output mode to set the level of the positive data line of the first interface. The first controller configures the I / O pin corresponding to the positive data line of the first interface in output mode and sets the level of the I / O pin to a predetermined first level, thereby setting the level of the positive data line of the first interface to the first level, wherein the first level is a high level.
[0091] In some embodiments, after the data negative line and data positive line of the first interface are disconnected and short-circuited, and the level of the data positive line of the first interface is set to the first level, the first controller ends the interrupt service routine, exits the interrupt state, resumes the main program, and performs subsequent operations, such as configuring the baud rate of the first receiving unit or preparing to receive data.
[0092] S500: The first controller configures the baud rate of the first receiving unit.
[0093] Baud rate is a key parameter in data communication, referring to the number of symbols (bits) transmitted per second. To ensure that the first receiving unit correctly and quickly receives the data sent by the charging device, the first controller needs to be configured with a baud rate that matches the charging device.
[0094] Specifically, the first controller obtains and determines the target baud rate, configures the baud rate of the first receiving unit to be the target baud rate, that is, initializes the communication interface corresponding to the first receiving unit (such as UART, SPI, I2C or USB interface), calculates the frequency division value according to the target baud rate and the main frequency of the first controller system, writes the calculated frequency division value into the control register, completes the baud rate configuration of the first receiving unit, and then configures the first receiving unit into receive mode so that the first receiving unit can listen to the data line of the first interface.
[0095] In some embodiments, the target baud rate is set by predefined parameters, such as a predetermined handshake sequence containing baud rate information. After receiving the predetermined handshake sequence, the power supply device parses the predetermined handshake sequence according to the communication protocol between the power supply device and the charging device through the first controller to obtain the target baud rate.
[0096] In some embodiments, if the communication protocol between the power supply device and the charging device specifies a target baud rate of a fixed value (e.g., 38400, 57600, 9600bps or 115200bps, etc.), the first controller can directly configure the baud rate of the first receiving unit to that fixed value.
[0097] In some embodiments, if the baud rate needs to be dynamically adjusted during communication, the first controller can resolve and determine the baud rate through a specific algorithm (e.g., automatic baud rate detection) and configure the baud rate of the first receiving unit.
[0098] In some embodiments, the first controller configures the baud rate of the first receiving unit, specifically including but not limited to the following steps S510-S540:
[0099] S510: The first controller configures the initial baud rate of the first receiving unit.
[0100] Specifically, the first controller acquires the initial baud rate and sets the baud rate of the first receiving unit as the initial baud rate, that is, initializes the communication interface (such as UART, SPI, I2C or USB interface) corresponding to the first receiving unit. Based on the initial baud rate and the main frequency of the first controller system, the frequency division value is calculated and written into the control register to complete the configuration of the initial baud rate of the first receiving unit.
[0101] In some embodiments, the initial baud rate is the baud rate specified by the communication protocol between the power supply device and the charging device (e.g., 38400, 57600, 9600bps or 115200bps, etc.), and the first controller can configure the initial baud rate of the first receiving unit according to the communication protocol.
[0102] S520: The first receiving unit receives the first sequence sent by the charging device based on the initial baud rate, and calculates the first sequence to obtain the first baud rate.
[0103] It should be understood that the first sequence can be a sequence generated by the data sender (power supply equipment or charging equipment) according to the communication protocol and communication requirements. The first sequence can also be a predefined fixed sequence. The data sender only needs to select a suitable first sequence from the sequence library, or obtain it through hard coding or parsing a configuration file.
[0104] Specifically, the first receiving unit listens to the data line of the first interface based on the initial baud rate and receives the first sequence sent by the charging device. After receiving the first sequence sent by the charging device, the first receiving unit performs calculations on the first sequence, that is, measures the duration of each bit in the first sequence (i.e., the time from one signal edge to the next signal edge), calculates the total duration of the middle 4 bits of the first sequence, and uses the average of the total duration of the middle 4 bits as the first baud rate.
[0105] S530: The first receiving unit generates a second interrupt signal and sends the second interrupt signal to the first controller.
[0106] S540: In response to the second interrupt signal, the first controller obtains the first baud rate from the first data module and configures the baud rate of the first receiving unit to be the first baud rate.
[0107] In some embodiments, the first receiving unit may generate a second interrupt signal by reserving an output signal line (e.g., a GPIO pin) in the first receiving unit for outputting an interrupt signal. After calculating the first baud rate from the first sequence, the first receiving unit triggers hardware logic to switch the state of the output signal line from low to high or generate a pulse signal to obtain the second interrupt signal. The second interrupt signal is then sent to the first controller. The second interrupt signal may be configured to be edge-triggered (e.g., rising edge or falling edge) or level-triggered (e.g., high level or low level).
[0108] Specifically, upon receiving the second interrupt signal from the first receiving unit, the first controller triggers an interrupt service routine, immediately stopping the current operation and executing the interrupt service routine. The first controller reads the first baud rate from the first receiving unit of the first data module via a data bus or communication interface (such as UART, SPI, I2C, or USB).
[0109] The first controller reconfigures the baud rate of the first receiving unit to the first baud rate based on the read first baud rate. This involves initializing the communication interface (e.g., UART, SPI, I2C, or USB) corresponding to the first receiving unit, calculating the frequency division value based on the first baud rate and the main frequency of the first controller system, writing the calculated frequency division value into the control register, and thus configuring the baud rate of the first receiving unit to the first baud rate.
[0110] S600: The first receiving unit receives the first unit of data sent by the charging device through the first interface at a baud rate.
[0111] Specifically, after configuring the baud rate of the first receiving unit and configuring it to data receiving mode, the first receiving unit listens to the signal line of the first interface. When it receives the start bit (i.e., a low-level signal) sent by the charging device through the first interface, it initiates the data frame receiving process. The start bit is used to mark the beginning of the data frame and to synchronize the clocks of the receiving end (power supply device) and the sending end (charging device).
[0112] The first receiving unit calculates the bit time interval based on the configured baud rate to ensure that the sampling point of each data bit is aligned with the charging device. After the start bit, the first receiving unit sequentially samples the 8 data bits and parity bit received through the first interface. Understandably, the sampling point of each data bit is calculated based on the baud rate clock, and sampling is performed in the middle of the data bit period to avoid edge interference.
[0113] After the data bits and parity bits, the first receiving unit samples the stop bit (i.e., high-level signal) received through the first interface and checks the stop bit to verify the integrity of the data frame. After receiving the start bit, data bits, parity bits and stop bits through the first interface, it indicates that a complete data frame (first unit data) has been received. That is, the first receiving unit receives the first unit data sent by the charging device through the first interface at the baud rate.
[0114] Understandably, in some communication protocols, a complete data frame (first unit data) may not include a check bit. Those skilled in the art can add or omit the check bit to the first unit data as needed, and the embodiments of the present invention do not impose any limitations on this.
[0115] In some embodiments, after the first receiving unit receives the first unit data sent by the charging device through the first interface at a baud rate, the communication method further includes, but is not limited to, the following steps S08-S09:
[0116] S08: The first data module generates a third interrupt signal and sends the third interrupt signal to the first controller.
[0117] S09: The first controller responds to the third interrupt signal and reads the first unit of data from the first data module.
[0118] Specifically, the first data module can generate the third interrupt signal in the following way: an output signal line (e.g., GPIO pin) is reserved in the first data module for outputting an interrupt signal. After receiving the first unit data sent by the charging device through the first interface at a configured baud rate, the first data module triggers the hardware logic to switch the state of the output signal line from low level to high level or generate a pulse signal to obtain the third interrupt signal, and sends the third interrupt signal to the first controller. The third interrupt signal can be configured to be edge-triggered (e.g., rising edge or falling edge) or level-triggered (e.g., high level or low level).
[0119] In some embodiments, upon receiving a third interrupt signal from the first data module, the first controller triggers an interrupt service routine, immediately stops the current operation, and executes the interrupt service routine. The first controller reads the received first unit data from the first data module via a data bus or communication interface (e.g., UART, SPI, I2C, or USB).
[0120] In some embodiments, after the first controller reads the received first unit data from the first data module, the communication method further includes, but is not limited to, the following steps S10-S50:
[0121] S10: The first controller calculates the current first unit data to obtain the current first unit verification code corresponding to the current first unit data.
[0122] S20: The first controller calculates the next first unit data and the current first unit verification code to obtain the next first unit verification code corresponding to the next first unit data.
[0123] Specifically, the received first unit data is sorted according to the receiving order. The first controller uses a specific algorithm (e.g., CRC check, hash function or custom check rule) to read and calculate the sorted first unit data one by one to obtain the final first verification code.
[0124] For example, starting from the first unit of data, the first unit of data is taken as the current unit of data. The first controller uses CRC check (e.g., a predefined polynomial) to calculate the current unit of data to obtain the current unit of verification code corresponding to the current unit of data.
[0125] For example, the first controller uses CRC check (e.g., a predefined polynomial) to jointly calculate the next first unit data and the current first unit verification code to obtain the next first unit verification code corresponding to the next first unit data.
[0126] S30: The first controller executes S10-S20 in a loop until it calculates the first unit verification code corresponding to the last first unit data and the first unit data preceding the last first unit data, and obtains the last first unit verification code corresponding to the last first unit data. The last first unit data is the last first unit data in the first data, and the last first unit verification code is the first verification code corresponding to the first data. The first data includes multiple first unit data and second verification codes. The second verification code is the verification code obtained by the charging device from the multiple first unit data.
[0127] Specifically, the first controller reads the first unit data one by one and uses CRC check to repeatedly execute steps S10 and S20 to calculate the corresponding first unit verification code for all the first unit data, until the last first unit data is calculated. That is, the first controller repeatedly executes S10 and S20 until the first unit verification code corresponding to the last first unit data and the first unit data preceding the last first unit data is calculated to obtain the last first unit verification code corresponding to the last first unit data.
[0128] It is understandable that the first data includes multiple first unit data and second verification codes. The last first unit data is the last first unit data of the first data, and the last first unit verification code is the first verification code corresponding to the first data. The second verification code is a verification code obtained by the charging device by calculating multiple first unit data. The charging device calculates multiple first unit data to obtain the second verification code and appends the second verification code to the first data.
[0129] S40: After receiving the first data, the first controller extracts the second verification code from the first data. If the first verification code and the second verification code are the same, the first receiving unit successfully receives the first data.
[0130] Specifically, after receiving the first data, the first controller extracts the second verification code from the received complete first data and compares the first verification code with the second verification code. If the first verification code and the second verification code are the same, it means that the first receiving unit has successfully received the first data.
[0131] In some embodiments, if the first verification code and the second verification code are different, it indicates that the first data is incorrect or has been tampered with. The first controller may request the charging device to resend the first data or perform other processing operations, such as issuing an alarm reminder for data reception error.
[0132] S50: After successfully receiving the first data, the first controller controls the first transmitting unit to send the second unit data to the charging device through the first interface.
[0133] Specifically, after successfully receiving the first data, the first controller controls the first transmitting unit to send the second unit data to the charging device through the first interface. That is, the first controller obtains the second unit data according to the communication protocol and the current context. The second unit data includes a confirmation message of successful reception, the current status information of the first controller, and other negotiated data or control commands. The first controller encodes and formats the second unit data to conform to the predetermined communication protocol format. The first controller configures the baud rate of the first transmitting unit, checks and clears the transmitting buffer of the first transmitting unit to ensure that there is no residual data in the buffer. The first controller writes the encoded second unit data into the transmitting buffer of the first transmitting unit and controls the first transmitting unit to send the second unit data to the charging device through the first interface at the configured baud rate. The first transmitting unit transmits the second unit data in the transmitting buffer bit by bit to the charging device through the data positive line of the first interface.
[0134] In some embodiments, the first controller controls the first transmitting unit to send second unit data to the charging device through the first interface, specifically including but not limited to the following steps S51-S54:
[0135] S51: The first controller acquires the first sequence and parses the first sequence to obtain the second baud rate.
[0136] It should be understood that the first sequence can be a sequence generated by the data sender (power supply equipment or charging equipment) according to the communication protocol and communication requirements. The first sequence can also be a predefined fixed sequence. The data sender only needs to select a suitable first sequence from the sequence library, or obtain it through hard coding or parsing a configuration file.
[0137] Specifically, when the power supply equipment sends the second unit of data to the charging equipment as a data transmitter, the first controller of the power supply equipment can generate a first sequence according to the communication protocol and communication requirements, or it can obtain the first sequence from the sequence library, or obtain the first sequence by hard-coding or parsing the sequence configuration file.
[0138] After obtaining the first sequence, the first controller parses specific fields in the first sequence to extract the second baud rate, thereby obtaining the second baud rate. In some embodiments, if the first sequence adopts a dynamic negotiation baud rate mechanism, the first controller calculates the second baud rate based on the negotiation algorithm for the first sequence.
[0139] S52: The first controller configures the baud rate of the first transmitting unit to be the second baud rate, and controls the first transmitting unit to send the first sequence to the charging device.
[0140] Specifically, the first controller configures the baud rate of the first transmitting unit to the second baud rate based on the obtained second baud rate. That is, it initializes the communication interface (e.g., UART, SPI, or USB interface) corresponding to the first transmitting unit, calculates the frequency division value based on the second baud rate and the main frequency of the first controller system, writes the calculated frequency division value into the control register, completes the configuration of the baud rate of the first transmitting unit to the second baud rate, and configures the first transmitting unit to transmit mode so that the first transmitting unit can listen for and acquire the data to be transmitted.
[0141] After configuring the baud rate of the first transmitting unit to the second baud rate, the first controller controls the first transmitting unit to transmit the first sequence to the charging device through the first interface at the second baud rate.
[0142] S53: The first controller obtains several second unit data from the first data module, calculates the several second unit data to obtain a third verification code, and appends the third verification code to the second data. The multiple second unit data and the third verification code constitute the second data.
[0143] Specifically, the first controller obtains several second units of data to be sent from the first data module through a data bus or communication interface (e.g., UART, SPI, I2C or USB).
[0144] For example, several second-unit data items to be sent are sorted according to the sending order. The first controller uses a specific algorithm (e.g., CRC check, hash function, or custom verification rule) to calculate each of the sorted second-unit data items to obtain the third verification code corresponding to the second data, and then appends the third verification code to the second data. Obviously, multiple second-unit data items and the third verification code constitute the second data.
[0145] Specifically, starting from the first second unit data, the first second unit data is taken as the current second unit data. The first controller uses CRC check (e.g., a predefined polynomial) to calculate the current second unit data to obtain the current second unit verification code. Then, the first controller uses CRC check to jointly calculate the next second unit data and the current second unit verification code to obtain the next second unit verification code. The first controller calculates the second unit data one by one, that is, it uses CRC check to calculate the corresponding second unit verification code for all the second unit data in sorting order, until the last second unit data is calculated to obtain the last second unit verification code. The last second unit data is the last second unit data in the second data, and the last second unit verification code is the third verification code corresponding to the second data.
[0146] S54: The first controller controls the first transmitting unit to send several second unit data and a third verification code to the charging device through the first interface at a second baud rate.
[0147] For example, the first controller controls the first sending unit to send several second unit data and a third verification code to the charging device through the first interface at a second baud rate. Specifically, the first controller sends a first control command to the first sending unit. Upon receiving the first control command, the first sending unit calculates the bit time interval according to the configured third baud rate and sends the several second unit data to the charging device one by one according to the data sending order based on the bit time interval. After sending the several second unit data, the first controller sends a second control command to the first sending unit. Upon receiving the second control command, the first sending unit sends the third verification code to the charging device.
[0148] In some embodiments, after the first controller reads the received first unit data from the first data module, the communication method further includes, but is not limited to, the following steps S60-S80:
[0149] S60: The first controller controls the first computing unit to calculate a number of first unit data to obtain a first verification code corresponding to the first data. The first data includes multiple first unit data and a second verification code. The second verification code is a verification code obtained by the charging device from the calculation of multiple first unit data.
[0150] In some embodiments, the first data module further includes a first calculation unit connected to the first receiving unit, the first calculation unit being used to perform calculations on the first unit data.
[0151] Specifically, the received first unit data is sorted according to the data reception order. The first controller controls the first computing unit to perform calculations on the sorted first unit data one by one to obtain the first verification code corresponding to the first data. That is, the first computing unit is controlled to use a specific algorithm (such as CRC check, hash function or custom check rule) to perform calculations on the sorted first unit data one by one to obtain the first verification code corresponding to the first data.
[0152] It can be understood that the first data includes multiple first unit data and a second verification code. The second verification code is a verification code obtained by the charging device by calculating multiple first unit data. The charging device calculates multiple first unit data to obtain the second verification code and appends the second verification code to the first data.
[0153] For example, starting from the first unit data, the first unit data is taken as the current unit data. The first calculation unit uses CRC check (e.g., a predefined polynomial) to calculate the current unit data to obtain the current unit verification code. Then, the first calculation unit uses CRC check to jointly calculate the next unit data and the current unit verification code to obtain the next unit verification code. The first calculation unit calculates the unit data one by one, that is, it uses CRC check to calculate the corresponding unit verification code for all the unit data in sorting order, until the last unit data is calculated to obtain the last unit verification code. The last unit data is the last unit data in the first data, and the last unit verification code is the first verification code corresponding to the first data.
[0154] S70: The first controller acquires the first verification code and extracts the second verification code from the first data. If the first verification code and the second verification code are the same, the first receiving unit successfully receives the first data.
[0155] Specifically, after calculating several units of first data to obtain a first verification code, the first calculation unit stores the first verification code in a register, and the first controller retrieves the first verification code from the register. The first controller also extracts the second verification code corresponding to the first data from the read first data, and compares the first verification code with the second verification code. If the first verification code and the second verification code are the same, it indicates that the first receiving unit has successfully received the first data.
[0156] In some embodiments, if the first verification code and the second verification code are different, it indicates that the first data is incorrect or has been tampered with. The first controller may request the charging device to resend the first data or perform other processing operations, such as issuing an alarm reminder for data reception error.
[0157] S80: After successfully receiving the first data, the first controller controls the first transmitting unit to send the second unit data to the charging device through the first interface.
[0158] Specifically, after successfully receiving the first data, the first controller controls the first transmitting unit to send the second unit data to the charging device through the first interface. That is, the first controller obtains the second unit data according to the communication protocol and the current context. The second unit data includes a confirmation message of successful reception, the current status information of the first controller, and other negotiated data or control commands. The first controller encodes and formats the second unit data to conform to the predetermined communication protocol format. The first controller configures the baud rate of the first transmitting unit, checks and clears the transmitting buffer of the first transmitting unit to ensure that there is no residual data in the buffer. The first controller writes the encoded second unit data into the transmitting buffer of the first transmitting unit and controls the first transmitting unit to send the second unit data to the charging device through the first interface at the configured baud rate. The first transmitting unit transmits the second unit data in the transmitting buffer bit by bit to the charging device through the data positive line of the first interface.
[0159] In some embodiments, the first controller controls the first transmitting unit to send second unit data to the charging device through the first interface, specifically including but not limited to the following steps S81-S84:
[0160] S81: The first controller acquires the first sequence and parses the first sequence to obtain the third baud rate.
[0161] In some embodiments, the first data module further includes a second calculation unit connected to the first sending unit, the second calculation unit being used to perform calculations on the second unit data.
[0162] It should be understood that the first sequence can be a sequence generated by the data sender (power supply equipment or charging equipment) according to the communication protocol and communication requirements. The first sequence can also be a predefined fixed sequence. The data sender only needs to select a suitable first sequence from the sequence library, or obtain it through hard coding or parsing a configuration file.
[0163] Specifically, when the power supply equipment sends the second unit of data to the charging equipment as a data transmitter, the first controller of the power supply equipment can generate a first sequence according to the communication protocol and communication requirements, or it can obtain the first sequence from the sequence library, or obtain the first sequence by hard-coding or parsing the sequence configuration file.
[0164] After obtaining the first sequence, the first controller parses specific fields in the first sequence to extract the third baud rate, thereby obtaining the third baud rate. In some embodiments, if the first sequence adopts a dynamic negotiation baud rate mechanism, the first controller calculates the third baud rate based on the negotiation algorithm for the first sequence.
[0165] S82: The first controller configures the baud rate of the first transmitting unit to the third baud rate and controls the first transmitting unit to send the first sequence to the charging device.
[0166] Specifically, the first controller configures the baud rate of the first transmitting unit to be the third baud rate based on the obtained third baud rate. That is, it initializes the communication interface (e.g., UART, SPI, or USB interface) corresponding to the first transmitting unit, calculates the frequency division value based on the third baud rate and the main frequency of the first controller system, writes the calculated frequency division value into the control register, and completes the configuration of the baud rate of the first transmitting unit to be the third baud rate.
[0167] After configuring the baud rate of the first transmitting unit to the third baud rate, the first controller controls the first transmitting unit to transmit the first sequence to the charging device through the first interface at the third baud rate.
[0168] S83: The first controller controls the second computing unit to calculate several second unit data to obtain a third verification code, and appends the third verification code to the second data. The multiple second unit data and the third verification code constitute the second data.
[0169] For example, several second-unit data items to be sent are sorted according to the sending order. The first controller controls the second computing unit to calculate the second-unit data items to obtain the third verification code corresponding to the second data. That is, the second computing unit is controlled to use a specific algorithm (such as CRC check, hash function, or custom verification rule) to calculate the sorted second-unit data items one by one to obtain the third verification code corresponding to the second data, and then appends the third verification code to the second data. Obviously, multiple second-unit data items and the third verification code constitute the second data.
[0170] For example, starting with the first second unit data, the first second unit data is taken as the current second unit data. The second calculation unit uses CRC check (e.g., a predefined polynomial) to calculate the current second unit data to obtain the current second unit verification code corresponding to the current second unit data. Then, the second calculation unit uses CRC check to jointly calculate the next second unit data and the current second unit verification code to obtain the next second unit verification code corresponding to the next second unit data. The second calculation unit calculates the second unit data one by one, that is, it uses CRC check to calculate the corresponding second unit verification code for all the second unit data in sorting order, until the last second unit data is calculated to obtain the last second unit verification code. The last second unit data is the last second unit data in the second data, and the last second unit verification code is the third verification code corresponding to the second data.
[0171] S84: The first controller controls the first transmitting unit to send several second unit data and a third verification code to the charging device through the first interface at a third baud rate.
[0172] For example, the first controller controls the first sending unit to send several second unit data and a third verification code to the charging device through the first interface at a third baud rate. Specifically, the first controller sends a first control command to the first sending unit. Upon receiving the first control command, the first sending unit calculates the bit time interval based on the configured third baud rate and, according to the bit time interval, sends the several second unit data to the charging device one by one in the data sending order. After sending the several second unit data, the first controller sends a second control command to the first sending unit. Upon receiving the second control command, the first sending unit sends the third verification code to the charging device.
[0173] In some embodiments, after the first receiving unit receives the first unit data sent by the charging device through the first interface at a baud rate, the communication method further includes, but is not limited to, the following step S90:
[0174] S90: The first data module stores the first unit of data into the first cache module.
[0175] In some embodiments, the power supply device further includes a first buffer module, wherein the first buffer module is connected to the first receiving unit and is used to store data received by the first receiving unit.
[0176] For example, after the first receiving unit receives the first unit data sent by the charging device through the first interface, the first data module transmits the first unit data received by the first receiving unit to the first cache module, thereby storing the first unit data in the first cache module.
[0177] In summary, the communication method provided in this embodiment of the invention is applied to a power supply device connected to a charging device. The power supply device includes a first controller and a first interface and a first data module respectively connected to the first controller. The first data module includes a first transmitting unit and a first receiving unit, which are respectively connected to the first interface. The charging device includes a second interface and a second data module, which includes a second transmitting unit and a second receiving unit, which are respectively connected to the second interface. The first interface is used to connect to the second interface. The method includes: the first controller controlling the positive and negative data lines of the first interface to short-circuit each other to put the first interface in a first state; the first data module detecting a first voltage sequence received on the negative data line of the first interface; if the first voltage sequence conforms to a predetermined handshake sequence, the first data module generating a first interrupt signal and sending the first interrupt signal to the first controller; the first controller responding to the first interrupt signal controlling the negative and positive data lines of the first interface to disconnect from the short circuit and setting the level of the positive data line of the first interface to a first level; the first controller configuring the baud rate of the first receiving unit; and the first receiving unit receiving the first unit data sent by the charging device through the first interface at the baud rate.
[0178] This invention combines software and hardware to achieve a unified fast-charging communication protocol between power supply equipment and charging equipment, which can reduce costs, shorten development cycles, improve scalability, and facilitate updates and maintenance.
[0179] Next, the communication method provided in the second aspect of the present invention will be described in detail.
[0180] Please see Figure 7 , Figure 7 The schematic diagram illustrates a flowchart of a communication method provided in some embodiments of the present invention.
[0181] Those skilled in the art will understand that the communication method provided in the embodiments of the present invention can be applied to the above-mentioned charging device, such as charging device 200. Specifically, the execution subject of this communication method is one or at least two second processors of the charging device.
[0182] like Figure 7 As shown, the communication method includes, but is not limited to, the following steps S710-S740:
[0183] S710: The second controller controls the detection circuit of the second interface to detect the status of the first interface.
[0184] Specifically, the second controller activates the detection circuit of the second interface through its control logic, instructing the detection circuit to monitor the status of the first interface. For example, the second controller sends control signals (such as GPIO pins, control registers, etc.) to the detection circuit of the second interface. After receiving the control signal, the detection circuit starts working and detects the status of the first interface through a voltage detector or comparator, that is, it detects the level status of the positive and negative data lines of the first interface. Based on the level status of the positive and negative data lines of the first interface, it determines the current status of the first interface.
[0185] In some embodiments, if the positive and negative data lines of the first interface have the same voltage level or the difference is within a preset threshold range, then the positive and negative data lines of the first interface are considered to have the same voltage level. In this case, the first interface is in a first state, and the second interface sends a status feedback flag to the second controller. Upon receiving the status feedback flag, the second controller determines that the first interface is in the first state. The status feedback flag is used to indicate that the first interface is in the first state. It should be understood that the second controller can also read the output of the detection circuit (e.g., an interrupt signal or a status register flag) and determine whether the first interface is in the first state based on the output of the detection circuit.
[0186] S720: In response to the first interface being in the first state, the second data module sends a predetermined handshake sequence to the power supply device through the data negative line of the second interface.
[0187] In some embodiments, after the second controller determines that the first interface is in the first state, it sends an acknowledgment signal that the first interface is in the first state to the second data module. After receiving the acknowledgment signal, the second data module responds to the acknowledgment signal that the first interface is in the first state and sends a predetermined handshake sequence to the power supply device through the data negative line of the second interface.
[0188] Clearly, the pre-defined handshake sequence is a specific set of binary data used to initialize communication, confirm connections, and synchronize between devices. The content and format of the pre-defined handshake sequence are part of the communication protocol, including synchronization bits, identifiers, data fields, and checksums.
[0189] S730: The second controller obtains the voltage of the positive data line of the second interface.
[0190] In some embodiments, the second controller is configured with an internal voltage detection module (e.g., a built-in analog-to-digital converter (ADC)) or an external voltage sampling circuit (e.g., an external voltage comparator). The second controller sets the sampling parameters (e.g., sampling frequency, sampling accuracy, etc.) of the voltage detection module or voltage sampling circuit, and controls the voltage detection module or voltage sampling circuit to start voltage sampling through a control register or control signal, thereby sampling the voltage of the positive data line of the second interface and obtaining the voltage of the positive data line of the second interface.
[0191] S740: If the voltage of the positive data line of the second interface is at the first level, the second controller configures the baud rate of the second transmitting unit and controls the second transmitting unit to send the first unit data to the power supply device through the second interface at the baud rate.
[0192] In some embodiments, the second controller compares the voltage of the data positive line of the second interface with the first level. If the voltage of the data positive line of the second interface is the first level (i.e., equal to the first level), it indicates that the second interface is in a normal communication state and can communicate normally with the first interface. The second controller continues to perform subsequent operations, such as configuring the baud rate of the second transmitting unit and transmitting data.
[0193] Specifically, the second controller obtains and determines the target baud rate, configures the baud rate of the second transmitting unit to be the target baud rate, that is, initializes the communication interface corresponding to the second transmitting unit (such as UART, SPI, I2C or USB interface), calculates the frequency division value according to the target baud rate and the main frequency of the second controller system, writes the calculated frequency division value into the control register, completes the baud rate configuration of the second transmitting unit, and then configures the second transmitting unit into transmission mode so that the second transmitting unit can listen for and obtain the data to be transmitted.
[0194] In some embodiments, the target baud rate is set by predefined parameters. For example, a predetermined handshake sequence contains baud rate information. After receiving the predetermined handshake sequence, the power supply device parses the predetermined handshake sequence according to the communication protocol between the power supply device and the charging device to obtain the target baud rate. In other embodiments, if the communication protocol between the power supply device and the charging device specifies that the target baud rate is a fixed value (e.g., 38400, 57600, 9600 bps, or 115200 bps), the second controller can directly configure the baud rate of the second transmitting unit to be this fixed value.
[0195] In some embodiments, if the baud rate needs to be dynamically adjusted during communication, the second controller can resolve and determine the baud rate through a specific algorithm (e.g., automatic baud rate detection) and configure the baud rate of the second transmitting unit.
[0196] After configuring the baud rate of the second transmitting unit, the second controller controls the second transmitting unit to send the first unit data to the power supply device through the second interface at the configured baud rate. That is, the second controller obtains the first unit data according to the communication protocol and the current context. The first unit data includes information about data to be sent, the current status information of the second controller, and other negotiated data or control commands. The second controller encodes and formats the first unit data to make it conform to the predetermined communication protocol format. The second controller checks and clears the transmitting buffer of the second transmitting unit to ensure that there is no residual data in the buffer. The second controller writes the encoded first unit data into the transmitting buffer of the second transmitting unit and activates the second transmitting unit by means of a control register or a trigger control signal to control the second transmitting unit to send the first unit data to the power supply device through the second interface at the configured baud rate. The second transmitting unit transmits the first unit data in the buffer bit by bit to the power supply device through the data negative line of the second interface.
[0197] In some embodiments, the second controller configures the baud rate of the second transmitting unit, specifically including but not limited to the following steps S741-S742:
[0198] S741: The second controller acquires the first sequence and parses the first sequence to obtain the fourth baud rate.
[0199] It should be understood that the first sequence can be a sequence generated by the data sender (power supply equipment or charging equipment) according to the communication protocol and communication requirements. The first sequence can also be a predefined fixed sequence. The data sender only needs to select a suitable first sequence from the sequence library, or obtain it through hard coding or parsing a configuration file.
[0200] Specifically, when the charging device sends the first unit of data to the power supply device as a data transmitter, the second controller of the charging device can generate the first sequence according to the communication protocol and communication requirements, or it can obtain the first sequence from the sequence library, or obtain the first sequence by hard-coding or parsing the sequence configuration file.
[0201] After obtaining the first sequence, the second controller parses specific fields in the first sequence to extract the fourth baud rate, thereby obtaining the fourth baud rate. In some embodiments, if the first sequence adopts a dynamic negotiation baud rate mechanism, the second controller calculates the fourth baud rate based on the negotiation algorithm for the first sequence.
[0202] S742: The second controller configures the fourth baud rate as the baud rate of the second transmitting unit and controls the second transmitting unit to send the first sequence to the power supply equipment.
[0203] Specifically, the second controller configures the baud rate of the second transmitting unit to the fourth baud rate based on the obtained fourth baud rate. This involves initializing the communication interface (e.g., UART, SPI, or USB) corresponding to the second transmitting unit, calculating the frequency division value based on the fourth baud rate and the main frequency of the second controller system, writing the calculated frequency division value into the control register, configuring the baud rate of the second transmitting unit to the fourth baud rate, and configuring the second transmitting unit to transmit mode so that the second transmitting unit can listen for and acquire the data to be transmitted.
[0204] After configuring the baud rate of the second transmitting unit to the fourth baud rate, the second controller controls the second transmitting unit to transmit the first sequence to the power supply device through the second interface at the fourth baud rate.
[0205] In some embodiments, the second transmitting unit is controlled to transmit the first unit data to the power supply device through the second interface at a baud rate, specifically including but not limited to the following steps S743-S744:
[0206] S743: The second controller obtains several first unit data from the second data module, calculates the several first unit data to obtain a second verification code, and appends the second verification code to the first data. Multiple first unit data and the second verification code constitute the first data.
[0207] Specifically, the second controller obtains several first unit data to be sent from the second data module through a data bus or communication interface (e.g., UART, SPI, I2C or USB).
[0208] For example, several first-unit data items to be sent are sorted according to the sending order. The second controller uses a specific algorithm (e.g., CRC check, hash function, or custom verification rule) to calculate each of the sorted first-unit data items to obtain the second verification code corresponding to the first data item, and then appends the second verification code to the first data item. Obviously, multiple first-unit data items and the second verification code constitute the first data item.
[0209] Specifically, starting from the first unit of data, the first unit of data is taken as the current unit of data. The second controller uses CRC check (e.g., a predefined polynomial) to calculate the current unit of data to obtain the current unit of data verification code. Then, the second controller uses CRC check to jointly calculate the next unit of data and the current unit of data verification code to obtain the next unit of data verification code. The second controller calculates the unit of data one by one, that is, it uses CRC check to calculate the corresponding unit of data verification code for all the unit of data in sorting order, until the last unit of data verification code is calculated. The last unit of data is the last unit of data in the second data, and the last unit of data verification code is the second verification code corresponding to the first data.
[0210] S744: The second controller controls the second transmitting unit to send several units of first unit data and the second verification code to the power supply equipment at a baud rate through the second interface.
[0211] For example, the second controller controls the second sending unit to send several first unit data and a second verification code to the power supply device through the second interface at a configured baud rate. Specifically, the second controller sends a first control command to the second sending unit. Upon receiving the first control command, the second sending unit calculates the bit time interval based on the configured baud rate and, according to the bit time interval, sends the several first unit data to the power supply device one by one in the data transmission order. After sending the several first unit data, the second controller sends a second control command to the second sending unit. Upon receiving the second control command, the second sending unit sends the second verification code to the power supply device.
[0212] In some embodiments, the second transmitting unit is controlled to transmit the first unit data to the power supply device through the second interface at a baud rate, specifically including but not limited to the following steps S745-S746:
[0213] S745: The second controller controls the third computing unit to calculate several first unit data to obtain a second verification code, and appends the second verification code to the first data. Multiple first unit data and the second verification code constitute the first data.
[0214] In some embodiments, the second data module further includes a third calculation unit connected to the second sending unit, the third calculation unit being used to perform calculations on the first unit data.
[0215] For example, several first-unit data items to be sent are sorted according to the sending order. The second controller controls the third calculation unit to calculate each of the sorted first-unit data items one by one to obtain the second verification code corresponding to the first data. That is, the third calculation unit is controlled to use a specific algorithm (such as CRC check, hash function, or custom verification rule) to calculate each of the sorted first-unit data items one by one to obtain the second verification code corresponding to the first data. It can be understood that multiple first-unit data items and second verification codes constitute the first data.
[0216] For example, starting from the first unit data, the first unit data is taken as the current unit data. The third calculation unit uses CRC check (e.g., a predefined polynomial) to calculate the current unit data to obtain the current unit verification code. Then, the third calculation unit uses CRC check to jointly calculate the next unit data and the current unit verification code to obtain the next unit verification code. The third calculation unit calculates the unit data one by one, that is, it uses CRC check to calculate the corresponding unit verification code for all the unit data in sorting order, until the last unit data is calculated. The last unit data is the last unit data in the first data, and the last unit verification code is the second verification code corresponding to the first data.
[0217] S746: The second controller controls the second transmitting unit to send several units of first unit data and the second verification code to the power supply equipment at a baud rate through the second interface.
[0218] For example, the second controller controls the second sending unit to send several first unit data and a second verification code to the power supply device through the second interface at a configured baud rate. Specifically, the second controller sends a first control command to the second sending unit. Upon receiving the first control command, the second sending unit calculates the bit time interval based on the configured baud rate and, according to the bit time interval, sends the several first unit data to the power supply device one by one in the data transmission order. After sending the several first unit data, the second controller sends a second control command to the second sending unit. Upon receiving the second control command, the second sending unit sends the second verification code to the power supply device.
[0219] In some embodiments, after controlling the second transmitting unit to transmit the first unit data to the power supply device at a baud rate through the second interface, the communication method further includes, but is not limited to, the following steps S750-S790:
[0220] S750: The second controller configures the initial baud rate of the second receiving unit.
[0221] Specifically, the second controller acquires the initial baud rate and sets the baud rate of the second receiving unit as the initial baud rate, that is, it initializes the communication interface (such as UART, SPI, I2C or USB interface) corresponding to the second receiving unit. Based on the initial baud rate and the main frequency of the second controller system, it calculates the frequency division value and writes the calculated frequency division value into the control register to complete the configuration of the initial baud rate of the second receiving unit.
[0222] In some embodiments, the initial baud rate is the baud rate specified by the communication protocol between the power supply device and the charging device (e.g., 38400, 57600, 9600bps or 115200bps, etc.), and the second controller can configure the initial baud rate of the second receiving unit according to the communication protocol.
[0223] S760: The second receiving unit receives the first sequence sent by the power supply equipment based on the initial baud rate, and calculates the first sequence to obtain the fifth baud rate.
[0224] It should be understood that the first sequence can be a sequence generated by the data sender (power supply equipment or charging equipment) according to the communication protocol and communication requirements. The first sequence can also be a predefined fixed sequence. The data sender only needs to select a suitable first sequence from the sequence library, or obtain it through hard coding or parsing a configuration file.
[0225] Specifically, the second receiving unit listens to the data line of the second interface based on the initial baud rate and receives the first sequence sent by the power supply device. After receiving the first sequence sent by the power supply device, the second receiving unit performs calculations on the first sequence, that is, measures the duration of each bit in the first sequence (i.e., the time from one signal edge to the next signal edge), calculates the total duration of the middle 4 bits of the first sequence, and uses the average of the total duration of the middle 4 bits as the fifth baud rate.
[0226] S770: The second data module generates a fourth interrupt signal and sends the fourth interrupt signal to the second controller.
[0227] S780: In response to the fourth interrupt signal, the second controller obtains the fifth baud rate from the second data module and configures the fifth baud rate as the baud rate of the second receiving unit.
[0228] In some embodiments, the second data module can generate a fourth interrupt signal by reserving an output signal line (e.g., a GPIO pin) in the second data module for outputting an interrupt signal. After the second receiving unit calculates the fifth baud rate from the first sequence, the second data module triggers hardware logic to switch the state of the output signal line from low to high or generate a pulse signal to obtain the fourth interrupt signal. The fourth interrupt signal is then sent to the second controller. The fourth interrupt signal can be configured to be edge-triggered (e.g., rising edge or falling edge) or level-triggered (e.g., high level or low level).
[0229] Specifically, upon receiving the fourth interrupt signal from the second data module, the second controller triggers the interrupt service routine, immediately stopping the current operation and executing the interrupt service routine. The second controller reads the fifth baud rate from the second data module via a data bus or communication interface (e.g., UART, SPI, I2C, or USB), thereby obtaining the fifth baud rate.
[0230] The second controller reconfigures the baud rate of the second receiving unit to the fifth baud rate based on the read fifth baud rate. This involves initializing the communication interface corresponding to the second receiving unit (e.g., UART, SPI, I2C, or USB), calculating the frequency division value based on the fifth baud rate and the main frequency of the second controller system, writing the calculated frequency division value into the control register, configuring the baud rate of the second receiving unit to the fifth baud rate, and configuring the second receiving unit to receive mode so that the second receiving unit can listen to the data line of the second interface to receive data sent to the data line of the second interface.
[0231] S790: The second controller controls the second receiving unit to receive the second unit data sent by the power supply equipment through the second interface at the fifth baud rate.
[0232] For example, after configuring the second receiving unit to a fifth baud rate and configuring it to data receiving mode, the second controller controls the second receiving unit to receive the second unit of data sent by the power supply device at the fifth baud rate through the second interface. Specifically, the second controller sends a control signal or command to the second receiving unit. Upon receiving the control signal or command, the second receiving unit listens to the signal line of the second interface. When it receives the start bit (low-level signal) sent by the power supply device through the second interface, it initiates the data frame reception process. The start bit is used to mark the beginning of the data frame and to synchronize the clocks of the receiving end (charging device) and the sending end (power supply device).
[0233] The second receiving unit calculates the bit time interval based on the fifth baud rate to ensure that the sampling point of each data bit is aligned with the power supply. After the start bit, the second receiving unit sequentially samples the 8 data bits and parity bit received through the second interface. Understandably, the sampling point of each data bit is calculated based on the baud rate clock, and sampling is performed in the middle of the data bit period to avoid edge interference.
[0234] After the data bits and parity bits, the second receiving unit samples the stop bit (i.e., high-level signal) received through the second interface and checks the stop bit to verify the integrity of the data frame. After receiving the start bit, data bits, parity bits and stop bits through the second interface, it indicates that a complete data frame (second unit data) has been received. That is, the second receiving unit receives the second unit data sent by the power supply equipment through the second interface at the fifth baud rate.
[0235] Understandably, in some communication protocols, a complete data frame (second unit data) may not include a check bit. Those skilled in the art can add or omit the check bit to the second unit data as needed, and the embodiments of the present invention do not impose any limitations on this.
[0236] In some embodiments, after the second controller controls the second receiving unit to receive the second unit data sent by the power supply device at a fifth baud rate through the second interface, the communication method further includes, but is not limited to, the following steps S800-S900:
[0237] S800: The second data module generates a fifth interrupt signal and sends the fifth interrupt signal to the second controller.
[0238] In some embodiments, the second data module can generate a fifth interrupt signal by reserving an output signal line (e.g., a GPIO pin) in the second data module for outputting an interrupt signal. After the second controller controls the second receiving unit to receive the second unit data sent by the power supply device at a fifth baud rate through the second interface, the second data module triggers hardware logic to switch the state of the output signal line from low level to high level or generate a pulse signal to obtain the fifth interrupt signal, and sends the fifth interrupt signal to the second controller. The fifth interrupt signal can be configured as edge-triggered (e.g., rising edge or falling edge) or level-triggered (e.g., high level or low level).
[0239] S900: The second controller responds to the fifth interrupt signal and reads the second unit data from the second data module.
[0240] Specifically, upon receiving the fifth interrupt signal from the second data module, the second controller triggers the interrupt service routine, immediately stopping the current operation and executing the interrupt service routine. The second controller reads the received second unit data from the second data module via a data bus or communication interface (e.g., UART, SPI, I2C, or USB).
[0241] In some embodiments, after the second controller reads the received second unit data from the second data module, the communication method further includes, but is not limited to, the following steps S10A-S40A:
[0242] S10A: The second controller calculates the current second unit data and obtains the current second unit verification code corresponding to the current second unit data.
[0243] S20A: The second controller calculates the next second unit data and the current second unit verification code to obtain the next second unit verification code corresponding to the next second unit data.
[0244] Specifically, the received second-unit data is sorted according to the receiving order. The second controller uses a specific algorithm (e.g., CRC check, hash function or custom check rule) to read and calculate the sorted second-unit data one by one to obtain the final fourth verification code.
[0245] For example, starting with the first second unit data, the first second unit data is taken as the current second unit data. The second controller uses CRC check (e.g., a predefined polynomial) to calculate the current second unit data to obtain the current second unit verification code corresponding to the current second unit data.
[0246] For example, the second controller uses CRC check (e.g., a predefined polynomial) to jointly calculate the next second unit data and the current second unit verification code to obtain the next second unit verification code corresponding to the next second unit data.
[0247] S30A: The second controller executes S10A-S20A in a loop until it calculates the second unit verification code corresponding to the last second unit data and the second unit data preceding the last second unit data, and obtains the last second unit verification code corresponding to the last second unit data. The last second unit data is the last second unit data in the second data, and the last second unit verification code is the fourth verification code corresponding to the second data. The second data includes multiple second unit data and a third verification code. The third verification code is the verification code obtained by the power supply equipment from the calculation of multiple second unit data.
[0248] Specifically, the second controller reads the second unit data one by one, and uses CRC check to repeatedly execute steps S10A and S20A to calculate the corresponding second unit verification code for all the second unit data, until the last second unit data is calculated. That is, the second controller repeatedly executes S10A and S20A until the second unit verification code corresponding to the last second unit data and the second unit data preceding the last second unit data is calculated to obtain the last second unit verification code corresponding to the last second unit data.
[0249] It is understandable that the second data includes multiple second unit data and a third verification code. The last second unit data is the last second unit data of the second data, and the last second unit verification code is the fourth verification code corresponding to the second data. The third verification code is a verification code obtained by the power supply equipment from the multiple second unit data. The power supply equipment calculates the multiple second unit data to obtain the third verification code and appends the third verification code to the second data.
[0250] S40A: After receiving the second data, the second controller extracts the third verification code from the second data. If the third verification code and the fourth verification code are the same, the second receiving unit successfully receives the second data.
[0251] Specifically, after receiving the second data, the second controller extracts the third verification code from the received complete second data and compares the third verification code with the fourth verification code. If the third verification code and the fourth verification code are the same, it means that the second receiving unit has successfully received the second data.
[0252] In some embodiments, if the third verification code and the fourth verification code are different, it indicates that the second data is incorrect or has been tampered with. The second controller may request the power supply to resend the second data or perform other processing operations, such as issuing an alarm reminder for data reception error.
[0253] In some embodiments, the communication method further includes, but is not limited to, the following steps S50A-S60A:
[0254] S50A: The second controller controls the fourth calculation unit to calculate several second unit data to obtain the fourth verification code corresponding to the second data. The second data includes multiple second unit data and a third verification code. The third verification code is the verification code obtained by the power supply equipment from calculating multiple second unit data.
[0255] In some embodiments, the second data module further includes a fourth calculation unit connected to the second receiving unit, the fourth calculation unit being used to perform calculations on the second unit data.
[0256] Specifically, the received second unit data is sorted according to the data reception order. The second controller controls the fourth calculation unit to calculate the sorted second unit data one by one to obtain the fourth verification code corresponding to the second data. That is, the fourth calculation unit is controlled to use a specific algorithm (such as CRC check, hash function or custom check rule) to calculate the sorted second unit data one by one to obtain the fourth verification code corresponding to the second data.
[0257] It is understood that the second data includes multiple second unit data and a third verification code. The third verification code is a verification code obtained by the power supply equipment through calculation of multiple second unit data. The power supply equipment calculates multiple second unit data to obtain the third verification code and appends the third verification code to the second data.
[0258] For example, starting from the first second unit data, the first second unit data is taken as the current second unit data. The fourth calculation unit uses CRC check (e.g., a predefined polynomial) to calculate the current second unit data to obtain the current second unit verification code corresponding to the current second unit data. Then, the fourth calculation unit uses CRC check to jointly calculate the next second unit data and the current second unit verification code to obtain the next second unit verification code corresponding to the next second unit data. The fourth calculation unit calculates the second unit data one by one, that is, it uses CRC check to calculate the corresponding second unit verification code for all the second unit data in sorting order, until the last second unit data is calculated to obtain the last second unit verification code. The last second unit data is the last second unit data in the second data, and the last second unit verification code is the fourth verification code corresponding to the second data.
[0259] S60A: The second controller acquires the fourth verification code and extracts the third verification code from the second data. If the third verification code and the fourth verification code are the same, the second receiving unit successfully receives the second data.
[0260] Specifically, after calculating several units of second data to obtain the fourth verification code, the fourth calculation unit stores the fourth verification code in a register, and the second controller retrieves the fourth verification code from the register. The second controller also extracts the third verification code corresponding to the second data from the read second data and compares the third verification code with the fourth verification code. If the third verification code and the fourth verification code are the same, it indicates that the second receiving unit has successfully received the second data.
[0261] In some embodiments, if the third verification code and the fourth verification code are different, it indicates that the second data is incorrect or has been tampered with. The second controller may request the power supply to resend the second data or perform other processing operations, such as issuing an alarm reminder for data reception error.
[0262] In some embodiments, after the second controller controls the second receiving unit to receive the second unit data sent by the power supply device through the second interface at a fifth baud rate, the communication method further includes, but is not limited to, the following step S70A:
[0263] S70A: The second data module stores the second unit data into the second cache module.
[0264] In some embodiments, the charging device further includes a second buffer module, wherein the second buffer module is connected to the second receiving unit and is used to store data received by the second receiving unit.
[0265] For example, after the second receiving unit receives the second unit data sent by the power supply device through the second interface, the second data module transmits the second unit data received by the second receiving unit to the second buffer module, thereby storing the second unit data in the second buffer module.
[0266] In summary, the communication method provided in this embodiment of the invention is applied to a charging device connected to a power supply device. The power supply device includes a first interface and a first data module. The first data module includes a first transmitting unit and a first receiving unit, which are respectively connected to the first interface. The charging device includes a second controller and a second interface and a second data module respectively connected to the second controller. The second data module includes a second transmitting unit and a second receiving unit, which are respectively connected to the second interface. The first interface is used to connect to the second interface. The method includes: the second controller controlling the detection circuit of the second interface to detect the state of the first interface; the second data module responding to the first interface being in a first state by sending a predetermined handshake sequence to the power supply device through the negative data line of the second interface; the second controller obtaining the voltage of the positive data line of the second interface; if the voltage of the positive data line of the second interface is a first level, the second controller configuring the baud rate of the second transmitting unit and controlling the second transmitting unit to send a first unit of data to the power supply device through the second interface at the baud rate.
[0267] This invention combines software and hardware to achieve a unified fast-charging communication protocol between power supply equipment and charging equipment, which can reduce costs, shorten development cycles, improve scalability, and facilitate updates and maintenance.
[0268] This invention provides a computer-readable storage medium storing processor-executable computer program instructions. When invoked by a processor, the computer program instructions cause the processor to execute any of the communication methods provided in this invention, or to execute the steps in any possible implementation of any of the communication methods provided in this invention.
[0269] Those skilled in the art will understand that the embodiments provided by this invention are merely illustrative. The order in which the steps in the methods of the embodiments are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The order can be adjusted, merged, and deleted according to actual needs. Modules or sub-modules, units or sub-units in the apparatus or system of the embodiments can be merged, divided, and deleted according to actual needs. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0270] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or it can be implemented using hardware. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0271] It should be noted that the above embodiments are for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be construed as limiting the scope of protection of the present invention. Those skilled in the art can understand that all or part of the processes of the above embodiments can be implemented by modifying the technical solutions described in the embodiments of the present invention, or by making equivalent substitutions for some of the technical features. It is understood that these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and should be considered as equivalent changes and modifications made based on the embodiments of the present invention, all of which should fall within the scope of the claims of the present invention.
Claims
1. A communication method applied to power supply equipment, characterized in that, The power supply device is connected to the charging device. The power supply device includes a first controller and a first interface and a first data module that are respectively communicatively connected to the first controller. The first data module includes a first transmitting unit and a first receiving unit. The first transmitting unit and the first receiving unit are respectively connected to the first interface. The charging device includes a second interface and a second data module. The second data module includes a second transmitting unit and a second receiving unit. The second transmitting unit and the second receiving unit are respectively connected to the second interface. The first interface is used to connect to the second interface. The method includes: The first controller controls the positive and negative data lines of the first interface to be short-circuited to each other, so that the first interface is in a first state; The first data module detects the first voltage sequence received on the negative data line of the first interface; If the first voltage sequence conforms to a predetermined handshake sequence, the first data module generates a first interrupt signal and sends the first interrupt signal to the first controller; The first controller responds to the first interrupt signal by controlling the data negative line and data positive line of the first interface to disconnect the short circuit, and sets the level of the data positive line of the first interface to the first level; The first controller configures the baud rate of the first receiving unit; The first receiving unit receives the first unit of data sent by the charging device through the first interface at the baud rate.
2. The method according to claim 1, characterized in that, The first controller configures the baud rate of the first receiving unit, including: The first controller configures the initial baud rate of the first receiving unit; The first receiving unit receives the first sequence sent by the charging device based on the initial baud rate, and calculates the first baud rate based on the first sequence; The first receiving unit generates a second interrupt signal and sends the second interrupt signal to the first controller; In response to the second interrupt signal, the first controller obtains the first baud rate from the first data module and configures the baud rate of the first receiving unit to be the first baud rate.
3. The method according to claim 1, characterized in that, After the first receiving unit receives the first unit of data sent by the charging device through the first interface at the baud rate, the method further includes: The first data module generates a third interrupt signal and sends the third interrupt signal to the first controller; In response to the third interrupt signal, the first controller reads the first unit data from the first data module.
4. The method according to claim 3, characterized in that, The method further includes: S10: The first controller calculates the current first unit data to obtain the current first unit verification code corresponding to the current first unit data; S20: The first controller calculates the next first unit data and the current first unit verification code to obtain the next first unit verification code corresponding to the next first unit data; S30: The first controller executes S10-S20 in a loop until it calculates the first unit verification code corresponding to the last first unit data and the first unit data preceding the last first unit data to obtain the last first unit verification code corresponding to the last first unit data. The last first unit data is the last first unit data in the first data, and the last first unit verification code is the first verification code corresponding to the first data. The first data includes multiple first unit data and second verification codes. The second verification code is the verification code obtained by the charging device by calculating multiple first unit data. S40: After receiving the first data, the first controller extracts the second verification code from the first data. If the first verification code and the second verification code are the same, the first receiving unit successfully receives the first data. S50: After successfully receiving the first data, the first controller controls the first sending unit to send the second unit data to the charging device through the first interface.
5. The method according to claim 4, characterized in that, The first controller controls the first transmitting unit to send second unit data to the charging device through the first interface, including: The first controller acquires a first sequence and parses the first sequence to obtain a second baud rate; The first controller configures the baud rate of the first transmitting unit to the second baud rate, and controls the first transmitting unit to transmit the first sequence to the charging device; The first controller obtains several second unit data from the first data module, calculates the several second unit data to obtain a third verification code, and appends the third verification code to the second data. The multiple second unit data and the third verification code constitute the second data. The first controller controls the first sending unit to send the plurality of second unit data and the third verification code to the charging device through the first interface at the second baud rate.
6. The method according to claim 3, characterized in that, The first unit data includes several units, the first data module further includes a first computing unit, and the method further includes: The first controller controls the first calculation unit to calculate the plurality of first unit data to obtain a first verification code corresponding to the first data. The first data includes a plurality of first unit data and a second verification code. The second verification code is a verification code obtained by the charging device by calculating the plurality of first unit data. The first controller acquires the first verification code and extracts the second verification code from the first data. If the first verification code and the second verification code are the same, the first receiving unit successfully receives the first data. After successfully receiving the first data, the first controller controls the first sending unit to send the second unit data to the charging device through the first interface.
7. The method according to claim 6, characterized in that, The first data module further includes a second computing unit, and the first controller controls the first sending unit to send second unit data to the charging device through the first interface, including: The first controller acquires a first sequence and parses the first sequence to obtain a third baud rate; The first controller configures the baud rate of the first transmitting unit to the third baud rate and controls the first transmitting unit to transmit the first sequence to the charging device; The first controller controls the second computing unit to perform calculations on a plurality of second unit data to obtain a third verification code, and appends the third verification code to the second data, wherein the plurality of second unit data and the third verification code constitute the second data; The first controller controls the first sending unit to send the plurality of second unit data and the third verification code to the charging device through the first interface at the third baud rate.
8. The method according to any one of claims 1-7, characterized in that, The power supply device further includes a first buffer module connected to the first receiving unit. After the first receiving unit receives the first unit data sent by the charging device through the first interface at the baud rate, the method further includes: The first data module stores the first unit data in the first cache module.
9. A communication method applied to a charging device, characterized in that, The charging device is connected to the power supply device. The power supply device includes a first interface and a first data module. The first data module includes a first transmitting unit and a first receiving unit. The first transmitting unit and the first receiving unit are respectively connected to the first interface. The charging device includes a second controller and a second interface and a second data module that are respectively communicatively connected to the second controller. The second data module includes a second transmitting unit and a second receiving unit. The second transmitting unit and the second receiving unit are respectively connected to the second interface. The first interface is used to connect to the second interface. The method includes: The second controller controls the detection circuit of the second interface to detect the status of the first interface; In response to the first interface being in a first state, the second data module sends a predetermined handshake sequence to the power supply device through the negative data line of the second interface. The first state indicates that the positive data line and the negative data line of the first interface are short-circuited. The second controller acquires the voltage of the positive data line of the second interface; If the voltage of the positive data line of the second interface is at the first level, the second controller configures the baud rate of the second transmitting unit and controls the second transmitting unit to transmit the first unit of data to the power supply device through the second interface at the baud rate, wherein the first level is the same as the level of the positive data line of the first interface.
10. The method according to claim 9, characterized in that, The second controller configures the baud rate of the second transmitting unit, including: The second controller acquires the first sequence and parses the first sequence to obtain the fourth baud rate; The second controller configures the fourth baud rate as the baud rate of the second transmitting unit and controls the second transmitting unit to send the first sequence to the power supply device.
11. The method according to claim 9, characterized in that, The control of the second transmitting unit to transmit the first unit data to the power supply device at the baud rate through the second interface includes: The second controller obtains several first unit data from the second data module, calculates the several first unit data to obtain a second verification code, and appends the second verification code to the first data. The first data consists of multiple first unit data and the second verification code. The second controller controls the second sending unit to send the plurality of first unit data and the second verification code to the power supply equipment through the second interface at the baud rate.
12. The method according to claim 9, characterized in that, The second data module further includes a third calculation unit, and the step of controlling the second sending unit to send the first unit data to the power supply device through the second interface at the baud rate includes: The second controller controls the third computing unit to calculate a plurality of first unit data to obtain a second verification code, and appends the second verification code to the first data, wherein the plurality of first unit data and the second verification code constitute the first data; The second controller controls the second sending unit to send the plurality of first unit data and the second verification code to the power supply equipment through the second interface at the baud rate.
13. The method according to claim 12, characterized in that, After controlling the second transmitting unit to transmit the first unit data to the power supply device at the baud rate through the second interface, the method further includes: The second controller configures the initial baud rate of the second receiving unit; The second receiving unit receives the first sequence sent by the power supply device based on the initial baud rate, and calculates the first sequence to obtain the fifth baud rate; The second data module generates a fourth interrupt signal and sends the fourth interrupt signal to the second controller; In response to the fourth interrupt signal, the second controller obtains the fifth baud rate from the second data module and configures the fifth baud rate as the baud rate of the second receiving unit; The second controller controls the second receiving unit to receive the second unit of data sent by the power supply device through the second interface at the fifth baud rate.
14. The method according to claim 13, characterized in that, After the second controller controls the second receiving unit to receive the second unit data sent by the power supply device through the second interface at the fifth baud rate, the method further includes: The second data module generates a fifth interrupt signal and sends the fifth interrupt signal to the second controller; In response to the fifth interrupt signal, the second controller reads the second unit data from the second data module.
15. The method according to claim 14, characterized in that, The method further includes: S10A: The second controller calculates the current second unit data to obtain the current second unit verification code corresponding to the current second unit data; S20A: The second controller calculates the next second unit data and the current second unit verification code to obtain the next second unit verification code corresponding to the next second unit data; S30A: The second controller executes S10A-S20A in a loop until it calculates the second unit verification code corresponding to the last second unit data and the second unit data preceding the last second unit data to obtain the last second unit verification code corresponding to the last second unit data. The last second unit data is the last second unit data in the second data, and the last second unit verification code is the fourth verification code corresponding to the second data. The second data includes multiple second unit data and a third verification code. The third verification code is the verification code obtained by the power supply equipment by calculating multiple second unit data. S40A: After receiving the second data, the second controller extracts the third verification code from the second data. If the third verification code and the fourth verification code are the same, the second receiving unit successfully receives the second data.
16. The method according to claim 14, characterized in that, The second unit data includes several units, the second data module further includes a fourth calculation unit, and the method further includes: The second controller controls the fourth calculation unit to calculate the plurality of second unit data to obtain a fourth verification code corresponding to the second data. The second data includes a plurality of second unit data and a third verification code. The third verification code is a verification code obtained by the power supply equipment by calculating the plurality of second unit data. The second controller acquires the fourth verification code and extracts the third verification code from the second data. If the third verification code and the fourth verification code are the same, the second receiving unit successfully receives the second data.
17. The method according to any one of claims 13-16, characterized in that, The charging device further includes a second buffer module connected to the second receiving unit. After the second controller controls the second receiving unit to receive the second unit data sent by the power supply device through the second interface at the fifth baud rate, the method further includes: The second data module stores the second unit data in the second cache module.
18. A power supply device, characterized in that, include: The system comprises a first cache module, a first controller, a first interface and a first data module that are communicatively connected to the first controller. The first data module includes a first sending unit, a first receiving unit, a first computing unit and a second computing unit. The first sending unit and the second computing unit are connected. The first receiving unit is connected to the first cache module and the first computing unit respectively. The first sending unit and the first receiving unit are also connected to the first interface respectively. The first controller includes: A first processor and a first memory communicatively connected to the first processor; The first memory stores computer program instructions executable by the first processor, which, when invoked by the first processor, cause the first processor to execute the communication method as described in any one of claims 1-8.
19. A charging device, characterized in that, include: The system comprises a second cache module, a second controller, a second interface and a second data module that are communicatively connected to the second controller. The second data module includes a second sending unit, a second receiving unit, a third computing unit and a fourth computing unit. The second sending unit and the third computing unit are connected. The second receiving unit is connected to the second cache module and the fourth computing unit, respectively. The second sending unit and the second receiving unit are also connected to the second interface, respectively. The second controller includes: A second processor and a second memory communicatively connected to the second processor; The second memory stores computer program instructions executable by the second processor, which, when invoked by the second processor, cause the second processor to perform the communication method as described in any one of claims 9-17.
20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores processor-executable computer program instructions, which, when invoked by the processor, cause the processor to perform the communication method as described in any one of claims 1-8, or to perform the communication method as described in any one of claims 9-17.
Citation Information
Patent Citations
Communication detection method, device, equipment, system and storage medium
CN117335510A
Fill protocol conversion system, chip and data line soon
CN206559073U