Data interaction method, device, system and storage medium for electric-assisted bicycle

By obtaining and converting data communication instructions in the electric power-assisted bicycle, and using the communication protocol rule library to match and parse, the problem of mismatch in communication protocols between the upper and lower computers is solved, flexible data interaction and transmission is achieved, and the operation process is simplified.

CN115022418BActive Publication Date: 2024-09-24NANJING DMHC SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210818048.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2024-09-24
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

When the communication protocols between the upper computer and the lower computer of existing electric power-assisted bicycles do not match, it is difficult to carry out normal communication and data interaction, resulting in increased operational complexity.

Method used

By obtaining data communication instructions, converting and generating data messages, and using the preset communication protocol rule library for matching and analysis, the appropriate communication protocol rules are determined, the conversion and transmission of data messages are realized, and the communication protocols between different devices are ensured. Normal interactions can still occur when they are inconsistent.

Benefits of technology

It improves the flexibility of interaction between different upper and lower computers of electric power-assisted bicycles, avoids complex manual adjustments, and ensures smooth data transmission when communication protocols are inconsistent.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115022418B
    Figure CN115022418B
Patent Text Reader

Abstract

The embodiment of the present invention provides a data interaction method, device, system and storage medium for an electric-assisted bicycle, which relates to the field of electric-assisted bicycles and is applied to an interaction module in a data interaction system; the method includes: obtaining a first data communication instruction generated by a first device; converting the first data communication instruction to generate a first data message; matching a preset communication protocol rule library according to the first data message to determine a first communication protocol rule that matches the first data message; using the first communication protocol rule to parse the first data message to obtain a message identifier and a data subject in the first data message; using a second communication protocol rule corresponding to a second identifier to convert the data subject and the message identifier to generate a second data message; transmitting the second data message to a second device. The present invention can increase the flexibility of interaction between different upper and lower computers of an electric-assisted bicycle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electric-assisted bicycles, and in particular to a data interaction method, device, system and storage medium for electric-assisted bicycles. Background Art

[0002] When the original bicycle is added with a drive system, it becomes an electric-assisted bicycle, which greatly facilitates people's lives.

[0003] The main structure of the electric power-assisted bicycle drive system includes instruments, controllers, batteries (including battery management system BMS), sensors, motors, etc., which can be divided into upper computers, lower computers and control components. For example, the instrument is the upper computer, the controller, BMS system, etc. are lower computers, and sensors, motors, etc. are control components. The upper computer and the lower computer need to use the same communication protocol and configure channels for mutual communication in order to carry out normal communication, data exchange, data modification, upgrade and other operations.

[0004] However, once the communication protocol between most host computers and slave computers is configured, if you modify or replace a different host computer or slave computer, the protocol may not match and communication may be difficult. Even the same manufacturer and the same equipment may have slight differences due to different models, making operation inconvenient. Summary of the invention

[0005] The embodiments of the present invention provide a data interaction method, device, system and storage medium for an electric-assisted bicycle, which increase the interaction flexibility between different upper and lower computers of the electric-assisted bicycle.

[0006] In a first aspect, an embodiment of the present invention provides a data interaction method for an electric-assisted bicycle, which is applied to an interaction module in a data interaction system; the method comprises:

[0007] Acquire a first data communication instruction generated by a first device; the first device is any one of a host computer and a slave computer, the host computer is a host computer associated with the electric-assisted bicycle, and the slave computer is a slave computer in the electric-assisted bicycle;

[0008] Converting the first data communication instruction to generate a first data message;

[0009] According to the first data message, matching is performed through a preset communication protocol rule base to determine a first communication protocol rule that matches the first data message; the preset communication protocol rule base stores a plurality of preset communication protocol rules;

[0010] The first data message is parsed using the first communication protocol rule to obtain a message identifier and a data body in the first data message; the message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate the first device, and the second identifier is used to indicate the second device; the second device is another type of device in the upper computer and the lower computer;

[0011] Using a second communication protocol rule corresponding to the second identifier, converting the data subject and the message identifier to generate a second data message;

[0012] Transmit the second data packet to the second device.

[0013] Optionally, before acquiring the first data communication instruction generated by the first device, the method includes:

[0014] Receive multiple handshake messages sent by multiple devices, and determine the communication protocol rules and message identifiers corresponding to each of the devices according to the multiple handshake messages; the multiple devices include the first device and the second device.

[0015] Optionally, after converting the first data communication instruction to generate a first data message, the method further comprises:

[0016] Parsing the first data message to obtain a first parsing result of the first data message;

[0017] Verifying the first data message according to the first parsing result;

[0018] The step of matching the first data message through a preset communication protocol rule base to determine a first communication protocol rule that matches the first data message includes:

[0019] If the verification of the first data message passes, a match is performed based on the first data message through a preset communication protocol rule library to determine a first communication protocol rule that matches the first data message.

[0020] Optionally, the verifying the first data message according to the first parsing result includes:

[0021] If the first parsing result includes: a start bit, an end bit, data to be verified and a check bit, the data to be verified is verified using the check bit;

[0022] If the to-be-verified data passes verification, it is determined that the first data message passes verification.

[0023] Optionally, the verifying the first data message according to the first parsing result further includes:

[0024] If the first data communication instruction is converted to generate multiple first data messages, the first parsing result includes multiple start bits, multiple end bits, multiple data to be verified and multiple check bits corresponding to the multiple first data messages, and each of the check bits is used to verify the corresponding data to be verified;

[0025] If each of the to-be-verified data passes verification, it is determined that the first data message passes verification.

[0026] Optionally, if the upper computer is an instrument device in the driving device of the electric-assisted bicycle, the lower computer is the remaining driving device except the instrument device;

[0027] If the upper computer is a mobile terminal independent of the electric-assisted bicycle or a personal computer that is communicatively connected to the interactive module, then the lower computer is a driving device of the electric-assisted bicycle.

[0028] Optionally, if the first device is a host computer, the first data communication instruction is a control instruction or a status acquisition instruction; or,

[0029] If the first device is a lower computer, the first data communication instruction is a control feedback instruction or a status data feedback instruction.

[0030] In a second aspect, an embodiment of the present invention further provides a data interaction device for an electric-assisted bicycle, which is applied to an interaction module in a data interaction system; the device comprises:

[0031] an acquisition module, configured to acquire a first data communication instruction generated by a first device; the first device is any one of a host computer and a slave computer, the host computer is a host computer associated with the electric-assisted bicycle, and the slave computer is a slave computer in the electric-assisted bicycle;

[0032] A first conversion module, used for converting the first data communication instruction to generate a first data message;

[0033] A matching module, configured to match a preset communication protocol rule base according to the first data message, and determine a first communication protocol rule that matches the first data message; the preset communication protocol rule base stores a plurality of preset communication protocol rules;

[0034] A parsing module, configured to parse the first data message using the first communication protocol rule to obtain a message identifier and a data body in the first data message; the message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate the first device, and the second identifier is used to indicate a second device; the second device is another type of device in the upper computer and the lower computer;

[0035] A second conversion module, configured to convert the data subject and the message identifier by adopting a second communication protocol rule corresponding to the second identifier to generate a second data message;

[0036] A transmission module, used for transmitting the second data message to the second device.

[0037] In a third aspect, an embodiment of the present invention further provides a data interaction system for an electric assisted bicycle, comprising: a plurality of first devices, a plurality of second devices, and an interaction module; the plurality of the first devices and the plurality of the second devices are respectively communicatively connected to the interaction module, wherein the interaction module is used to execute the steps of the data interaction method for an electric assisted bicycle as described in any one of the first aspects.

[0038] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data interaction method for an electric assisted bicycle as described in any one of the first aspects are executed.

[0039] The data interaction method, device, system and storage medium of an electric-assisted bicycle provided by the present invention are applied to the interaction module in the data interaction system, and can convert and generate a first data message by obtaining a first data communication instruction generated by a first device; then, according to the first data message, a preset communication protocol rule library is matched to determine the first communication protocol rule matching the first data message. Then, the first communication protocol rule is adopted to parse the first data message to obtain the message identifier and data subject in the first data message; then, the second communication protocol rule corresponding to the second identifier is adopted to convert the data subject and the message identifier to generate a second data message, and finally the second data message is transmitted to the second device. Through such an interactive mode, when the upper computer or the lower computer in the electric-assisted bicycle interacts, even if the communication protocol is inconsistent, the instruction to be transmitted can still be sent to the target device, avoiding manual complex adjustments when the communication protocol is inconsistent, and increasing the interaction flexibility between different upper and lower computers of the electric-assisted bicycle. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 A schematic diagram of a data interaction system for an electric-assisted bicycle provided by the present invention;

[0042] Figure 2 A schematic diagram of another data interaction system for an electric-assisted bicycle provided by the present invention;

[0043] Figure 3 A schematic flow chart of a data interaction method for an electric-assisted bicycle provided by the present invention;

[0044] Figure 4 A flow chart of another data interaction method provided by the present invention;

[0045] Figure 5 A flow chart of another data interaction method provided by the present invention;

[0046] Figure 6 A flow chart of another data interaction method provided by the present invention;

[0047] Figure 7 A schematic diagram of a data interaction device for an electric-assisted bicycle provided by the present invention.

[0048] Icons: 1, first device; 2, second device; 3, interaction module. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in 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 part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0050] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents 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 creative work are within the scope of protection of the present invention.

[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0052] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0053] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0054] Before explaining the present invention in detail, the application scenario of the present invention is first introduced.

[0055] Different components of an electric-assisted bicycle need to use the same communication protocol to communicate with each other. However, most components need to use the same communication protocol to communicate, which not only limits the interaction method of the electric-assisted bicycle, but also increases the difficulty of interaction between different electric-assisted bicycles.

[0056] Based on this, the present application provides a data interaction method, device, system and storage medium for an electric-assisted bicycle, so that the interaction module in the data interaction system obtains the first data communication instruction generated by the first device, thereby converting and generating a first data message; then, according to the first data message, the preset communication protocol rule library is matched to determine the first communication protocol rule that matches the first data message. Then, the first communication protocol rule is adopted to parse the first data message to obtain the message identifier and data subject in the first data message; then, the second communication protocol rule corresponding to the second identifier is adopted to convert the data subject and the message identifier to generate a second data message, and finally the second data message is transmitted to the second device, so that two devices with different communication protocols can communicate with each other, know the instruction information, and avoid the problem that devices with different communication protocols cannot communicate with each other.

[0057] The data interaction method of the electric-assisted bicycle provided in the following embodiments of the present invention can be executed by an interaction module in a data interaction system, and the interaction module can be an integrated circuit chip with signal processing capabilities, such as 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. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor, and this application does not limit this.

[0058] The following is an explanation through multiple embodiments in conjunction with the accompanying drawings. Figure 1 This is a schematic diagram of a data interaction system for an electric-assisted bicycle provided by the present invention. Figure 1 The data interaction system of the electric-assisted bicycle comprises: a plurality of first devices 1, a plurality of second devices 2, and an interaction module 3; the plurality of first devices 1 and the plurality of second devices 2 are respectively connected to the interaction module 3 for communication.

[0059] The first device 1 is any one of the upper computer and the lower computer, the upper computer is the upper computer associated with the electric-assisted bicycle, and the lower computer is the lower computer in the electric-assisted bicycle. The second device 2 is another type of device in the upper computer and the lower computer. If the first device 1 is the upper computer, the second device 2 is the lower computer. If the first device 1 is the lower computer, the second device 2 is the upper computer.

[0060] In the present application, if the upper computer is an instrument device in the driving device of the electric-assisted bicycle, the lower computer is the remaining driving device except the instrument device.

[0061] In this embodiment, the driving device of the electric-assisted bicycle includes an instrument device, a vehicle controller of the electric-assisted bicycle, a battery management unit (Battery Management System, BMS), a motor, etc., and this application does not make any specific restrictions on this.

[0062] If the upper computer is a mobile terminal independent of the electric-assisted bicycle, or a personal computer (PC) that is communicatively connected to the interactive module, then the lower computer is a driving device of the electric-assisted bicycle.

[0063] In this embodiment, the mobile terminal is a computer device with information processing and control functions, such as a smart phone, a tablet computer, etc. The PC can be a laptop or a desktop computer, and this application does not make specific restrictions on this.

[0064] Optionally, if the host computer is the first device 1 and the slave computer is the second device 2, the data interaction system may also include a third device other than the host computer or the slave computer, and multiple third devices may be communicatively connected to multiple slave computers, and any slave computer may control multiple third devices. At the same time, for one slave computer, it may control or collect data from multiple third devices in multiple electric-assisted bicycles, such as motors, handlebars, brakes, lights, and other onboard devices.

[0065] It should be noted that, in one possible case, if the upper computer is an instrument device of an electric-assisted bicycle and the lower computer is a motor, the lower computer is no longer connected to the third device, and the instrument device can collect data from the motor; in another possible case, if the upper computer is an instrument device of an electric-assisted bicycle and the lower computer is a vehicle controller, the third device can be multiple motors, so that the vehicle controller can control or collect data from the multiple motors.

[0066] like Figure 1 As shown, in this embodiment, the interaction module 3 of the electric-assisted bicycle is independent of the first device 1 or the second device 2. In a possible implementation, the interaction module 3 of the electric-assisted bicycle can be set in the first device 1 or in the second device 2, and this application does not limit this.

[0067] Figure 2 This is a schematic diagram of another data interaction system for an electric-assisted bicycle provided by the present invention. Figure 2 As shown, if the interactive module 3 of the electric-assisted bicycle is set in the first device 1, Figure 2 Only an example of the interaction module 3 in the first device 1 is shown in the figure. In the data interaction system, multiple modules such as Figure 2 The first device 1 shown, that is, each first device 1 may have an internal interaction module 3 , and when the first device 1 needs to communicate with the second device 2 , the internal interaction module 3 performs data communication.

[0068] During the example application, the first device 1 / second device 2 can send data communication instructions to the second device 2 / first device 1, and then the interaction module 3 processes the data communication instructions, so that the information contained in the data communication instructions is converted by the interaction module 3 into a data message that can be recognized by the second device 2 / first device 1, and then transmitted to the second device 2 / first device 1, so that communication can be achieved between the first device 1 and the second device 2.

[0069] In this embodiment, data can be transmitted between the upper computer and the lower computer through the interaction module, avoiding complex manual adjustments when the communication protocols are inconsistent, and increasing the interaction flexibility between different upper and lower computers of the electric-assisted bicycle.

[0070] Based on the data interaction system provided in the above embodiment, the present invention also provides a possible implementation of a data interaction method for an electric-assisted bicycle. Figure 3 The present invention provides a flow chart of a data interaction method for an electric-assisted bicycle. Figure 3 As shown, the data interaction method of the electric-assisted bicycle is applied to the interaction module in the data interaction system, and the data interaction method of the electric-assisted bicycle includes:

[0071] S110, obtaining a first data communication instruction generated by a first device.

[0072] The first device 1 is any one of a host computer and a slave computer. The host computer is a host computer associated with an electric power-assisted bicycle, and the slave computer is a slave computer in the electric power-assisted bicycle.

[0073] In this embodiment, when the first device 1 is a host computer, the second device 2 is a slave computer; when the first device 1 is a slave computer, the second device 2 is a host computer.

[0074] Optionally, if the host computer is an instrument device in the driving device of the electric-assisted bicycle, the lower computer is the remaining driving device except the instrument device; if the host computer is a mobile terminal independent of the electric-assisted bicycle or a PC that is connected to the interactive module for communication, the lower computer is the driving device of the electric-assisted bicycle. At the same time, for a lower computer, the third device in multiple electric-assisted bicycles, such as motors, handlebars, brakes, lights and other vehicle components, can be controlled or data collected.

[0075] In the present application, there is no restriction on the communication protocol used by the host computer or the slave computer. Optionally, UART (Universal Asynchronous Receiver / Transmitter) communication, CAN (Controller Area Network) bus communication, USART (Universal Synchronous / Asynchronous Receiver / Tran) communication, I2C (Inter-Integrated Circuit, two-wire serial bus) communication, SPI (Serial Peripheral Interface, serial peripheral interface) communication, Modbus (a serial communication protocol) communication and other communication protocols can be used. At the same time, there is no restriction on the specific data message rules of the communication protocol used by the host computer or the slave computer.

[0076] When the first device 1 needs to perform data communication with the second device 2, the first device 1 initiates a data communication instruction to the second device 2, and the interaction module 3 first obtains the first data communication instruction generated by the first device 1 for processing.

[0077] The first data communication instruction includes any instruction information such as control, status acquisition, status feedback, control feedback, etc. sent by the first device 1 to the second device 2. This application does not impose any specific restrictions on the specific information included in the first data communication instruction.

[0078] S120: Convert the first data communication instruction to generate a first data message.

[0079] For the interaction module 3, the acquired first data communication instruction may be in the form of high or low level. Optionally, a shift register may be used to convert the first data communication instruction to generate a first data message.

[0080] For the interaction module 3, the first data communication instruction obtained by it can be in the form of high and low levels, and a shift register can be used to capture the level pulse output by the first device 1, so as to convert the first data communication instruction into a first data message.

[0081] S130: According to the first data message, a match is performed through a preset communication protocol rule base to determine a first communication protocol rule that matches the first data message.

[0082] The preset communication protocol rule base stores a variety of preset communication protocol rules.

[0083] In this embodiment, when the interaction module 3 obtains the first data message, it is necessary to first determine the communication protocol rule corresponding to the first data message, that is, determine the communication protocol rule of the first device 1 corresponding to the first data message.

[0084] In the present application, a preset communication protocol rule library is used for matching to determine a first communication protocol rule that matches the first data message. Optionally, the preset communication protocol library stores a plurality of preset communication protocol rules, which may include various message rules and corresponding instruction definitions contained in communication protocols such as UART, CAN, USART, I2C, Modbus, etc.

[0085] Optionally, a traversal method may be adopted to match the first data message with various communication protocol rules included in a preset communication protocol rule base until a communication protocol rule identical to the first data message is obtained through traversal.

[0086] In a possible implementation, if no communication protocol rule matching the first data message is found in the preset communication protocol rule base, the first data message is stored in the preset communication protocol rule base, and the interaction module 3 abandons processing and transmission of the first data message.

[0087] S140, using the first communication protocol rule to parse the first data message to obtain a message identifier and a data body in the first data message.

[0088] The message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate a first device, and the second identifier is used to indicate a second device; the second device is another type of device in the upper computer and the lower computer.

[0089] In this embodiment, after the first communication protocol rule corresponding to the first data message is traversed and obtained, the first data message is parsed to obtain the message identifier and the data body in the first data message.

[0090] The message identifier includes a first identifier for indicating the first device and a second identifier for indicating the second device, that is, the source of the first data message and the destination to be sent can be known according to the message identifier. Optionally, the message identifier also includes: a third identifier, which is used to indicate a third device controlled by the lower computer.

[0091] If the first device 1 is a host computer and the second device 2 is a slave computer, the third identifier obtained by parsing the first data message is the device identifier that the first device 1 wants to control through the second device 2; if the first device 1 is a slave computer and the second device 2 is a host computer, the third identifier obtained by parsing the first data message is the device identifier that the first device 1 feeds back the control result to the second device 2.

[0092] For the data subject, it contains the valid data information of the first data message, that is, the specific instruction information contained in the first data message, such as "inquire about the power level", "shutdown", "return the power level", "shutdown" and other specific instruction information.

[0093] For example, for the UART communication protocol, the following communication protocol rules may be provided, such as: start bit, message ID (Identity document), valid data length, valid data, check bit, end bit; or: start bit, target address, source address, message ID, valid data length, valid data, check bit, end bit.

[0094] Among them, the start bit of the message indicates the beginning of the message, the length of the valid data is the length of the valid data that identifies the data message, the valid data contains the specific instruction information contained in the data message, the check bit contains the check information of the data message, and the end bit is used to indicate the end of the data message.

[0095] Optionally, if the communication protocol rules only contain a message ID between the start bit and valid data of the message, the message ID includes the target address (i.e., the address of the upper computer / lower computer to which the data message needs to be sent), the source address ID (i.e., the source address of the data communication instruction corresponding to the data message), and the device ID (identifying the ID of the third device controlled by the lower computer).

[0096] If the target address, source address, and message ID are included between the start bit and valid data of the message in the communication protocol, then the target address (i.e. the address of the upper computer / lower computer to which the data message needs to be sent), the source address ID (i.e. the source address of the data communication instruction corresponding to the data message), and the message ID are the device ID, which is used to identify the ID of the third device controlled by the lower computer.

[0097] S150, using the second communication protocol rule corresponding to the second identifier, converting the data body and the message identifier to generate a second data message.

[0098] For the interactive module 3, after obtaining the message identifier and data body in the first data message, that is, obtaining the corresponding first identifier and second identifier of the first data message, the data body and the message identifier can be converted according to the second communication protocol rules and corresponding definitions corresponding to the second device 2 corresponding to the second identifier to generate a second data message, that is, the source, destination, and valid information of the first data message are converted through the second communication protocol that can be recognized by the second device 2 into a second data message that can be recognized by the second device 2.

[0099] S160: Transmit the second data message to the second device.

[0100] After the interaction module 3 obtains the second data message, it transmits the second data message to the second device 2 , so that the second device 2 can obtain the instruction information included in the first data communication instruction that the first device 1 wants to convey.

[0101] In order to clearly explain the data interaction process of the electric-assisted bicycle, the present application takes the first device 1 as the host computer, which is the instrument in the electric-assisted bicycle; the second device 2 as the slave computer, which is the controller in the electric-assisted bicycle. The first device adopts the communication protocol rules of "start bit, target address, source address, message ID, valid data length, valid data, check bit, end bit" in UART.

[0102] First, the communication protocol rules and corresponding instruction definitions corresponding to the first device 1 in the embodiment of the present invention are provided.

[0103] Table 1 Definition of target address ID and source address ID

[0104] equipment ID PC 0xAA meter 0x01 Battery 0x02 Controller 0x03

[0105] As shown in Table 1, in an embodiment of the present invention, the message ID of the host PC is assigned to 0xAA, the message ID of the host instrument is assigned to 0x01, the message ID of the slave battery is assigned to 0x02, and the message ID of the slave controller is assigned to 0x03.

[0106] Table 2 Message ID when the instrument and controller communicate

[0107]

[0108] As shown in Table 2, in the embodiment of the present invention, the identification ID of the upper computer instrument hardware version (version number DM TC600635: 0x001E0203) is assigned to 0x0001, the identification ID of the lower computer controller software version (version number DM STM32 FOC1.0: 0x001E0103) is assigned to 0x0002, the identification ID of the hardware version of the motor 01 controlled by the controller (version number DMDJ0011: 0x001E0401) is assigned to 0x0003, and the identification ID of the hardware version of the motor 02 controlled by the controller (version number DM DJ0011: 0x001E0403) is assigned to 0x0004; in addition, the request type, the sending mode (whether to send at startup; whether to send during normal operation), and the effective data length are defined.

[0109] Table 3 Definition of message ID when communicating between instrument and controller

[0110]

[0111] As shown in Table 3, in the embodiment of the present invention, the identification ID of the wheelbase is assigned to 0x0101, the identification ID of the maximum speed limit is assigned to 0x0102, the identification ID of the riding speed is assigned to 0x0103, and the identification ID of the single mileage is assigned to 0x010D; in addition, the request type, the message sending period, the message timeout, and the data length are also defined.

[0112] Table 4 Specified instructions in the communication protocol

[0113] ID describe 0x02 Start bit 0x03 End bit 0x00 Read Request 0x01 Write Request

[0114] As shown in Table 4, in one embodiment of the present invention, the identification ID of the start bit is assigned a value of 0x02, the identification ID of the end bit is assigned a value of 0x03, the identification ID of the read request is assigned a value of 0x00, and the identification ID of the write request is assigned a value of 0x01.

[0115] In this embodiment, the protocol sends messages following the "high bit first, low bit last" principle. Therefore, when the instrument needs to request the controller to read the hardware version number of motor 02, it needs to send: 02 (start bit) 03 (destination address: controller) 01 (source address: instrument) 04 00 (third device address: motor 02) 00 (valid data length) 00 (valid data: read request) 50A0 (check bit) 03 (end bit).

[0116] Finally, when the controller returns the hardware version number of motor 02 to the instrument, the interactive module 3 converts it and sends to the instrument: 02 (start bit) 01 (destination address: instrument) 03 (source address: controller) 04 00 (third device address: motor 02) 0400 (valid data length) 03 04 1E 00 (valid data: hardware version of motor 02) 94CD (check bit) 03 (end bit).

[0117] In this way, the upper computer and the lower computer achieve data communication.

[0118] In this embodiment, when the upper computer or the lower computer in the electric assisted bicycle interacts, even if the communication protocol is inconsistent, the instructions to be transmitted can still be sent to the target device, avoiding complex manual adjustments when the communication protocol is inconsistent, and increasing the flexibility of interaction between different upper and lower computers of the electric assisted bicycle.

[0119] Optionally, based on the above embodiment, in the above S110, before obtaining the first data communication instruction generated by the first device, the method further includes:

[0120] S210, receiving a plurality of handshake messages sent by a plurality of devices, and determining a communication protocol rule and a message identifier corresponding to each device respectively according to the plurality of handshake messages.

[0121] The multiple devices include a first device and a second device.

[0122] In the present application, before the interaction module 3 obtains the first data communication instruction, multiple devices included in the data interaction system, that is, multiple first devices 1 as upper computers and multiple second devices 2 as lower computers, are required to actively send handshake information to the interaction module 3. The interaction module 3 performs steps S110-S130 for each handshake information respectively, so as to obtain the communication protocol rules and corresponding message identifiers of the devices corresponding to each handshake information, that is, before the interaction module 3 obtains the first data communication instruction, the interaction module 3 already knows the communication protocol rules corresponding to the first device 1 and the second device 2.

[0123] However, for the interaction module 3 to receive the first data communication instruction, it is still necessary to perform steps S110-S130 on the first data communication instruction, and it is necessary to know which first device 1 the current first data communication instruction is sent from and to which second device 2 the first data communication instruction needs to be sent.

[0124] In this embodiment, the interaction module receives multiple handshake messages in advance, so that when converting the data body and the message identifier in the subsequently received data communication instruction, the communication protocol rule of the receiving party can be known.

[0125] exist Figure 3 Based on the provided data interaction method, the present application also provides a possible implementation method of data interaction. Figure 4 The following is a flow chart of another data interaction method provided by the present invention. Figure 4 As shown, in the above S130, according to the first data message, matching is performed through a preset communication protocol rule base, and before determining the first communication protocol rule that matches the first data message, it includes:

[0126] S310, parse the first data message to obtain a first parsing result of the first data message.

[0127] In this embodiment, before matching, the first data message needs to be parsed to obtain a first parsing result of the first data message. The first parsing result may include: the start bit, end bit, check bit, and data to be checked of the first data message. The data to be checked is the data before the check bit and after the start bit.

[0128] S320: Verify the first data message according to the first parsing result.

[0129] The above S130, according to the first data message, matches through a preset communication protocol rule base to determine a first communication protocol rule that matches the first data message, includes:

[0130] S330: If the verification of the first data message passes, a match is performed based on the first data message through a preset communication protocol rule library to determine a first communication protocol rule that matches the first data message.

[0131] Optionally, the first data message can be verified according to the first analysis result and the preset verification rule, so as to prevent the data from being out of order or lost after being sent from the first device 1 to the interaction module 3. If the verification of the first data message passes, the above steps S130-160 are performed according to the first data message. Optionally, if the verification fails, the interaction module 3 abandons the data processing.

[0132] In this embodiment, by verifying the data before matching the data packets, it is avoided that the time is wasted by directly matching the incomplete data, thereby ensuring the integrity of the data.

[0133] exist Figure 1 Based on the provided data interaction method, the present application also provides a possible implementation method of data interaction. Figure 5 The following is a flow chart of another data interaction method provided by the present invention. Figure 5 As shown, the above S320, based on the first parsing result, verifies the first data message, including:

[0134] S410: If the first parsing result includes: a start bit, an end bit, data to be verified and a check bit, the data to be verified is verified using the check bit.

[0135] If the first parsing result includes: communication protocol type, start bit, end bit, message identifier, data to be verified and check bit, the check bit is used to verify the data to be verified. For this application, CRC (Cyclic Redundancy Check) check can be used.

[0136] Optionally, you can use a preset CRC check calculator, input the data to be checked, and then click OK according to the preset check method, such as "CRC-16 / CCITT-FALSE; x16+x12+x5+1", to get the check result of the data to be checked, and then compare it with the check bit data. If they are the same, it means the check is passed; if they are different, it means the check fails.

[0137] S420: If the data to be verified passes verification, it is determined that the first data message passes verification.

[0138] If the calculation result of the data to be verified is equal to the data of the check bit, it means that the verification is passed; if the verification is passed, it is confirmed that the verification of the first data message is passed, and then the above-mentioned S130-160 related steps are performed.

[0139] Optionally, in a possible implementation, if the first parsing result does not include the start bit, the end bit, or the check bit of the data message, it is directly determined that the check fails.

[0140] In this embodiment, the data message is checked for check bits and integrity to prevent the data from being altered during transmission.

[0141] Optionally, if the first device is a host computer, the first data communication instruction is a control instruction or a status acquisition instruction; or, if the first device is a slave computer, the first data communication instruction is a control feedback instruction or a status data feedback instruction.

[0142] In this embodiment, if the first device is a host computer, the first data communication instruction is a control instruction, such as "make the controller control motor 02 to shut down" or a status acquisition instruction, such as "make the controller obtain the version of motor 02"; if the first device is a slave computer, the first data communication instruction is a control feedback instruction, such as "feedback to the instrument that motor 02 has been controlled to shut down", or a status data feedback instruction, such as "feedback to the instrument the version of motor 02 0x001E0403".

[0143] Optionally, the present application also provides a possible implementation method for data interaction. Figure 6 The following is a flow chart of another data interaction method provided by the present invention. Figure 6 As shown, in the above S320, the first data message is verified according to the first parsing result, and further includes:

[0144] S510, if the first data message generated by the conversion of the first data communication instruction includes multiple data messages, the first parsing result includes multiple start bits, multiple end bits, multiple data to be verified and multiple check bits corresponding to the multiple data messages, and each check bit is used to verify the corresponding data to be verified.

[0145] S520: If the verification of the plurality of data to be verified all passes, it is determined that the verification of the first data message passes.

[0146] In this embodiment, if the first data message generated by the conversion of the first data communication instruction includes multiple data messages, after parsing the first data message, the start bit, end bit, data to be checked, and check bit corresponding to each data message can be obtained. For each data message, it is necessary to verify the data to be checked and the check bit in the data message. If the verification of the data to be checked in each data message passes, that is, each data message passes the verification, it is determined that the verification of the first data message passes.

[0147] In a possible implementation, if there is at least one data message that fails the verification in the verification result, the data message that fails the verification is discarded, and the data message that passes the verification is matched through a preset communication protocol rule library to determine the matching communication protocol rule.

[0148] In another possible implementation, if every data message in the verification result fails the verification, the first data message generated by converting the first data communication instruction is discarded as a whole, and the interaction of the first data message is terminated.

[0149] Optionally, if the upper computer is an instrument device in the driving device of the electric power-assisted bicycle, the lower computer is the remaining driving device except the instrument device;

[0150] If the upper computer is a mobile terminal independent of the electric-assisted bicycle, or a personal computer, which is connected to the interactive module for communication, the lower computer is a driving device of the electric-assisted bicycle.

[0151] Figure 7 A schematic diagram of a data interaction device for an electric-assisted bicycle provided by the present invention is shown in FIG. Figure 7 As shown, a data interaction device for an electric power-assisted bicycle is applied to an interaction module of a data interaction system, and the device comprises:

[0152] The acquisition module 1000 is used to acquire a first data communication instruction generated by a first device; the first device is any one of a host computer and a slave computer, the host computer is a host computer associated with the electric-assisted bicycle, and the slave computer is a slave computer in the electric-assisted bicycle;

[0153] A first conversion module 2000, configured to convert a first data communication instruction to generate a first data message;

[0154] The matching module 3000 is used to match the preset communication protocol rule base according to the first data message, and determine the first communication protocol rule that matches the first data message; the preset communication protocol rule base stores a plurality of preset communication protocol rules;

[0155] The parsing module 4000 is used to parse the first data message using the first communication protocol rule to obtain the message identifier and the data body in the first data message; the message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate the first device, and the second identifier is used to indicate the second device; the second device is another type of device in the upper computer and the lower computer;

[0156] The second conversion module 5000 is used to convert the data body and the message identifier by adopting the second communication protocol rule corresponding to the second identifier to generate a second data message;

[0157] The transmission module 6000 is used to transmit the second data message to the second device.

[0158] Optionally, the acquisition module 1000 is further configured to receive multiple handshake messages sent by multiple devices.

[0159] The matching module 3000 is further configured to determine the communication protocol rules and message identifiers corresponding to each device according to the multiple handshake messages, wherein the multiple devices include a first device and a second device.

[0160] Optionally, the parsing module 4000 is further configured to parse the first data message to obtain a first parsing result of the first data message.

[0161] Optionally, the device also includes: a verification module, used to verify the first data message according to the first analysis result; if the verification of the first data message passes, matching is performed based on the first data message through a preset communication protocol rule library to determine the first communication protocol rule that matches the first data message.

[0162] The verification module is specifically used to verify the data to be verified using the verification bit if the first parsing result includes: a start bit, an end bit, data to be verified and a verification bit; if the data to be verified passes the verification, it is determined that the verification of the first data message passes.

[0163] Optionally, the verification module is further configured to, if the first data message generated by the conversion of the first data communication instruction includes multiple data messages, then the first parsing result includes multiple start bits, multiple end bits, multiple data to be verified and multiple check bits corresponding to the multiple data messages, and each check bit is used to perform verification with the corresponding data to be verified;

[0164] If the verification of the plurality of data to be verified all passes, it is determined that the verification of the first data message passes.

[0165] Optionally, if the upper computer is an instrument device in the driving device of the electric power-assisted bicycle, the lower computer is the remaining driving device except the instrument device;

[0166] If the upper computer is a mobile terminal independent of the electric-assisted bicycle, or a personal computer, which is connected to the interactive module for communication, the lower computer is a driving device of the electric-assisted bicycle.

[0167] Optionally, if the first device is a host computer, the first data communication instruction is a control instruction or a status acquisition instruction; or, if the first device is a slave computer, the first data communication instruction is a control feedback instruction or a status data feedback instruction.

[0168] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0169] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, comprising a program, which is used to execute the above method embodiment when executed by a processor.

[0170] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0171] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0172] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0173] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: Processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0174] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data interaction method for an electric power-assisted bicycle, characterized in that: An interactive module applied to a data interactive system; the method comprises: Acquire a first data communication instruction generated by a first device; the first device is any one of a host computer and a slave computer, the host computer is a host computer associated with the electric-assisted bicycle, and the slave computer is a slave computer in the electric-assisted bicycle; if the host computer is an instrument device in a driving device of the electric-assisted bicycle, then the slave computer is the remaining driving device except the instrument device; if the host computer is a mobile terminal independent of the electric-assisted bicycle that is communicatively connected to the interactive module, or a personal computer, then the slave computer is the driving device of the electric-assisted bicycle; Converting the first data communication instruction to generate a first data message; According to the first data message, matching is performed through a preset communication protocol rule base to determine a first communication protocol rule that matches the first data message; the preset communication protocol rule base stores a plurality of preset communication protocol rules; The first data message is parsed using the first communication protocol rule to obtain a message identifier and a data body in the first data message; the message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate the first device, and the second identifier is used to indicate the second device; the second device is another type of device in the upper computer and the lower computer; Using a second communication protocol rule corresponding to the second identifier, converting the data subject and the message identifier to generate a second data message; Transmitting the second data message to the second device; Before obtaining the first data communication instruction generated by the first device, the method includes: Receive multiple handshake messages sent by multiple devices, and determine the communication protocol rules and corresponding message identifiers corresponding to each of the devices according to the multiple handshake messages; the multiple devices include the first device and the second device.

2. The method according to claim 1, characterized in that After converting the first data communication instruction to generate the first data message, the method includes: Parsing the first data message to obtain a first parsing result of the first data message; Verifying the first data message according to the first parsing result; The step of matching a preset communication protocol rule base according to the first data message to determine a first communication protocol rule that matches the first data message includes: If the verification of the first data message passes, a match is performed based on the first data message through a preset communication protocol rule library to determine a first communication protocol rule that matches the first data message.

3. The method according to claim 2, characterized in that The verifying the first data message according to the first parsing result includes: If the first parsing result includes: a start bit, an end bit, data to be verified and a check bit, the data to be verified is verified using the check bit; If the to-be-verified data passes verification, it is determined that the first data message passes verification.

4. The method according to claim 3, characterized in that The verifying the first data message according to the first parsing result further includes: If the first data message generated by converting the first data communication instruction includes multiple data messages, the first parsing result includes multiple start bits, multiple end bits, multiple data to be verified and multiple check bits corresponding to the multiple data messages, and each check bit is used to verify the corresponding data to be verified; If the verification of the plurality of data to be verified all passes, it is determined that the verification of the first data message passes.

5. The method according to claim 1, characterized in that If the first device is a host computer, the first data communication instruction is a control instruction or a status acquisition instruction; or, If the first device is a lower computer, the first data communication instruction is a control feedback instruction or a status data feedback instruction.

6. A data interaction device for an electric power-assisted bicycle, characterized in that: An interactive module applied to a data interactive system; the device comprises: An acquisition module is used to acquire a first data communication instruction generated by a first device; the first device is any one of a host computer and a slave computer, the host computer is a host computer associated with the electric-assisted bicycle, and the slave computer is a slave computer in the electric-assisted bicycle; if the host computer is an instrument device in a driving device of the electric-assisted bicycle, then the slave computer is the remaining driving device except the instrument device; if the host computer is a mobile terminal independent of the electric-assisted bicycle that is communicatively connected to the interactive module, or a personal computer, then the slave computer is the driving device of the electric-assisted bicycle; A first conversion module, used for converting the first data communication instruction to generate a first data message; A matching module, configured to match a preset communication protocol rule base according to the first data message, and determine a first communication protocol rule that matches the first data message; the preset communication protocol rule base stores a plurality of preset communication protocol rules; A parsing module, configured to parse the first data message using the first communication protocol rule to obtain a message identifier and a data body in the first data message; the message identifier includes: a first identifier and a second identifier, the first identifier is used to indicate the first device, and the second identifier is used to indicate a second device; the second device is another type of device in the upper computer and the lower computer; A second conversion module, configured to convert the data subject and the message identifier by adopting a second communication protocol rule corresponding to the second identifier to generate a second data message; A transmission module, used for transmitting the second data message to the second device; The acquisition module is further used to receive multiple handshake messages sent by multiple devices; The matching module is further used to determine the communication protocol rules and corresponding message identifiers corresponding to each of the devices according to the multiple handshake messages; the multiple devices include the first device and the second device.

7. A data interaction system for an electric-assisted bicycle, characterized in that: include: A plurality of first devices, a plurality of second devices, and an interaction module; A plurality of the first devices and a plurality of the second devices are respectively communicatively connected to the interaction module, wherein the interaction module executes the steps of the data interaction method for an electric-assisted bicycle as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data interaction method for an electric-assisted bicycle as claimed in any one of claims 1 to 5 are executed.