Communication method, power supply equipment, charging equipment and storage medium
By combining software and hard-core communication protocols in power supply equipment and charging equipment, the problems of high cost, long development cycle and poor scalability in the existing technology are solved, and more efficient development and maintenance are achieved.
Patent Information
- Application Number
- CN202411981181.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In the prior art, the cost is high, the development cycle is long and the scalability is poor when using hardware or software to implement the converged fast charging protocol.
Through the combination of software and hardware, a communication method is provided, applied between the power supply device and the charging device, and the data line status of the interface is controlled by the controller, the voltage sequence is detected, the baud rate is configured, and the fused fast charging communication protocol is realized.
Reduces costs, shortens development cycle, improves scalability, and is conducive to subsequent updates and maintenance.
Smart Images

Figure CN119966023A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of communication technology, and in particular to a communication method, a power supply device, a charging device, and a storage medium. Background Art
[0002] On May 28, 2021, the Telecommunications Terminal Industry Association released the converged fast charging standard "Mobile Terminal Converged Fast Charging Technical Specifications". The following year, the new generation of converged fast charging protocol - UFCS converged fast charging protocol was officially launched.
[0003] There are two main solutions for implementing the UFCS protocol: 1) through software implementation and 2) through hardware circuit implementation. In the software implementation, the communication negotiation port of the controller interacts with the microcontroller in the form of a serial port. Due to the limitations of the microcontroller's scale and performance, the implementation cost is high. In the hardware circuit implementation, the circuit is built in the form of a pure digital logic circuit. The finished circuit must undergo physical design and reliability verification. The design and development cycle is long, the time to market is slow, the basic logic of the circuit has been solidified, and the scalability is poor, which is not conducive to subsequent updates and maintenance. Summary of the invention
[0004] In view of this, one purpose of an embodiment of the present invention is to provide a communication method, a power supply device, a charging device and a storage medium, aiming to solve the technical problems of high cost, long development cycle and poor scalability when simply using hardware or software to implement the integrated fast charging protocol in the prior art.
[0005] To solve the above technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present invention provides a communication method, which is applied to a power supply device, wherein the power supply device is connected to a charging device, wherein the power supply device includes a first controller and a first interface and a first data module respectively connected to the first controller for communication, wherein the first data module includes a first sending unit and a first receiving unit, wherein the first sending unit and the first receiving unit are respectively connected to the first interface, wherein the charging device includes a second interface and a second data module, wherein the second data module includes a second sending unit and a second receiving unit, wherein the second sending 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;
[0007] The method comprises:
[0008] The first controller controls the data positive line and the data negative line 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 a first voltage sequence received on a 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 controls the data negative line and the data positive line of the first interface to be disconnected and short-circuited in response to the first interrupt signal, and sets the level of the data positive line of the first interface to be a first level;
[0012] The first controller configures the baud rate of the first receiving unit;
[0013] The first receiving unit receives a first unit of data sent by the charging device through the first interface at the baud rate.
[0014] In a second aspect, an embodiment of the present invention provides a communication method, which is 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 sending unit and a first receiving unit, the first sending 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 connected to the second controller for communication, the second data module includes a second sending unit and a second receiving unit, the second sending 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 comprises:
[0016] The second controller controls the detection circuit of the second interface to detect the state of the first interface;
[0017] The second data module sends a predetermined handshake sequence to the power supply device through the data negative line of the second interface in response to the first interface being in the first state;
[0018] The second controller obtains the voltage of the data positive line of the second interface;
[0019] If the voltage of the data positive line of the second interface is at a first level, the second controller configures the baud rate of the second sending unit, and controls the second sending unit to send a first unit of data to the power supply device through the second interface at the baud rate.
[0020] In a third aspect, an embodiment of the present invention provides a power supply device, including:
[0021] a first cache module, a first controller, a first interface and a first data module that are communicatively connected to the first controller, wherein the first data module comprises a first sending unit, a first receiving unit, a first calculating unit and a second calculating unit, wherein the first sending unit is connected to the second calculating unit, the first receiving unit is connected to the first cache module and the first calculating unit respectively, and the first sending unit and the first receiving unit are also connected to the first interface respectively;
[0022] The first controller comprises:
[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, and when the computer program instructions are called by the first processor, the first processor executes any one of the communication methods described in the first aspect.
[0025] In a fourth aspect, an embodiment of the present invention provides a charging device, including:
[0026] a second cache module, a second controller, and a second interface and a second data module that are communicatively connected to the second controller, wherein the second data module comprises a second sending unit, a second receiving unit, a third computing unit, and a fourth computing unit, wherein the second sending unit is connected to the third computing unit, the second receiving unit is connected to the second cache module and the fourth computing unit respectively, and the second sending unit and the second receiving unit are also connected to the second interface respectively;
[0027] The second controller comprises:
[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, and when the computer program instructions are called by the second processor, the second processor executes any one of the communication methods described in the second aspect.
[0030] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions executable by a processor are stored, and when the computer program instructions are called by the processor, the processor executes any one of the communication methods described in the first aspect, or executes any one of the communication methods described in the second aspect.
[0031] The embodiments of the present invention have the following beneficial effects: Different from the prior art, the communication method provided by the embodiments of the present invention is applied to a power supply device, the power supply device is 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 for communication, the first data module includes a first sending unit and a first receiving unit, the first sending 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 sending unit and a second receiving unit, the second sending 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 data positive line and the data negative line of the first interface to short-circuit each other so that the first interface is in a first state, the first data module detects a first voltage sequence received on the data negative line of the first interface, if the first voltage sequence meets 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, controls the data negative line and the data positive line of the first interface to disconnect and short-circuit, and sets the level of the data positive line of the first interface to be a first level, the first controller configures the baud rate of the first receiving unit, and the first receiving unit receives the first unit data sent by the charging device through the first interface at the baud rate.
[0032] The embodiment of the present invention realizes a fusion fast charging communication protocol between a power supply device and a charging device by combining software and hardware, which can reduce costs, shorten the development cycle, improve scalability, and facilitate updating and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following is a brief introduction to the drawings required for the description of the prior art or the embodiments. Obviously, the drawings described below only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection. For those of ordinary skill in the art, other related drawings can also be obtained based on these drawings without creative work.
[0034] Figure 1 is a schematic diagram of the structure of a communication system provided by some embodiments of the present invention;
[0035] Figure 2 is a schematic diagram of the structure of a power supply device provided by some embodiments of the present invention;
[0036] Figure 3 is a schematic diagram of the structure of a charging device provided by some embodiments of the present invention;
[0037] Figure 4 is a schematic diagram of the structure of a first controller in a power supply device provided in some embodiments of the present invention;
[0038] Figure 5 is a schematic diagram of the structure of a second controller in a charging device provided in some embodiments of the present invention;
[0039] Figure 6 is a flow chart of a communication method provided by some embodiments of the present invention, wherein the communication method is applied to a power supply device;
[0040] Figure 7 It is a flow chart of a communication method provided in some embodiments of the present invention, wherein the communication method is applied to a charging device. DETAILED DESCRIPTION
[0041] In order to make the purpose and advantages of the embodiments of the present invention easier to understand, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The detailed description of the embodiments of the present invention in the drawings below does not limit the scope of protection claimed by the present invention, but only represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0042] It should be noted that, if no conflict is constituted, the various technical features involved in the embodiments of the present invention described below can be combined with each other, and are all within the scope of protection of the present invention. In addition, although the functional modules are divided in the device or structural schematic diagram, and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device, or in a different order than in the flow chart. In addition, the "first", "second", "third" and other similar expressions used herein do not limit the data and execution order, but are only for the purpose of convenience of explanation and to distinguish between the same or similar items with basically the same functions and effects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features.
[0043] Unless otherwise defined, the technical terms and scientific terms used in this specification have the same meanings as those generally understood by those of ordinary skill in the art of the present invention. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. It should be understood that the term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0044] See also Figure 1 , Figure 1 The structural diagram of the communication system provided by some embodiments of the present invention is schematically shown.
[0045] like Figure 1 As shown, the communication system 1000 includes a power supply device 100 and a charging device 200 , and the power supply device 100 and the charging device 200 are communicatively connected via a cable 101 .
[0046] Specifically, the power supply device 100 includes a first controller and a first interface and a first data module ( Figure 1 The first data module includes a first sending unit and a first receiving unit, and the first sending unit and the first receiving unit are connected to the first interface respectively. The charging device 200 includes a second controller and a second interface and a second data module (which are connected to the second controller in communication Figure 1 The second data module includes a second sending unit and a second receiving unit, and the second sending unit and the second receiving unit are respectively connected to the second interface. The first interface is connected to the second interface through a cable 101, so that the power supply device 100 and the charging device 200 are connected in communication.
[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, and the first controller and the second controller are implemented using software logic. In this way, a combination of software and hardware can reduce costs, shorten development cycles, improve scalability, and facilitate updating and maintenance while realizing a fusion fast charging protocol between the power supply device 100 and the charging device 200.
[0048] In some embodiments, the first interface of the power supply device 100 needs to be in a predetermined state before the charging device 200 can establish a communication connection with the power supply device 100. That is, the first controller of the power supply device 100 controls the data positive line and the data negative line of the first interface to short-circuit each other, so that the first interface is in the 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 detects 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 a 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 a first voltage sequence received on the data negative line of the first interface. If the first voltage sequence meets 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, controls the data negative line and the data positive line of the first interface to be disconnected and short-circuited, sets the level of the data positive line of the first interface to the first level, and configures 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 has established a communication connection with the power supply device 100. The second controller configures the baud rate of the second sending unit and controls the second sending unit to send the first unit 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 accordingly receives the first unit data sent by the charging device 200 through the first interface at the configured baud rate.
[0053] In some embodiments, the first level may be a high level or a low level, and those skilled in the art may divide the high and low levels according to experimental data and actual needs. It is understandable that in order to ensure fast and accurate data transmission between the power supply device 100 and the charging device 200, the second sending unit and the first receiving unit should be configured to have the same baud rate.
[0054] In some embodiments, the power supply device 100 may be a power adapter, an energy storage device or system, a device connector, a device adapter, or any other suitable type of device, apparatus, or component, etc., and the charging device may be a smart phone, a laptop, a tablet computer, a cleaning robot, a delivery robot, or any other suitable type of device, apparatus, or component, etc. It is understandable that a certain device or apparatus may be a power supply device or a charging device. For example, for an energy storage device (such as an energy storage lithium battery), when charging a charging device (such as a sweeping robot, etc.), the energy storage device serves as a power supply device. When the energy storage device lacks power and is charged by an external power source, the energy storage device serves as a charging device.
[0055] It should be understood that Figure 1 In the communication system shown in the figure, the power supply device is a power adapter and the charging device is a smart phone, but it does not impose any restrictions on the structure, type and quantity of the power supply device and the charging device. In some other embodiments, the power supply device and the charging device can also be any other suitable type of device, and the power supply device and the charging device in some other embodiments can also be respectively Figure 1 The power adapter and smartphone shown may include more or fewer components or may have similar Figure 1 Different configurations of power adapter and smartphone are shown.
[0056] To facilitate understanding of the communication method provided by the embodiment of the present invention, the power supply device and the charging device provided by the embodiment of the present invention are first introduced in detail.
[0057] Please also read Figure 2 and Figure 3 , Figure 2 and Figure 3 The schematic diagrams of the structures of the power supply device and the charging device provided in some embodiments of the present invention are respectively shown.
[0058] like Figure 2 As shown, the power supply device 100 includes a first cache module 140, a first controller 110, and 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 sending unit 131, a first receiving unit 132, a first calculation unit 133, and a second calculation unit 134. The first sending unit 131 and the second calculation unit 134 are connected, the first receiving unit 132 is connected to the first cache module 140 and the first calculation unit 133, respectively, and the first sending unit 131 and the first receiving unit 132 are also connected to the first interface 120, respectively.
[0059] like Figure 3 As shown, the charging device 200 includes a second cache module 240, a second controller 210, and a second interface 220 and a second data module 230 that are communicatively connected to the second controller 210. The second data module 230 includes a second sending unit 231, a second receiving unit 232, a third calculation unit 233, and a fourth calculation unit 234. The second sending unit 231 is connected to the third calculation unit 233, the second receiving unit 232 is connected to the second cache module 240 and the fourth calculation unit 234, respectively, and the second sending unit 231 and the second receiving unit 232 are also connected to the second interface 220, respectively.
[0060] In some embodiments, the first interface 120 includes a data positive line and a data negative line, and the second interface 220 includes a data positive line and a data negative line. The first interface 120 is used to connect to the second interface 220 of the charging device 200 (i.e., the data positive line of the first interface 120 is connected to the data positive line of the second interface 220, and the data negative line of the first interface 120 is connected to the data negative line of the second interface 220), so that the power supply device 100 is connected to the charging device 200 in communication, and the power supply device 100 sends data through the data positive line, and the charging device 200 sends data through the data negative line. The first data module 130 is used to send and receive data, and perform some necessary processing on the data, such as using the first calculation unit 133 and the second calculation unit 134 to calculate the verification code of the data. The second data module 230 is used to send and receive data, and perform some necessary processing on the data, such as using the third calculation unit 233 and the fourth calculation unit 234 to calculate the verification code of the data.
[0061] The first cache module 140 and the second cache module 240 are respectively used to store data received by the power supply device 100 and the charging device 200, that is, the power supply device 100 stores the data received by the first receiving unit 132 to the first cache module 140, and the charging device 200 stores the data received by the second receiving unit 232 to the second cache module 240.
[0062] It is understandable that both the power supply device and the charging device may omit the calculation unit, that is, the power supply device may not include the first calculation unit and the second calculation unit, and use the first controller to calculate the data to obtain the verification code of the data. The charging device may not include the third calculation unit and the fourth calculation unit, and use the second controller to calculate the data to obtain the verification code of the data. Of course, in some embodiments, the power supply device and the charging device may omit the calculation unit, and the other may include the 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] See also Figure 4 , Figure 4 The structure diagram of the first controller in the power supply device provided in some embodiments of the present invention is schematically shown.
[0064] like Figure 4 As shown, the first controller 110 includes at least one first processor 111 and a first memory 112 that are communicatively connected. Figure 4In the example, the bus system 113 is connected to a processor. The various components in the first controller 110 are coupled together through the bus system 113, and the bus system 113 is used to realize the connection and communication between the various components. It is easy to understand that the bus system 113 includes not only a data bus, but also a power bus, a control bus, and a status signal bus. However, for the sake of clarity and brevity, Figure 4 In the figure, various buses are labeled as bus system 113. It can be understood that Figure 4 The structure shown in the embodiment is only for illustration and does not impose any limitation on the structure of the first controller. Figure 4 The structures shown may have more or fewer components, or may have the same Figure 4 Different configurations of the structure shown.
[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 perform any one of the communication methods provided in the first aspect of the embodiment of the present invention, or to perform any one of the steps in any possible implementation of any one of the communication methods provided in the first aspect of the embodiment of the present invention. Those skilled in the art can 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 gates or transistor logic devices, 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 programs, instructions and modules corresponding to the communication method provided in the first aspect of the embodiment of the present invention. In some embodiments, the first memory 112 may include a storage program area and a storage data area, the storage program area may store an operating system, an application required for at least one function, and the storage data 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 to implement any one of the communication methods provided in the first aspect of the embodiment of the present invention, or execute the steps in any one of the possible implementations of any one of the communication methods provided in the first aspect of the embodiment of the present invention. In some embodiments, the first memory 112 may include a high-speed random access memory and may also include a non-transitory memory. For example, at least one disk storage device, a flash memory device or other non-transitory solid-state storage device. In some embodiments, the first memory 112 may also include a memory remotely arranged relative to the first processor 111, and these remotely arranged memories may be connected to the first processor 111 through a communication network. It can be understood that examples of the above-mentioned communication network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0067] See also Figure 5 , Figure 5 The structure diagram of the second controller in the charging device provided in some embodiments of the present invention is schematically shown.
[0068] like Figure 5 As shown, the second controller 210 includes at least one second processor 211 and a second memory 212 that are communicatively connected. Figure 5 The bus system 213 is used as an example to connect a processor. The various components in the second controller 210 are coupled together through the bus system 213, and the bus system 213 is used to realize the connection and communication between the various components. It is easy to understand that the bus system 213 includes not only a data bus, but also a power bus, a control bus, and a status signal bus. However, for the sake of clarity and brevity, Figure 5 In the figure, various buses are labeled as bus system 213. It can be understood that Figure 5 The structure shown in the embodiment is only for illustration and does not impose any limitation on the structure of the second controller. Figure 5 The structures shown may have more or fewer components, or may have the same Figure 5 Different configurations of the structure shown.
[0069] Specifically, the second processor 211 is used to provide computing and control capabilities to control the second controller 210 to perform corresponding tasks, such as controlling the above-mentioned second controller 210 to perform any one of the communication methods provided in the second aspect of the embodiment of the present invention, or to perform any one of the steps in any possible implementation of any one of the communication methods provided in the second aspect of the embodiment of the present invention. Those skilled in the art can 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 gates or transistor logic devices, discrete hardware components.
[0070] The second memory 212, as a non-transient computer-readable storage medium, can be used to store non-transient software programs, non-transient computer executable programs, instructions and modules, such as programs, instructions and modules corresponding to the communication method provided in the second aspect of the embodiment of the present invention. In some embodiments, the second memory 212 may include a storage program area and a storage data area, the storage program area may store an operating system, an application required for at least one function, and the storage data 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-transient software programs, instructions and modules stored in the second memory 212 to implement any one of the communication methods provided in the second aspect of the embodiment of the present invention, or executes any one of the possible implementation methods of any one of the communication methods provided in the second aspect of the embodiment of the present invention. In some embodiments, the second memory 212 may include a high-speed random access memory and may also include a non-transient memory. For example, at least one disk storage device, a flash memory device or other non-transient solid-state storage device. In some embodiments, the second memory 212 may also include a memory remotely arranged relative to the second processor 211, and these remotely arranged memories may be connected to the second processor 211 through a communication network. It can be understood that examples of the above-mentioned communication network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0071] It can be understood from the above that the implementation and execution subject of any communication method provided in the embodiments of the present invention can be any suitable type of power supply equipment and charging equipment with certain computing and control capabilities, for example, it can be implemented and executed by the above-mentioned power supply equipment 100 and charging equipment 200. Among them, in some feasible implementations, the processor can call the computer program instructions stored in the memory to implement any communication method provided in the embodiments of the present invention.
[0072] Hereinafter, the communication method provided in the embodiment of the present invention will be described in detail in combination with exemplary applications and implementations of the power supply device and the charging device provided in the embodiment of the present invention.
[0073] First, the communication method provided in the first aspect of the embodiment of the present invention is described in detail.
[0074] See also Figure 6 , Figure 6 The flowchart of the communication method provided by some embodiments of the present invention is schematically shown.
[0075] Those skilled in the art can understand that the communication method provided in the embodiment of the present invention can be applied to the above power supply device, for example, the power supply device 100. Specifically, the execution subject of the communication method is one or at least two first processors of the power supply device.
[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 data positive line and the data negative line of the first interface to be short-circuited to each other, so that the first interface is in a first state.
[0078] In some embodiments, a controllable electronic switch (for example, a MOSFET, a relay, or other switch) is configured between the data positive line and the data negative line of the first interface, and the control end of the electronic switch is connected to the first controller. The first controller outputs a control signal to the electronic switch to drive the electronic switch to enter and be in an on state, so that the data positive line and the data negative line of the first interface are short-circuited to each other, thereby placing the first interface in a first state.
[0079] In other embodiments, the first controller of the power supply device supports a programmable I / O module, connects the data positive line and the data negative line of the first interface to the two ports of the programmable I / O module, and performs software programming on the first controller so that the two ports of the programmable I / O module are in a short-circuited mode. For example, by setting the two ports of the programmable I / O module to the same level and directly connecting them so that the two ports are in a short-circuited state, the data positive line and the data negative line of the first interface are short-circuited to each other, and the first interface is in a first state.
[0080] It is easy to understand that other methods can also be used to achieve the first controller controlling the data positive line and the data negative line of the first interface to short-circuit each other. For example, a resistance circuit controllable by the first controller is connected between the data positive line and the data negative line of the first interface, and the first controller controls the conduction state of the resistance circuit to achieve the short-circuit of the data positive line and the data negative line of the first interface. Technical personnel in this field can choose any suitable way or method according to actual needs to achieve the first controller controlling the data positive line and the data negative line of the first interface to short-circuit each other, and the embodiments of the present invention do not impose any limitation on this.
[0081] S200: A first data module detects a first voltage sequence received on a negative data line of a first interface.
[0082] Specifically, the input end of the first data module (ie, the first receiving unit) is connected to the data negative line of the first interface, and the output end of the first data module (ie, the first sending unit) is connected to the data positive 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 data negative line of the first interface at a preset sampling frequency, and forms a voltage sequence with the sampled voltage value and voltage duration, thereby detecting and obtaining the first voltage sequence received on the data negative line of the first interface.
[0084] S300: If the first voltage sequence meets 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, the predetermined handshake sequence is used for initial communication connection confirmation 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 that the first interface of the power supply device is in the first state.
[0086] Specifically, the power supply device compares the first voltage sequence with the predetermined handshake sequence. If the first voltage sequence conforms to the predetermined handshake sequence, that is, the voltage change of the first voltage sequence received on the data negative line of the first interface conforms to 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), indicating that the power supply device and the charging device have successfully handshaked, 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 in the following manner, that is, an output signal line (such as a GPIO pin) is reserved in the first data module for outputting an interrupt signal. If the first voltage sequence meets a predetermined handshake sequence, the first data module triggers the hardware logic to switch the state of the output signal line from a low level to a high level or generate a pulse signal to obtain a first interrupt signal. The first interrupt signal can be configured as edge triggered (such as a rising edge or a falling edge) or level triggered (such as a high level or a low level).
[0088] S400: The first controller responds to the first interrupt signal, controls the data negative line and the data positive line of the first interface to be disconnected and short-circuited, and sets the level of the data positive line of the first interface to be a first level.
[0089] Specifically, after receiving the first interrupt signal sent by the first data module, the first controller triggers an interrupt service routine (ISR), immediately stops the current operation and executes the interrupt service routine. The first controller sends a disconnect instruction to an electronic switch (such as a MOSFET, a relay) or a programmable I / O port to switch the electronic switch or the programmable I / O port to an off state, thereby disconnecting and short-circuiting the data negative line and the data positive line of the first interface.
[0090] In some embodiments, the data positive line of the first interface is connected to an I / O pin of the first controller, and the I / O pin can be configured as an output mode to set the level of the data positive line of the first interface. The first controller configures the I / O pin corresponding to the data positive line of the first interface to an output mode, and sets the level of the I / O pin to a predetermined first level, so that the level of the data positive line of the first interface is set to a first level, wherein the first level is a high level.
[0091] In some embodiments, after controlling the data negative line and the data positive line of the first interface to be disconnected and short-circuited, and setting the level of the data positive line of the first interface to the first level, the first controller ends the interrupt service program, exits the interrupt state, resumes the operation of 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, which refers to the number of symbols (bits) transmitted per second. In order 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 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 division value according to the target baud rate and the main frequency of the first controller system, writes the calculated division value into the control register, completes the configuration of the baud rate of the first receiving unit, and then configures the first receiving unit to the receiving mode, so that the first receiving unit can monitor the data line of the first interface.
[0095] In some embodiments, the target baud rate is set by predefined parameters, for example, a predetermined handshake sequence includes baud rate information. After the power supply device receives the predetermined handshake sequence, the first controller 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.
[0096] In some embodiments, if the communication protocol between the power supply device and the charging device stipulates that the target baud rate is a fixed value (for example, 38400, 57600, 9600 bps or 115200 bps, etc.), the first controller can directly configure the baud rate of the first receiving unit to the fixed value.
[0097] In some embodiments, if the baud rate needs to be dynamically adjusted during the communication process, the first controller may parse and determine the baud rate through a specific algorithm (eg, 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, including but not limited to the following steps S510-S540:
[0099] S510: The first controller configures an initial baud rate of the first receiving unit.
[0100] Specifically, the first controller obtains 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 corresponding to the first receiving unit (such as UART, SPI, I2C or USB interface), calculates the division value according to the initial baud rate and the main frequency of the first controller system, writes the calculated division value into the control register, and completes 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 (for example, 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 a first sequence sent by the charging device based on the initial baud rate, and calculates the first sequence to obtain a first baud rate.
[0103] It should be understood that the first sequence can be a sequence generated by the data sender (power supply device or charging device) 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 of the configuration file.
[0104] Specifically, the first receiving unit monitors 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 calculates the first sequence, that is, measures the duration of each bit in the first sequence (that is, 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 takes 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: The first controller obtains the first baud rate from the first data module in response to the second interrupt signal, 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 in the following manner: an output signal line (e.g., a GPIO pin) is reserved in the first receiving unit for outputting an interrupt signal; after calculating the first sequence to obtain the first baud rate, the first receiving unit triggers the hardware logic to switch the state of the output signal line from a low level to a high level or generates a pulse signal to obtain a second interrupt signal, and the second interrupt signal is sent to the first controller; the second interrupt signal may be configured as edge triggered (e.g., a rising edge or a falling edge) or level triggered (e.g., a high level or a low level).
[0108] Specifically, after receiving the second interrupt signal sent by the first receiving unit, the first controller triggers the interrupt service program, immediately stops the current operation and executes the interrupt service program. The first controller reads the first baud rate from the first receiving unit of the first data module through a data bus or a communication interface (such as UART, SPI, I2C or USB interface).
[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, that is, initializes the communication interface corresponding to the first receiving unit (such as UART, SPI, I2C or USB interface), calculates the division value based on the first baud rate and the main frequency of the first controller system, writes the calculated division value into the control register, and completes the configuration of the baud rate of the first receiving unit to the first baud rate.
[0110] S600: The first receiving unit receives a first unit of data sent by the charging device through the first interface at a baud rate.
[0111] Specifically, after the baud rate of the first receiving unit is configured and the first receiving unit is configured in data receiving mode, the first receiving unit monitors the signal line of the first interface, and when the start bit (i.e., low-level signal) sent by the charging device is received through the first interface, the data frame receiving process is started. The start bit is used to mark the beginning of the data frame and realize the clock synchronization between the receiving end (power supply device) and the sending end (charging device).
[0112] The first receiving unit calculates the bit time interval according to 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 the check bit received through the first interface. It can be understood that the sampling point of each data bit is calculated based on the clock of the baud rate, and the sampling is performed in the middle of the data bit period to avoid edge interference.
[0113] After the data bit and the check bit, the first receiving unit samples the stop bit (i.e., a high-level signal) received through the first interface, and checks the stop bit to verify the integrity of the data frame. After the start bit, data bit, check bit, and stop bit are received through the first interface, it indicates that a complete frame of data (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] It is understandable that in some communication protocols, a complete frame of data (first unit data) may not include a check bit. Those skilled in the art may add or not add a check bit to the first unit data according to actual needs, 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 reads the first unit data from the first data module in response to the third interrupt signal.
[0118] Specifically, the first data module can generate the third interrupt signal in the following manner, that is, an output signal line (such as a 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 a low level to a high level or generate a pulse signal to obtain a third interrupt signal, and send the third interrupt signal to the first controller, wherein the third interrupt signal can be configured as edge triggered (such as a rising edge or a falling edge) or level triggered (such as a high level or a low level).
[0119] In some embodiments, after receiving the third interrupt signal sent by the first data module, the first controller triggers the interrupt service program, immediately stops the current operation, and executes the interrupt service program. The first controller reads the received first unit data from the first data module through a data bus or a communication interface (for example, an interface such as 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 a 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 a next first unit verification code corresponding to the next first unit data.
[0123] Specifically, the received several first unit data are sorted in the order of receipt, and the first controller uses a specific algorithm (for example, CRC check, hash function or custom check rule, etc.) to read and calculate the sorted several first unit data one by one to obtain a final first verification code.
[0124] Exemplarily, starting from the first first unit data, the first first unit data is used as the current first unit data, and the first controller uses a CRC check (such as a predefined polynomial) to calculate the current first unit data to obtain a current first unit verification code corresponding to the current first unit data.
[0125] Exemplarily, the first controller uses a CRC check (eg, a predefined polynomial) to jointly calculate the next first unit data and the current first unit verification code to obtain a next first unit verification code corresponding to the next first unit data.
[0126] S30: The first controller executes S10-S20 in a loop until the first unit verification codes corresponding to the last first unit data and the first unit data before the last first unit data are calculated to obtain the last first unit verification code corresponding to the last first unit data, wherein the last first unit data is the last first unit data in the first data, 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, and the second verification code is a verification code obtained by the charging device calculating multiple first unit data.
[0127] Specifically, the first controller reads the first unit data one by one, and uses CRC check to loop through steps S10 and S20 to calculate the corresponding first unit verification codes for all the first unit data until the last first unit verification code corresponding to the last first unit data is calculated, that is, the first controller loops through S10 and S20 until the first unit verification codes corresponding to the last first unit data and the previous first unit data of the last first unit data are calculated to obtain the last first unit verification code corresponding to the last first unit data.
[0128] It can be understood that the first data includes multiple first unit data and a second verification code, 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, wherein the second verification code is a verification code obtained by the charging device calculating the multiple first unit data, the charging device calculates the multiple first unit data to obtain the second verification code, and attaches 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 indicates 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 means that the first data is erroneous or has been tampered with. The first controller can request the charging device to resend the first data, or perform other processing operations, such as issuing an alarm reminder of data reception error.
[0132] 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.
[0133] Specifically, 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. That is, the first controller obtains the second unit data according to the communication protocol and the current context, and the second unit data includes information confirming successful reception, the current state information of the first controller, and other negotiation data or control instructions, and encodes and formats the second unit data so that the second unit data conforms to the predetermined communication protocol format. The first controller configures the baud rate of the first sending unit, checks and clears the sending buffer of the first sending unit to ensure that there is no residual data in the buffer. The first controller writes the encoded second unit data into the sending buffer of the first sending unit, and controls the first sending unit to send the second unit data to the charging device through the first interface at the configured baud rate. The first sending unit transmits the second unit data in the sending buffer to the charging device bit by bit through the data positive line of the first interface.
[0134] In some embodiments, the first controller controls the first sending unit to send the 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 obtains a first sequence, and parses the first sequence to obtain a second baud rate.
[0136] It should be understood that the first sequence can be a sequence generated by the data sender (power supply device or charging device) 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 of the configuration file.
[0137] Specifically, when the power supply device sends the second unit data to the charging device as a data sender, the first controller of the power supply device can generate a first sequence according to the communication protocol and communication requirements, or can also obtain the first sequence from a sequence library, or obtain the first sequence by hard coding or parsing a sequence configuration file.
[0138] After obtaining the first sequence, the first controller parses a specific field 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 mechanism for dynamically negotiating baud rate, the first controller calculates the first sequence according to a negotiation algorithm to obtain the second baud rate.
[0139] S52: The first controller configures the baud rate of the first sending unit to be the second baud rate, and controls the first sending unit to send the first sequence to the charging device.
[0140] Specifically, the first controller configures the baud rate of the first sending unit to the second baud rate based on the obtained second baud rate, that is, initializes the communication interface corresponding to the first sending unit (for example, UART, SPI or USB interface), calculates the division value based on the second baud rate and the main frequency of the first controller system, writes the calculated division value into the control register, configures the baud rate of the first sending unit to the second baud rate, and configures the first sending unit to a sending mode so that the first sending unit can monitor and obtain data to be sent.
[0141] After configuring the baud rate of the first sending unit to be the second baud rate, the first controller controls the first sending unit to send the first sequence to the charging device through the first interface at the second baud rate.
[0142] S53: The first controller obtains a plurality of second unit data from the first data module, calculates the plurality of second unit data to obtain a third verification code, and appends the third verification code to the second data. The plurality of second unit data and the third verification code constitute the second data.
[0143] Specifically, the first controller obtains a plurality of second unit data to be sent from the first data module through a data bus or a communication interface (for example, an interface such as UART, SPI, I2C or USB).
[0144] Exemplarily, the plurality of second unit data to be sent are sorted in the order of sending, and the first controller uses a specific algorithm (for example, CRC check, hash function or custom check rule, etc.) to calculate the sorted plurality of second unit data one by one, obtain the third verification code corresponding to the second data, and attach the third verification code to the second data. Obviously, the plurality of second unit data 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, and the first controller uses CRC check (for example, 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 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 corresponding to the next second unit data. The first controller calculates the second unit data one by one, that is, uses CRC check to calculate the corresponding second unit verification codes for all the second unit data in sorted order until the last second unit verification code corresponding to the last second unit data is calculated, 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 sending unit to send a plurality of second unit data and a third verification code to the charging device through the first interface at a second baud rate.
[0147] Exemplarily, the first controller controls the first sending unit to send several second unit data and the third verification code to the charging device through the first interface at the second baud rate, that is, the first controller sends the first control instruction to the first sending unit, and after receiving the first control instruction, the first sending unit calculates the bit time interval according to the configured third baud rate, and sends several second unit data one by one to the charging device according to the bit time interval and the data sending order. After sending several second unit data, the first controller sends the second control instruction to the first sending unit, and after receiving the second control instruction, 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 calculation unit to calculate a 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, and the second verification code is a verification code obtained by the charging device by calculating the plurality of first unit data.
[0150] In some embodiments, the first data module further includes: a first calculation unit, the first calculation unit is connected to the first receiving unit, and the first calculation unit is used to calculate the first unit data.
[0151] Specifically, the received several first unit data are sorted according to the data receiving order, and the first controller controls the first calculation unit to calculate the sorted several first unit data one by one to obtain the first verification code corresponding to the first data, that is, the first calculation unit is controlled to use a specific algorithm (such as CRC check, hash function or custom check rule) to calculate the sorted several 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, and the second verification code is a verification code obtained by the charging device calculating the multiple first unit data. The charging device calculates the multiple first unit data to obtain the second verification code and attaches the second verification code to the first data.
[0153] Exemplarily, starting from the first first unit data, the first first unit data is taken as the current first unit data, the first calculation unit uses CRC check (for example, a predefined polynomial) to calculate the current first unit data to obtain the current first unit verification code corresponding to the current first unit data, then the first calculation unit uses CRC check 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, the first calculation unit calculates the first unit data one by one, that is, uses CRC check to calculate the corresponding first unit verification code for all the first unit data in sorted order, until the last first unit verification code corresponding to the last first unit data is calculated, 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.
[0154] S70: The first controller obtains 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 a plurality of first unit data and obtaining a first verification code, the first calculation unit stores the first verification code in a register, and the first controller obtains the first verification code from the register. The first controller also extracts a 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 means that the first data is erroneous or has been tampered with. The first controller can request the charging device to resend the first data, or perform other processing operations, such as issuing an alarm reminder of data reception error.
[0157] S80: 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.
[0158] Specifically, 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. That is, the first controller obtains the second unit data according to the communication protocol and the current context, and the second unit data includes information confirming successful reception, the current state information of the first controller, and other negotiation data or control instructions, and encodes and formats the second unit data so that the second unit data conforms to the predetermined communication protocol format. The first controller configures the baud rate of the first sending unit, checks and clears the sending buffer of the first sending unit to ensure that there is no residual data in the buffer. The first controller writes the encoded second unit data into the sending buffer of the first sending unit, and controls the first sending unit to send the second unit data to the charging device through the first interface at the configured baud rate. The first sending unit transmits the second unit data in the sending buffer to the charging device bit by bit through the data positive line of the first interface.
[0159] In some embodiments, the first controller controls the first sending unit to send the 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 obtains a first sequence, and parses the first sequence to obtain a third baud rate.
[0161] In some embodiments, the first data module further includes: a second calculation unit, the second calculation unit is connected to the first sending unit, and the second calculation unit is used to calculate the second unit data.
[0162] It should be understood that the first sequence can be a sequence generated by the data sender (power supply device or charging device) 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 of the configuration file.
[0163] Specifically, when the power supply device sends the second unit data to the charging device as a data sender, the first controller of the power supply device can generate a first sequence according to the communication protocol and communication requirements, or can also obtain the first sequence from a sequence library, or obtain the first sequence by hard coding or parsing a sequence configuration file.
[0164] After obtaining the first sequence, the first controller parses a specific field 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 mechanism for dynamically negotiating baud rates, the first controller calculates the first sequence according to a negotiation algorithm to obtain the third baud rate.
[0165] S82: The first controller configures the baud rate of the first sending unit to be the third baud rate, and controls the first sending unit to send the first sequence to the charging device.
[0166] Specifically, the first controller configures the baud rate of the first sending unit to the third baud rate based on the obtained third baud rate, that is, initializes the communication interface corresponding to the first sending unit (for example, UART, SPI or USB interface), calculates the division value based on the third baud rate and the main frequency of the first controller system, writes the calculated division value into the control register, and completes the configuration of the baud rate of the first sending unit to the third baud rate.
[0167] After configuring the baud rate of the first sending unit to be the third baud rate, the first controller controls the first sending unit to send the first sequence to the charging device through the first interface at the third baud rate.
[0168] S83: The first controller controls the second calculation unit to calculate a plurality of second unit data to obtain a third verification code, and appends the third verification code to the second data. The plurality of second unit data and the third verification code constitute the second data.
[0169] Exemplarily, the plurality of second unit data to be sent are sorted in the order of sending, and the first controller controls the second calculation unit to calculate the plurality of second unit data to obtain the third verification code corresponding to the second data, that is, the second calculation unit is controlled to use a specific algorithm (such as CRC check, hash function or custom check rule) to calculate the sorted plurality of second unit data one by one, obtain the third verification code corresponding to the second data, and attach the third verification code to the second data. Obviously, the plurality of second unit data and the third verification code constitute the second data.
[0170] Exemplarily, starting from 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 (for example, 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, and 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, and the second calculation unit calculates the second unit data one by one, that is, uses CRC check to calculate the corresponding second unit verification code for all the second unit data in sorted order, until the last second unit verification code corresponding to the last second unit data is calculated, 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 sending unit to send a plurality of second unit data and a third verification code to the charging device through the first interface at a third baud rate.
[0172] Exemplarily, the first controller controls the first sending unit to send several second unit data and the third verification code to the charging device through the first interface at the third baud rate, that is, the first controller sends the first control instruction to the first sending unit, and after receiving the first control instruction, the first sending unit calculates the bit time interval according to the configured third baud rate, and sends several second unit data one by one to the charging device according to the bit time interval and the data sending order. After sending several second unit data, the first controller sends the second control instruction to the first sending unit, and after receiving the second control instruction, 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 steps S90:
[0174] S90: The first data module stores the first unit data in the first cache module.
[0175] In some embodiments, the power supply device further includes a first cache module, wherein the first cache module is connected to the first receiving unit, and the first cache module is used to store data received by the first receiving unit.
[0176] Exemplarily, 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 the embodiment of the present invention is applied to a power supply device, the power supply device is 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 for communication, the first data module includes a first sending unit and a first receiving unit, the first sending 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 sending unit and a second receiving unit, the second sending 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 data positive line and the data negative line of the first interface to short-circuit each other so that the first interface is in a first state, the first data module detects a first voltage sequence received on the data negative line of the first interface, if the first voltage sequence meets 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, controls the data negative line and the data positive line of the first interface to disconnect and short-circuit, and sets the level of the data positive line of the first interface to be a first level, the first controller configures the baud rate of the first receiving unit, and the first receiving unit receives the first unit data sent by the charging device through the first interface at the baud rate.
[0178] The embodiment of the present invention realizes a fusion fast charging communication protocol between a power supply device and a charging device by combining software and hardware, which can reduce costs, shorten the development cycle, improve scalability, and facilitate updating and maintenance.
[0179] Next, the communication method provided in the second aspect of the embodiment of the present invention is described in detail.
[0180] See also Figure 7 , Figure 7 The flowchart of the communication method provided by some embodiments of the present invention is schematically shown.
[0181] Those skilled in the art can understand that the communication method provided in the embodiment of the present invention can be applied to the above charging device, for example, the charging device 200. Specifically, the execution subject of the 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 state of the first interface.
[0184] Specifically, the second controller activates the detection circuit of the second interface through its control logic, and instructs the detection circuit to monitor the state of the first interface. For example, the second controller sends a control signal (such as a GPIO pin, a control register, etc.) to the detection circuit of the second interface. After receiving the control signal, the detection circuit starts working and detects the state of the first interface through a voltage detector or a comparator, that is, detects the level state of the data positive line and the data negative line of the first interface, and determines the current state of the first interface according to the level state of the data positive line and the data negative line of the first interface.
[0185] In some embodiments, if the levels of the data positive line and the data negative line of the first interface are the same or the difference is within a preset threshold range, it is considered that the levels of the data positive line and the data negative line of the first interface are the same, and the first interface is in the first state at this time, and the second interface sends the state feedback identifier to the second controller, and the second controller receives the state feedback identifier and determines that the first interface is in the first state. The state feedback identifier is used to characterize 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 (such as 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 negative data 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 a confirmation signal that the first interface is in the first state to the second data module. After receiving the confirmation signal, the second data module responds to the confirmation 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] Obviously, the predetermined handshake sequence is a set of specific binary data used to initialize communication, confirm connection and synchronize between devices, etc. The content and format of the predetermined handshake sequence is part of the communication protocol, including information such as synchronization bits, identifiers, data fields and checksums.
[0189] S730: The second controller obtains the voltage of the data positive 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 sampling parameters (e.g., sampling frequency, sampling accuracy, etc.) of the voltage detection module or the voltage sampling circuit, and controls the voltage detection module or the voltage sampling circuit to start voltage sampling through a control register or a control signal, and samples the voltage of the data positive line of the second interface, thereby obtaining the voltage of the data positive line of the second interface.
[0191] S740: If the voltage of the data positive line of the second interface is at the first level, the second controller configures the baud rate of the second sending unit, and controls the second sending unit to send the first unit of data to the power supply device through the second interface at the baud rate.
[0192] In some embodiments, the second controller compares the acquired 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 be connected to the first interface for normal communication. The second controller continues to perform subsequent operations, such as configuring the baud rate of the second sending unit, sending data, etc.
[0193] Specifically, the second controller obtains and determines the target baud rate, configures the baud rate of the second sending unit to the target baud rate, that is, initializes the communication interface corresponding to the second sending unit (such as UART, SPI, I2C or USB interface), calculates the division value according to the target baud rate and the main frequency of the second controller system, writes the calculated division value into the control register, completes the configuration of the baud rate of the second sending unit, and then configures the second sending unit to the sending mode, so that the second sending unit can monitor and obtain the data to be sent.
[0194] In some embodiments, the target baud rate is set by predefined parameters, for example, a predetermined handshake sequence includes baud rate information, and after the power supply device receives the predetermined handshake sequence, the second controller 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 some other embodiments, if the communication protocol between the power supply device and the charging device stipulates that the target baud rate is a fixed value (for example, 38400, 57600, 9600bps or 115200bps, etc.), the second controller can directly configure the baud rate of the second sending unit to be the fixed value.
[0195] In some embodiments, if the baud rate needs to be dynamically adjusted during the communication process, the second controller can parse and determine the baud rate through a specific algorithm (such as automatic baud rate detection) and configure the baud rate of the second sending unit.
[0196] After configuring the baud rate of the second sending unit, the second controller controls the second sending 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 the data to be sent, the current status information of the second controller and other negotiation data or control instructions, and encodes and formats the first unit data so that the first unit data conforms to the predetermined communication protocol format. The second controller checks and clears the sending buffer of the second sending unit to ensure that there is no residual data in the buffer. The second controller writes the encoded first unit data into the sending buffer of the second sending unit, and activates the second sending unit by controlling the register or triggering the control signal to control the second sending unit to send the first unit data to the power supply device through the second interface at the configured baud rate. The second sending unit transmits the first unit data in the buffer to the power supply device bit by bit through the data negative line of the second interface.
[0197] In some embodiments, the second controller configures the baud rate of the second sending unit, including but not limited to the following steps S741-S742:
[0198] S741: The second controller obtains the first sequence, and parses the first sequence to obtain a fourth baud rate.
[0199] It should be understood that the first sequence can be a sequence generated by the data sender (power supply device or charging device) 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 of the configuration file.
[0200] Specifically, when the charging device sends the first unit data to the power supply device as a data sender, the second controller of the charging device can generate a first sequence according to the communication protocol and communication requirements, or can also obtain the first sequence from a sequence library, or obtain the first sequence by hard coding or parsing a sequence configuration file.
[0201] After obtaining the first sequence, the second controller parses a specific field 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 mechanism for dynamically negotiating baud rates, the second controller calculates the first sequence according to a negotiation algorithm to obtain the fourth baud rate.
[0202] S742: The second controller configures the fourth baud rate as the baud rate of the second sending unit, and controls the second sending unit to send the first sequence to the power supply device.
[0203] Specifically, the second controller configures the baud rate of the second sending unit to the fourth baud rate based on the obtained fourth baud rate, that is, initializes the communication interface corresponding to the second sending unit (for example, UART, SPI or USB interface), calculates the division value based on the fourth baud rate and the main frequency of the second controller system, writes the calculated division value into the control register, completes the configuration of the baud rate of the second sending unit to the fourth baud rate, and configures the second sending unit to a sending mode, so that the second sending unit can monitor and obtain data to be sent.
[0204] After configuring the baud rate of the second sending unit to be the fourth baud rate, the second controller controls the second sending unit to send the first sequence to the power supply device through the second interface at the fourth baud rate.
[0205] In some embodiments, controlling the second sending unit to send the first unit data to the power supply device through the second interface at a baud rate specifically includes but is not limited to the following steps S743-S744:
[0206] S743: The second controller obtains a plurality of first unit data from the second data module, calculates the plurality of first unit data to obtain a second verification code, and appends the second verification code to the first data. The plurality of first unit data and the second verification code constitute the first data.
[0207] Specifically, the second controller obtains a plurality of first unit data to be sent from the second data module through a data bus or a communication interface (for example, an interface such as UART, SPI, I2C or USB).
[0208] Exemplarily, the first unit data to be sent are sorted in the order of sending, and the second controller uses a specific algorithm (for example, CRC check, hash function or custom check rule, etc.) to calculate the sorted first unit data one by one to obtain the second verification code corresponding to the first data, and attach the second verification code to the first data. Obviously, multiple first unit data and the second verification code constitute the first data.
[0209] Specifically, starting from the first first unit data, the first first unit data is taken as the current first unit data, and the second controller uses CRC check (for example, a predefined polynomial) to calculate the current first unit data to obtain the current first unit verification code corresponding to the current first unit data. Then the second controller uses CRC check 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. The second controller calculates the first unit data one by one, that is, uses CRC check to calculate the corresponding first unit verification codes for all the first unit data in sorted order, until the last first unit verification code corresponding to the last first unit data is calculated, the last first unit data is the last first unit data in the second data, and the last first unit verification code is the second verification code corresponding to the first data.
[0210] S744: The second controller controls the second sending unit to send a plurality of first unit data and a second verification code to the power supply device through the second interface at a baud rate.
[0211] Exemplarily, the second controller controls the second sending unit to send a number of first unit data and a second verification code to the power supply device through the second interface at a configured baud rate, that is, the second controller sends a first control instruction to the second sending unit, and after receiving the first control instruction, the second sending unit calculates the bit time interval according to the configured baud rate, and sends the number of first unit data one by one to the power supply device according to the bit time interval and in the data sending order. After sending a number of first unit data, the second controller sends a second control instruction to the second sending unit, and after receiving the second control instruction, the second sending unit sends the second verification code to the power supply device.
[0212] In some embodiments, controlling the second sending unit to send the first unit of data to the power supply device through the second interface at a baud rate specifically includes but is not limited to the following steps S745-S746:
[0213] S745: The second controller controls the third calculation 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. The plurality of 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, the third calculation unit is connected to the second sending unit, and the third calculation unit is used to calculate the first unit data.
[0215] Exemplarily, the first unit data to be sent are sorted in the order of sending, and the second controller controls the third calculation unit to calculate the sorted first unit data 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 check rule) to calculate the sorted first unit data one by one to obtain the second verification code corresponding to the first data. It can be understood that multiple first unit data and second verification codes constitute the first data.
[0216] Exemplarily, starting from the first first unit data, the first first unit data is taken as the current first unit data, and the third calculation unit uses CRC check (for example, a predefined polynomial) to calculate the current first unit data to obtain the current first unit verification code corresponding to the current first unit data. Then the third calculation unit uses CRC check 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. The third calculation unit calculates the first unit data one by one, that is, uses CRC check to calculate the corresponding first unit verification codes for all the first unit data in sorted order, until the last first unit verification code corresponding to the last first unit data is calculated, the last first unit data is the last first unit data in the first data, and the last first unit verification code is the second verification code corresponding to the first data.
[0217] S746: The second controller controls the second sending unit to send a plurality of first unit data and the second verification code to the power supply device through the second interface at a baud rate.
[0218] Exemplarily, the second controller controls the second sending unit to send a number of first unit data and a second verification code to the power supply device through the second interface at a configured baud rate, that is, the second controller sends a first control instruction to the second sending unit, and after receiving the first control instruction, the second sending unit calculates the bit time interval according to the configured baud rate, and sends the number of first unit data one by one to the power supply device according to the bit time interval and in the data sending order. After sending a number of first unit data, the second controller sends a second control instruction to the second sending unit, and after receiving the second control instruction, the second sending unit sends the second verification code to the power supply device.
[0219] In some embodiments, after controlling the second sending unit to send the first unit of data to the power supply device through the second interface at a baud rate, the communication method further includes but is not limited to the following steps S750-S790:
[0220] S750: The second controller configures an initial baud rate of the second receiving unit.
[0221] Specifically, the second controller obtains the initial baud rate and sets the baud rate of the second receiving unit as the initial baud rate, that is, initializes the communication interface corresponding to the second receiving unit (such as UART, SPI, I2C or USB interface), calculates the division value according to the initial baud rate and the main frequency of the second controller system, writes the calculated division value into the control register, and completes 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 (for example, 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 device based on the initial baud rate, and calculates the first sequence to obtain a fifth baud rate.
[0224] It should be understood that the first sequence can be a sequence generated by the data sender (power supply device or charging device) 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 of the configuration file.
[0225] Specifically, the second receiving unit monitors 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 calculates the first sequence, that is, measures the duration of each bit in the first sequence (that is, 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 takes 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: The second controller obtains a fifth baud rate from the second data module in response to the fourth interrupt signal, 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 in the following manner, that is, an output signal line (e.g., a GPIO pin) is reserved in the second data module for outputting an interrupt signal. After the second receiving unit calculates the first sequence to obtain a fifth baud rate, the second data module triggers the hardware logic to switch the state of the output signal line from a low level to a high level or generates a pulse signal to obtain a fourth interrupt signal, and the fourth interrupt signal is sent to the second controller. The fourth interrupt signal can be configured as edge triggered (e.g., a rising edge or a falling edge) or level triggered (e.g., a high level or a low level).
[0229] Specifically, after receiving the fourth interrupt signal sent by the second data module, the second controller triggers the interrupt service program, immediately stops the current operation and executes the interrupt service program. The second controller reads the fifth baud rate from the second data module through a data bus or a communication interface (for example, an interface such as 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 fifth baud rate read, that is, initializes the communication interface corresponding to the second receiving unit (such as UART, SPI, I2C or USB interface), calculates the division value based on the fifth baud rate and the main frequency of the second controller system, writes the calculated division value into the control register, configures the baud rate of the second receiving unit to the fifth baud rate, and configures the second receiving unit to the receiving mode, so that the second receiving unit can monitor 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 device through the second interface at the fifth baud rate.
[0232] Exemplarily, after configuring the baud rate of the second receiving unit to the fifth baud rate and configuring the second receiving unit to the data receiving mode, 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, that is, the second controller sends a control signal or instruction to the second receiving unit, and after receiving the control signal or instruction, the second receiving unit monitors the signal line of the second interface, and starts the data frame receiving process when receiving the start bit (low level signal) sent by the power supply device through the second interface. Among them, the start bit is used to mark the beginning of the data frame and realize the clock synchronization between the receiving end (charging device) and the sending end (power supply device).
[0233] The second receiving unit calculates the bit time interval according to the fifth baud rate to ensure that the sampling point of each data bit is aligned with the power supply device. After the start bit, the second receiving unit sequentially samples the 8 data bits and the check bit received through the second interface. It can be understood that the sampling point of each data bit is calculated based on the clock of the baud rate, and the sampling is performed in the middle of the data bit period to avoid edge interference.
[0234] After the data bits and check bits, the second receiving unit samples the stop bit (i.e., a high-level signal) received through the second interface, and checks the stop bit to verify the integrity of the data frame. After the start bit, data bits, check bit, and stop bit are received through the second interface, it indicates that a complete frame of data (second unit data) has been received, that is, the second receiving unit receives the second unit data sent by the power supply device through the second interface at the fifth baud rate.
[0235] It is understandable that in some communication protocols, a complete frame of data (second unit data) may not include a check bit. Technical personnel in this field may add or not add a check bit to the second unit data according to actual needs, 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 through the second interface at the fifth baud rate, 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 in the following manner, namely, an output signal line (e.g., a GPIO pin) is reserved 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 through the second interface at a fifth baud rate, the second data module triggers the hardware logic to switch the state of the output signal line from a low level to a high level or generate a pulse signal to obtain a fifth interrupt signal, and send the fifth interrupt signal to the second controller, wherein the fifth interrupt signal can be configured as edge triggered (e.g., a rising edge or a falling edge) or level triggered (e.g., a high level or a low level).
[0239] S900: The second controller reads the second unit data from the second data module in response to the fifth interrupt signal.
[0240] Specifically, after receiving the fifth interrupt signal sent by the second data module, the second controller triggers the interrupt service program, immediately stops the current operation and executes the interrupt service program. The second controller reads the received second unit data from the second data module through a data bus or a communication interface (for example, an interface such as 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 to obtain a 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 a next second unit verification code corresponding to the next second unit data.
[0244] Specifically, the received several second unit data are sorted in the order of receipt, and the second controller uses a specific algorithm (for example, CRC check, hash function or custom check rule, etc.) to read and calculate the sorted several second unit data one by one to obtain the final fourth verification code.
[0245] Exemplarily, starting from the first second unit data, the first second unit data is used as the current second unit data, and the second controller uses CRC check (such as 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] Exemplarily, the second controller uses a CRC check (eg, a predefined polynomial) to jointly calculate the next second unit data and the current second unit verification code to obtain a next second unit verification code corresponding to the next second unit data.
[0247] S30A: The second controller executes S10A-S20A in a loop until the second unit verification codes corresponding to the last second unit data and the second unit data before the last second unit data are calculated to obtain the last second unit verification code corresponding to the last second unit data, wherein the last second unit data is the last second unit data in the second data, 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, and the third verification code is a verification code obtained by the power supply device calculating multiple second unit data.
[0248] Specifically, the second controller reads the second unit data one by one, and uses CRC check to loop through steps S10A and S20A to calculate the corresponding second unit verification codes for all the second unit data until the last second unit verification code corresponding to the last second unit data is calculated, that is, the second controller loops through S10A and S20A until the second unit verification codes corresponding to the last second unit data and the second unit data before the last second unit data are calculated to obtain the last second unit verification code corresponding to the last second unit data.
[0249] It can be understood 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, wherein the third verification code is a verification code obtained by the power supply device calculating the multiple second unit data, the power supply device calculates the multiple second unit data to obtain the third verification code, and attaches the third verification code to the second data.
[0250] S40A: After receiving the second data, the second controller extracts a third verification code from the second data. If the third verification code is the same as the fourth verification code, the second receiving unit has successfully received 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 is the same as the fourth verification code, it indicates 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 means that the second data is erroneous or has been tampered with. The second controller can request the power supply device to resend the second data, or perform other processing operations, such as issuing an alarm reminder of 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 a 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, and the third verification code is a verification code obtained by the power supply device by calculating the plurality of second unit data.
[0255] In some embodiments, the second data module further includes: a fourth calculation unit, the fourth calculation unit is connected to the second receiving unit, and the fourth calculation unit is used to calculate the second unit data.
[0256] Specifically, the received several second unit data are sorted according to the data receiving order, and the second controller controls the fourth calculation unit to calculate the sorted several 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 several second unit data one by one to obtain the fourth verification code corresponding to the second data.
[0257] It can be 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 device calculating the multiple second unit data. The power supply device calculates the multiple second unit data to obtain the third verification code and attaches the third verification code to the second data.
[0258] Exemplarily, 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 (for example, 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, uses CRC check to calculate the corresponding second unit verification code for all the second unit data in sorted order, until the last second unit verification code corresponding to the last second unit data is calculated, 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 obtains the fourth verification code, and extracts the third verification code from the second data. If the third verification code is the same as the fourth verification code, the second receiving unit successfully receives the second data.
[0260] Specifically, after calculating a plurality of second unit data and obtaining a fourth verification code, the fourth calculation unit stores the fourth verification code in a register, and the second controller obtains the fourth verification code from the register. The second controller also extracts a 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 means that the second data is erroneous or has been tampered with. The second controller can request the power supply device to resend the second data, or perform other processing operations, such as issuing an alarm reminder of 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 the fifth baud rate, the communication method further includes but is not limited to the following steps S70A:
[0263] S70A: The second data module stores the second unit data in the second cache module.
[0264] In some embodiments, the charging device further includes a second cache module, wherein the second cache module is connected to the second receiving unit, and the second cache module is used to store data received by the second receiving unit.
[0265] Exemplarily, 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 cache module, thereby storing the second unit data in the second cache module.
[0266] In summary, the communication method provided in the embodiment of the present invention is applied to a charging device, 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 sending unit and a first receiving unit, the first sending 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 connected to the second controller for communication, the second data module includes a second sending unit and a second receiving unit, the second sending 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 state of the first interface, the second data module sends a predetermined handshake sequence to the power supply device through the data negative line of the second interface in response to the first interface being in the first state, the second controller 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 a first level, the second controller configures the baud rate of the second sending unit, and controls the second sending unit to send the first unit of data to the power supply device through the second interface at the baud rate.
[0267] The embodiment of the present invention realizes a fusion fast charging communication protocol between a power supply device and a charging device by combining software and hardware, which can reduce costs, shorten the development cycle, improve scalability, and facilitate updating and maintenance.
[0268] An embodiment of the present invention provides a computer-readable storage medium, on which computer program instructions executable by a processor are stored. When the computer program instructions are called by the processor, the processor executes any one of the communication methods provided in the embodiments of the present invention, or executes steps in any one of the possible implementation methods of any one of the communication methods provided in the embodiments of the present invention.
[0269] Those skilled in the art will appreciate that the embodiments provided by the present invention are only illustrative, and the order of writing the steps in the method of the embodiment does not mean 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, and the modules or sub-modules, units or sub-units in the device or system of the embodiment can be merged, divided and deleted according to actual needs. For example, the division of units is only a logical function division, and there can 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 description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Those skilled in the art can understand that all or part of the processes in the above embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0271] It should be noted that the above embodiments are intended to illustrate the technical concept and features of the present invention, and their purpose is to enable people familiar with this technology to understand the content of the present invention and implement it accordingly, and cannot be used to limit the scope of protection of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiments can be implemented according to the technical solutions recorded in the embodiments of the present invention, or some of the technical features can be equivalently replaced. It can be understood that these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and should be regarded as equal changes and modifications based on the embodiments of the present invention, and should all fall within the scope of the claims of the present invention.
Claims
1. A communication method, applied to a power supply device, 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 respectively connected to the first controller for communication, the first data module includes a first sending unit and a first receiving unit, the first sending 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 sending unit and a second receiving unit, the second sending 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; The method comprises: The first controller controls the data positive line and the data negative line 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 a first voltage sequence received on a 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 controls the data negative line and the data positive line of the first interface to be disconnected and short-circuited in response to the first interrupt signal, and sets the level of the data positive line of the first interface to be a first level; The first controller configures the baud rate of the first receiving unit; The first receiving unit receives a 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 an initial baud rate of the first receiving unit; The first receiving unit receives a first sequence sent by the charging device based on the initial baud rate, and calculates the first sequence to obtain a first baud rate; The first receiving unit generates a second interrupt signal, and sends the second interrupt signal to the first controller; The first controller obtains the first baud rate from the first data module in response to the second interrupt signal, 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 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; The first controller reads the first unit data from the first data module in response to the third interrupt signal.
4. The method according to claim 3, characterized in that The method further comprises: S10: The first controller calculates the current first unit data to obtain a 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 a next first unit verification code corresponding to the next first unit data; S30: the first controller executes S10-S20 in a loop until the first unit verification code corresponding to the last first unit data and the first unit data before the last first unit data is calculated to obtain the last first unit verification code corresponding to the last first unit data, wherein the last first unit data is the last first unit data in the first data, the last first unit verification code is the first verification code corresponding to the first data, the first data includes a plurality of the first unit data and the second verification code, and the second verification code is a verification code obtained by the charging device calculating the plurality of the 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 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 sending unit to send the 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 sending unit to be the second baud rate, and controls the first sending unit to send the first sequence to the charging device; The first controller obtains a plurality of second unit data from the first data module, calculates the 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 second baud rate.
6. The method according to claim 3, characterized in that: The first unit data includes a plurality of data, the first data module also includes a first calculation 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 including a plurality of the first unit data and a second verification code, and the second verification code is a verification code obtained by the charging device calculating the plurality of the first unit data; The first controller obtains the first verification code, and extracts the second verification code from the first data, and 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 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 calculation unit, and the first controller controls the first sending unit to send the 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 sending unit to the third baud rate, and controls the first sending unit to send the first sequence to the charging device; The first controller controls the second calculation unit to calculate a plurality of second unit data to obtain a third verification code, and appends the third verification code to the second data, and 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 to 7, characterized in that The power supply device further includes a first cache 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 sending unit and a first receiving unit, the first sending 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 connected to the second controller for communication, the second data module includes a second sending unit and a second receiving unit, the second sending 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; The method comprises: The second controller controls the detection circuit of the second interface to detect the state of the first interface; The second data module sends a predetermined handshake sequence to the power supply device through the data negative line of the second interface in response to the first interface being in the first state; The second controller 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 a first level, the second controller configures the baud rate of the second sending unit, and controls the second sending unit to send a first unit of data to the power supply device through the second interface at the baud rate.
10. The method according to claim 9, characterized in that The second controller configures the baud rate of the second sending unit, including: The second controller acquires the first sequence and parses the first sequence to obtain a fourth baud rate; The second controller configures the fourth baud rate as the baud rate of the second sending unit, and controls the second sending unit to send the first sequence to the power supply device.
11. The method according to claim 9, characterized in that The 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 obtains a plurality of first unit data from the second data module, calculates the 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 device 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 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 calculation 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, and 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 device through the second interface at the baud rate.
13. The method according to claim 11 or 12, characterized in that: After controlling the second sending unit to send the first unit data to the power supply device through the second interface at the baud rate, the method further includes: The second controller configures an 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 a fifth baud rate; The second data module generates a fourth interrupt signal, and sends the fourth interrupt signal to the second controller; The second controller acquires the fifth baud rate from the second data module in response to the fourth interrupt signal, 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 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; The second controller reads the second unit data from the second data module in response to the fifth interrupt signal.
15. The method according to claim 14, characterized in that The method further comprises: S10A: The second controller calculates the current second unit data to obtain a 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 a next second unit verification code corresponding to the next second unit data; S30A: the second controller executes S10A-S20A in a loop until the second unit verification code corresponding to the last second unit data and the second unit data before the last second unit data is calculated to obtain the last second unit verification code corresponding to the last second unit data, wherein the last second unit data is the last second unit data in the second data, the last second unit verification code is the fourth verification code corresponding to the second data, the second data includes a plurality of the second unit data and a third verification code, and the third verification code is a verification code obtained by the power supply device calculating the plurality of the 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 is the same as the fourth verification code, the second receiving unit successfully receives the second data.
16. The method according to claim 14, characterized in that The second unit data includes a plurality of units, the second data module also 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, wherein the second data includes a plurality of the second unit data and a third verification code, and the third verification code is a verification code obtained by the power supply device calculating the plurality of the second unit data; The second controller obtains the fourth verification code, and extracts the third verification code from the second data. If the third verification code is the same as the fourth verification code, the second receiving unit successfully receives the second data.
17. The method according to any one of claims 13 to 16, characterized in that: The charging device further includes a second cache module connected to the second receiving unit, and 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: a first cache module, a first controller, a first interface and a first data module that are communicatively connected to the first controller, wherein the first data module comprises a first sending unit, a first receiving unit, a first calculating unit and a second calculating unit, wherein the first sending unit is connected to the second calculating unit, the first receiving unit is connected to the first cache module and the first calculating unit respectively, and the first sending unit and the first receiving unit are also connected to the first interface respectively; The first controller comprises: 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, and when the computer program instructions are called by the first processor, the first processor executes the communication method according to any one of claims 1 to 8.
19. A charging device, characterized in that: include: a second cache module, a second controller, and a second interface and a second data module that are communicatively connected to the second controller, wherein the second data module comprises a second sending unit, a second receiving unit, a third computing unit, and a fourth computing unit, wherein the second sending unit is connected to the third computing unit, the second receiving unit is connected to the second cache module and the fourth computing unit respectively, and the second sending unit and the second receiving unit are also connected to the second interface respectively; The second controller comprises: 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, and when the computer program instructions are called by the second processor, the second processor executes the communication method according to any one of claims 9 to 17.
20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions executable by a processor, and when the computer program instructions are called by the processor, the processor executes the communication method as described in any one of claims 1-8, or executes the communication method as described in any one of claims 9-17.
Citation Information
Patent Citations
Device and method for terminal charger charging, USB charging and data communication
CN101383627A
Communication detection method, device, equipment, system and storage medium
CN117335510A
Fill protocol conversion system, chip and data line soon
CN206559073U
Device for securing a charge operation of an end-user device
US10866622B1