CAN (Controller Area Network) communication method and system for electric power-assisted bicycle

By generating the frame structure of CAN extended frames in the electric-assisted bicycle system, the automatic identification and configuration of the equipment is realized, the problem of poor device compatibility is solved, and the security of data transmission is improved through data verification, and the compatibility and scalability of the system are realized.

CN119922038AInactive Publication Date: 2025-05-02NEW ANANDA DRIVE TECHN SHANGHAI
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510077922.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-05-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing electric power bicycle system, the CAN communication protocol standards are not unified, resulting in poor equipment compatibility, and the inability to identify equipment from different manufacturers and different models, and there are problems such as data analysis errors.

Method used

By generating the contents of the ID segment, ID segment and data segment of the CAN extended frame, the frame structure generation steps are realized, the bus equipment is automatically identified and configured, the device identification and command transmission is carried out using heartbeat broadcasting and directional messages, and the verification function is added during data transmission.

Benefits of technology

It improves the compatibility and scalability of the electric-assisted bicycle system, ensures that different manufacturers and different models of equipment can operate smoothly in the system, and enhances the security and integrity of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922038A_ABST
    Figure CN119922038A_ABST
Patent Text Reader

Abstract

The invention provides a CAN communication method and system for an electric power-assisted bicycle, and the method comprises the steps: a master device / slave device which transmits a message generates an ID segment of a CAN extension frame, an ID extension segment and the content of a data segment according to the type of a CAN message which needs to be transmitted; the ID segment and the ID extension segment comprise a protocol data unit format and a protocol data unit specific domain; when the type of the CAN message is a broadcast message, a message number is configured in a second protocol data unit format in the protocol data unit format, message number extension content is configured in a protocol data unit specific domain, and device information of the sending device is configured in a data segment; and when the type of the CAN message is a directional message, configuring a message number in a first protocol data unit format in a protocol data unit format, configuring an equipment node ID for receiving the message in a protocol data unit specific domain, and configuring instruction information in a data segment. According to the invention, the bus equipment can be automatically identified and configured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a CAN communication method and system for an electric-assisted bicycle. Background Art

[0002] There are many electronic devices in the current electric bicycle system, such as instruments, controllers, batteries, etc. These devices communicate with each other according to a unified communication protocol to form a complete communication network. Patent document CN112467847A discloses an energy-saving battery vehicle intelligent charging system, in which the human-machine interactive control station and the PLC charging control terminal communicate through the CAN bus. The human-machine interactive control station transmits control instructions for battery charging time and charging voltage to the PLC charging control terminal, and the PLC charging control terminal executes the instructions to charge the battery.

[0003] With the development of the electric bicycle industry, the user group has expanded, and product demands have diversified, making the communication network of the electric bicycle system more and more complex. However, the current CAN communication protocol standards are not unified, which will lead to the following problems: On the one hand, if the communication standards are not unified, it will lead to duplication of software work, and it is easy to have problems such as the device not receiving messages or data parsing errors; on the other hand, the device has poor compatibility and lacks expansion capabilities. If users add devices from different manufacturers and different models to the electric bicycle system, the device may not be recognized. Summary of the invention

[0004] In view of the defects in the prior art, an object of the present invention is to provide a CAN communication method and system for an electric-assisted bicycle.

[0005] A CAN communication method for an electric-assisted bicycle provided by the present invention comprises:

[0006] Frame structure generation steps: The master device / slave device sending the message generates the contents of the ID segment, ID extension segment and data segment of the CAN extended frame according to the type of CAN message to be sent;

[0007] The ID segment and the ID extension segment include a protocol data unit format and a protocol data unit specific field;

[0008] When the type of the CAN message is a broadcast message, a message number is configured in the protocol data unit format in the second protocol data unit format, a message number extension content is configured in the protocol data unit specific field, and device information of a sending device is configured in the data segment;

[0009] When the type of the CAN message is a directional message, the message number is configured in the protocol data unit format in the first protocol data unit format, the device node ID for receiving the message is configured in the protocol data unit specific field, and the instruction information is configured in the data segment.

[0010] Further, including:

[0011] Heartbeat broadcast: after the slave device is connected to the CAN bus of the electric-assisted bicycle, the frame structure generation step is adopted to broadcast and send the first CAN message to the CAN bus;

[0012] Parsing the heartbeat message: the master device parses the first CAN message to obtain the device information of the slave device;

[0013] Sending a configuration instruction: the master device sends a second CAN message to the slave device in a directionally manner according to the device information of the slave device using the frame structure generation step;

[0014] Parsing configuration instructions: the slave device parses the second CAN message to obtain instruction information, and executes the instruction information.

[0015] Furthermore, the ID segment also includes: a priority and a reserved bit;

[0016] The master device / slave device that sends the CAN message configures the priority of the CAN message to be sent in the priority level according to a preset rule;

[0017] The master device / slave device receiving the CAN message sorts and analyzes the received CAN message according to the priority;

[0018] The reserved bit is reserved for configuration by the manufacturer of the slave device.

[0019] Furthermore, the ID extension segment also includes: a source address;

[0020] When sending a broadcast message, the master device / slave device that sends the CAN message configures the device node ID that sends the CAN message at the source address.

[0021] Furthermore, before the master device / slave device receiving the CAN message parses the data segment of the CAN message, it also includes verifying the data segment;

[0022] The verification includes: comparing the sum of the data from the first byte to the last second byte of the data segment with the data of the last byte, if the two correspond, the verification succeeds, otherwise the verification fails, and the master device / slave device that receives the CAN message re-receives the CAN message.

[0023] Furthermore, the master device identifies whether the slave device is online through heartbeat detection;

[0024] The first CAN message sent by the slave device after accessing the CAN bus is a heartbeat broadcast message of a preset period.

[0025] A CAN communication system for an electric-assisted bicycle provided according to the present invention comprises: a master device, a slave device and a CAN bus;

[0026] The master device and the slave device are connected to the CAN bus;

[0027] The master device / slave device sending the message generates the contents of the ID segment, ID extension segment and data segment of the CAN extended frame according to the type of CAN message to be sent;

[0028] The ID segment and the ID extension segment include a protocol data unit format and a protocol data unit specific field;

[0029] When the type of the CAN message is a broadcast message, a message number is configured in the protocol data unit format in the second protocol data unit format, a message number extension content is configured in the protocol data unit specific field, and device information of a sending device is configured in the data segment;

[0030] When the type of the CAN message is a directional message, the message number is configured in the protocol data unit format in the first protocol data unit format, the device node ID for receiving the message is configured in the protocol data unit specific field, and the instruction information is configured in the data segment.

[0031] Furthermore, the ID segment also includes: a priority and a reserved bit;

[0032] The master device / slave device that sends the CAN message configures the priority of the CAN message to be sent in the priority level according to a preset rule;

[0033] The master device / slave device receiving the CAN message sorts and analyzes the received CAN message according to the priority;

[0034] The reserved bit is reserved for configuration by the manufacturer of the slave device.

[0035] Furthermore, the ID extension segment also includes: a source address;

[0036] When sending a broadcast message, the master device / slave device that sends the CAN message configures the device node ID that sends the CAN message at the source address.

[0037] Furthermore, before the master device / slave device receiving the CAN message parses the data segment of the CAN message, it also includes verifying the data segment;

[0038] The verification includes: comparing the sum of the data from the first byte to the last second byte of the data segment with the data of the last byte, if the two correspond, the verification succeeds, otherwise the verification fails, and the master device / slave device that receives the CAN message re-receives the CAN message.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] The present invention can automatically identify and configure bus devices, so even if the devices are from different manufacturers and different models, as long as they follow the design scheme of the present invention, these devices can run smoothly in the electric-assisted bicycle system. The CAN communication method improves the compatibility and scalability of the electric-assisted bicycle system to a certain extent, and increases the flexibility of the configuration of the electric-assisted bicycle system. At the same time, a data verification function is added during data transmission, so that the security of data transmission is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0042] Figure 1 It is a work flow chart of the present invention;

[0043] Figure 2 It is a schematic diagram of the CAN communication network structure of the present invention;

[0044] Figure 3 It is a data frame schematic diagram of the CAN message of the present invention. DETAILED DESCRIPTION

[0045] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0046] The CAN communication method for an electric-assisted bicycle of the present invention generates a frame structure of a CAN message through a frame structure generation step. Specifically, the master device / slave device sending the message generates the contents of the ID segment, ID extension segment and data segment of the CAN extended frame according to the type of CAN message to be sent. The ID segment and ID extension segment include a protocol data unit format and a protocol data unit specific field.

[0047] When the type of the CAN message is a broadcast message, the message number is configured in the second protocol data unit format in the protocol data unit format, the message number extension content is configured in the protocol data unit specific field, and the device information of the sending device is configured in the data segment. When the type of the CAN message is a directional message, the message number is configured in the first protocol data unit format in the protocol data unit format, the device node ID of the receiving message is configured in the protocol data unit specific field, and the instruction information is configured in the data segment. In this way, the master device can automatically identify and configure the bus device.

[0048] Example 1

[0049] The electric bicycle system contains instruments, motor controllers, batteries, ABS and other devices. Each device node is connected to the CAN bus through the CAN_H and CAN_L ports, and the device nodes on the CAN bus can be increased or decreased as needed. Each device node has a device ID defined by the communication protocol standard. This ID is fixed and unique in the electric bicycle system. The same type of devices from different manufacturers and different models have the same ID when configured according to the CAN communication protocol standard. Special devices can have their node IDs defined separately. If there are any other devices in the future, Figure 2 To connect new devices other than CAN to the electric bicycle system, you only need to add a new device node ID in the CAN communication protocol standard. The specific process is as follows: Figure 1 As shown, the present invention provides a CAN communication method for an electric power-assisted bicycle, comprising:

[0050] Heartbeat broadcast: After the slave device is connected to the CAN bus of the electric-assisted bicycle, the first CAN message is broadcast to the CAN bus.

[0051] Parsing heartbeat message: The master device identifies whether the slave device is online through heartbeat detection, and after obtaining the first CAN message, parses the first CAN message to obtain the corresponding slave device information. The first CAN message can be a heartbeat broadcast message with a preset period.

[0052] Send configuration instructions: The master device sends the corresponding second CAN message to the slave device according to the slave device information.

[0053] Parsing configuration instructions: The slave device parses the second CAN message, obtains instruction information, and executes the instruction information.

[0054] like Figure 3 As shown, the first CAN message and the second CAN message use a CAN extended frame, and the CAN extended frame includes: an ID segment, an ID extended segment, and a data segment, etc. The ID segment and the ID extended segment include a protocol data unit format, a protocol data unit specific field, and a source address.

[0055] Priority: refers to the priority of the frame message, with a length of 3 bits and a value range of 0-7. The smaller the value, the higher the priority. The master device / slave device that receives the message sorts and parses the received message according to the priority.

[0056] Reserved bit: This bit is reserved and has no definition. It is 2 bits long and has a default value of 0. It can be configured by the device manufacturer.

[0057] Protocol data unit format: refers to the protocol data unit format type and also indicates the message number. The length is 8 bits, of which 6 bits are located in the ID segment and 2 bits are located in the ID extension segment. The data range is 0-255. When the data is 0-239, it indicates that the first protocol data unit format is selected. When the data is 240-255, it indicates that the second protocol data unit format is selected.

[0058] Protocol data unit specific field: refers to the bits specially defined according to different protocol data unit formats. Specifically, according to different protocol data unit formats, there are two different definitions of the protocol data unit specific field, with a length of 8 bits. When the frame message corresponds to the first protocol data unit format, the protocol data unit specific field is defined as the destination address, which refers to the device node ID that receives the message, that is, the data destination of the current message. When the frame message corresponds to the second protocol data unit format, the protocol data unit specific field is defined as the message number extension, and its data range is 0-255.

[0059] Source address: refers to the device node ID that sends the message, that is, the data source of the current message, with a length of 8 bits.

[0060] Message number: refers to the number of different CAN messages, including the above-mentioned reserved bits, protocol data unit format and protocol data unit specific field, where the reserved bits default to 0. When the frame message is a data frame with a specific destination address, its format is the first protocol data unit format, that is, there are 240 different message numbers, ranging from 0 to 239; when the data frame is a broadcast data frame, its format is the second protocol data unit format, protocol data unit format (240-255) * protocol data unit specific field (0-255) is 16 * 256 = 4096 different message numbers, ranging from 61440 to 65535. Regardless of which protocol data unit format is used, when the message number reaches the maximum number, the next message number with the same source address starts from the starting number.

[0061] When sending a broadcast message, the master device / slave device that sends the message selects to use the second protocol data unit format to configure the message number in the first protocol data unit format and the second protocol data unit format, and configures the message number extension content in the protocol data unit specific field. When sending a directed message, the master device / slave device that sends the message selects to use the first protocol data unit format to configure the message number, and configures the device node ID of the receiving message in the protocol data unit specific field. The master device / slave device that receives the message parses the data segment of the message to obtain the slave device information / command information.

[0062] In order to improve the security and integrity of message transmission, the master device / slave device receiving the message also verifies the data segment before parsing it. Figure 3 As shown in the figure, the data segment has 8 bytes or 64 bits. The last byte of data is the security check code, which is the sum of the first 7 bytes of data and the lower 8 bits. If the two are the same, the check is successful. When a device node receives a CAN message from another device node, it will first check the data segment to determine the integrity and correctness of the data to ensure the security of data transmission. If the check fails, the data is wrong and the device node needs to receive the data again.

[0063] Assuming that the original electric-assisted bicycle system has a master device motor controller but no slave device ABS device, the ABS device is connected to the system, and the communication protocol used by the ABS device and the electric-assisted bicycle system is the CAN communication protocol standard provided by the invention, then the specific implementation steps of the electric-assisted bicycle system to identify and match the ABS device are as follows:

[0064] The ABS device is connected to the CAN bus in the electric bicycle system through its communication ports CAN_H and CAN_L. The ABS device sends heartbeat broadcast data to the CAN bus 1-2 seconds after power-on, and sends it once every 100ms. Assuming that the CAN communication protocol standard defines that the node ID of all ABS type devices is 0x20, the priority of the heartbeat broadcast data is 6, this is the first broadcast data, the message number is 61440, and its data frame ID structure is shown in the following table, then the data frame ID is 0x18F00120.

[0065]

[0066] In addition, the 8-byte data segment of the frame message defines information such as the manufacturer, model and function of this ABS device. The first byte is the manufacturer code, the second byte is the device model code, and the third byte is the device function code. If this device is ABS, the function code can correspond to functions such as single-channel front wheel, single-channel rear wheel, and front and rear wheel dual channels. The fourth to seventh bytes are the heartbeat count, and the eighth byte is the safety check code.

[0067] Assume that the manufacturer code of the ABS device is 0xA1, the model code is 0x06, the function is front and rear wheel dual channel, the corresponding function code is 0x11, this frame data is the first heartbeat broadcast, and its data segment structure is shown in the following table, then the data segment is represented as 0xA10611000001B9.

[0068]

[0069] If the master device motor controller monitors the message from the CAN bus, the device node ID code 0x20 in the data frame ID shows that the newly added online device type is an ABS device. After receiving this frame message, the master device first performs a security check on the data segment. The cumulative sum of the first 7 bytes of data is 0xB9, and the lower 8 bits are still 0xB9, which is equal to the value of the 8th byte security check code, and the check is successful. Subsequently, the master device parses the message data segment and identifies the manufacturer, model, function and other information of this ABS device. Based on this information, the master device can send a work instruction signal adapted to its function to the newly added ABS device through a specific destination address data frame in the subsequent working state, so that it enters the working state.

[0070] Example 2

[0071] like Figure 2 The present invention provides a CAN communication system for an electric-assisted bicycle, comprising: a master device, a slave device and a CAN bus.

[0072] The master device and the slave device are connected to the CAN bus; after the slave device is connected to the CAN bus of the electric-assisted bicycle, it broadcasts a first CAN message to the CAN bus; the master device parses the first CAN message to obtain corresponding slave device information; the master device sends a corresponding second CAN message to the slave device according to the slave device information; the slave device parses the second CAN message to obtain instruction information and executes the instruction information.

[0073] like Figure 3 As shown, the first CAN message and the second CAN message use a CAN extended frame, and the CAN extended frame includes: an ID segment, an ID extended segment, and a data segment, etc. The ID segment and the ID extended segment include a protocol data unit format, a protocol data unit specific field, and a source address.

[0074] Priority: refers to the priority of the frame message, with a length of 3 bits and a value range of 0-7. The smaller the value, the higher the priority. The master device / slave device that receives the message sorts and parses the received message according to the priority.

[0075] Reserved bit: This bit is reserved and has no definition. It is 2 bits long and has a default value of 0. It can be configured by the device manufacturer.

[0076] Protocol data unit format: refers to the protocol data unit format type and also indicates the message number. The length is 8 bits, of which 6 bits are located in the ID segment and 2 bits are located in the ID extension segment. The data range is 0-255. When the data is 0-239, it indicates that the first protocol data unit format is selected. When the data is 240-255, it indicates that the second protocol data unit format is selected.

[0077] Protocol data unit specific field: refers to the bits specially defined according to different protocol data unit formats. Specifically, according to different protocol data unit formats, there are two different definitions of the protocol data unit specific field, with a length of 8 bits. When the frame message corresponds to the first protocol data unit format, the protocol data unit specific field is defined as the destination address, which refers to the device node ID that receives the message, that is, the data destination of the current message. When the frame message corresponds to the second protocol data unit format, the protocol data unit specific field is defined as the message number extension, and its data range is 0-255.

[0078] Source address: refers to the device node ID that sends the message, that is, the data source of the current message, with a length of 8 bits.

[0079] Message number: refers to the number of different CAN messages, including the above-mentioned reserved bits, protocol data unit format and protocol data unit specific field, where the reserved bits default to 0. When the frame message is a data frame with a specific destination address, its format is the first protocol data unit format, that is, there are 240 different message numbers, ranging from 0 to 239; when the data frame is a broadcast data frame, its format is the second protocol data unit format, protocol data unit format (240-255) * protocol data unit specific field (0-255) is 16 * 256 = 4096 different message numbers, ranging from 61440 to 65535. Regardless of which protocol data unit format is used, when the message number reaches the maximum number, the next message number with the same source address starts from the starting number.

[0080] When sending a broadcast message, the master device / slave device that sends the message selects to use the second protocol data unit format to configure the message number in the first protocol data unit format and the second protocol data unit format, and configures the message number extension content in the protocol data unit specific field. When sending a directed message, the master device / slave device that sends the message selects to use the first protocol data unit format to configure the message number, and configures the device node ID of the receiving message in the protocol data unit specific field. The master device / slave device that receives the message parses the data segment of the message to obtain the slave device information / command information.

[0081] In order to improve the security and integrity of message transmission, the master device / slave device receiving the message also verifies the data segment before parsing it. Figure 3 As shown in the figure, the data segment has 8 bytes or 64 bits. The last byte of data is the security check code, which is the sum of the first 7 bytes of data and the lower 8 bits. If the two are the same, the check is successful. When a device node receives a CAN message from another device node, it will first check the data segment to determine the integrity and correctness of the data to ensure the security of data transmission. If the check fails, the data is wrong and the device node needs to receive the data again.

[0082] Assuming that the original electric-assisted bicycle system has a master device motor controller but no slave device ABS device, the ABS device is connected to the system, and the communication protocol used by the ABS device and the electric-assisted bicycle system is the CAN communication protocol standard provided by the invention, then the specific implementation steps of the electric-assisted bicycle system to identify and match the ABS device are as follows:

[0083] The ABS device is connected to the CAN bus in the electric bicycle system through its communication ports CAN_H and CAN_L. The ABS device sends heartbeat broadcast data to the CAN bus 1-2 seconds after power-on, and sends it once every 100ms. Assuming that the CAN communication protocol standard defines that the node ID of all ABS type devices is 0x20, the priority of the heartbeat broadcast data is 6, this is the first broadcast data, the message number is 61440, and its data frame ID structure is shown in the following table, then the data frame ID is 0x18F00120.

[0084]

[0085] In addition, the 8-byte data segment of the frame message defines information such as the manufacturer, model and function of this ABS device. The first byte is the manufacturer code, the second byte is the device model code, and the third byte is the device function code. If this device is ABS, the function code can correspond to functions such as single-channel front wheel, single-channel rear wheel, and front and rear wheel dual channels. The fourth to seventh bytes are the heartbeat count, and the eighth byte is the safety check code.

[0086] Assume that the manufacturer code of the ABS device is 0xA1, the model code is 0x06, the function is front and rear wheel dual channel, the corresponding function code is 0x11, this frame data is the first heartbeat broadcast, and its data segment structure is shown in the following table, then the data segment is represented as 0xA10611000001B9.

[0087]

[0088] If the master device motor controller monitors the message from the CAN bus, the device node ID code 0x20 in the data frame ID shows that the newly added online device type is an ABS device. After receiving this frame message, the master device first performs a security check on the data segment. The cumulative sum of the first 7 bytes of data is 0xB9, and the lower 8 bits are still 0xB9, which is equal to the value of the 8th byte security check code, and the check is successful. Subsequently, the master device parses the message data segment and identifies the manufacturer, model, function and other information of this ABS device. Based on this information, the master device can send a work instruction signal adapted to its function to the newly added ABS device through a specific destination address data frame in the subsequent working state, so that it enters the working state.

[0089] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0090] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A CAN communication method for an electric power-assisted bicycle, characterized in that: include: Frame structure generation steps: The master device / slave device sending the message generates the contents of the ID segment, ID extension segment and data segment of the CAN extended frame according to the type of CAN message to be sent; The ID segment and the ID extension segment include a protocol data unit format and a protocol data unit specific field; When the type of the CAN message is a broadcast message, a message number is configured in the protocol data unit format in the second protocol data unit format, a message number extension content is configured in the protocol data unit specific field, and device information of a sending device is configured in the data segment; When the type of the CAN message is a directional message, the message number is configured in the protocol data unit format in the first protocol data unit format, the device node ID for receiving the message is configured in the protocol data unit specific field, and the instruction information is configured in the data segment.

2. The CAN communication method for an electric-assisted bicycle according to claim 1, characterized in that: include: Heartbeat broadcast: after the slave device is connected to the CAN bus of the electric-assisted bicycle, the frame structure generation step is adopted to broadcast and send the first CAN message to the CAN bus; Parsing the heartbeat message: the master device parses the first CAN message to obtain the device information of the slave device; Sending a configuration instruction: the master device sends a second CAN message to the slave device in a directionally manner according to the device information of the slave device using the frame structure generation step; Parsing configuration instructions: the slave device parses the second CAN message to obtain instruction information, and executes the instruction information.

3. The CAN communication method for an electric-assisted bicycle according to claim 1, characterized in that: The ID segment also includes: priority and reserved bits; The master device / slave device that sends the CAN message configures the priority of the CAN message to be sent in the priority level according to a preset rule; The master device / slave device receiving the CAN message sorts and analyzes the received CAN message according to the priority; The reserved bit is reserved for configuration by the manufacturer of the slave device.

4. The CAN communication method for an electric-assisted bicycle according to claim 1, characterized in that: The ID extension segment also includes: a source address; When sending a broadcast message, the master device / slave device that sends the CAN message configures the device node ID that sends the CAN message at the source address.

5. The CAN communication method for an electric-assisted bicycle according to claim 1, characterized in that: Before the master device / slave device receiving the CAN message parses the data segment of the CAN message, the data segment is also verified; The verification includes: comparing the sum of the data from the first byte to the last second byte of the data segment with the data of the last byte, if the two correspond, the verification succeeds, otherwise the verification fails, and the master device / slave device that receives the CAN message re-receives the CAN message.

6. The CAN communication method for an electric-assisted bicycle according to claim 2, characterized in that: The master device uses heartbeat detection to identify whether the slave device is online; The first CAN message sent by the slave device after accessing the CAN bus is a heartbeat broadcast message of a preset period.

7. A CAN communication system for an electric power-assisted bicycle, characterized in that: include: Master device, slave device and CAN bus; The master device and the slave device are connected to the CAN bus; The master device / slave device sending the message generates the contents of the ID segment, ID extension segment and data segment of the CAN extended frame according to the type of CAN message to be sent; The ID segment and the ID extension segment include a protocol data unit format and a protocol data unit specific field; When the type of the CAN message is a broadcast message, a message number is configured in the protocol data unit format in the second protocol data unit format, a message number extension content is configured in the protocol data unit specific field, and device information of a sending device is configured in the data segment; When the type of the CAN message is a directional message, the message number is configured in the protocol data unit format in the first protocol data unit format, the device node ID for receiving the message is configured in the protocol data unit specific field, and the instruction information is configured in the data segment.

8. The CAN communication system for an electric-assisted bicycle according to claim 7, characterized in that: The ID segment also includes: priority and reserved bits; The master device / slave device that sends the CAN message configures the priority of the CAN message to be sent in the priority level according to a preset rule; The master device / slave device receiving the CAN message sorts and analyzes the received CAN message according to the priority; The reserved bit is reserved for configuration by the manufacturer of the slave device.

9. The CAN communication system for an electric-assisted bicycle according to claim 7, characterized in that: The ID extension segment also includes: a source address; When sending a broadcast message, the master device / slave device that sends the CAN message configures the device node ID that sends the CAN message at the source address.

10. The CAN communication system for an electric-assisted bicycle according to claim 7, characterized in that: Before the master device / slave device receiving the CAN message parses the data segment of the CAN message, the data segment is also verified; The verification includes: comparing the sum of the data from the first byte to the last second byte of the data segment with the data of the last byte, if the two correspond, the verification succeeds, otherwise the verification fails, and the master device / slave device that receives the CAN message re-receives the CAN message.

Citation Information

Patent Citations

  • Intelligent charging system of energy-saving battery car

    CN112467847A

  • CAN bus communication method based on CAN2.0B

    CN108199941A

  • Networking method and device of equipment and data transmission system

    CN113395198A

  • Application layer protocol implementation method based on CAN2.0B protocol

    CN113765938A

  • Data interaction method, device and system of electric power-assisted bicycle and storage medium

    CN115022418A