First of all, before starting the example demonstration, we need to understand the rules of ECAN-401 device custom protocol forwarding: since the CAN frame format is based on messages, the serial frame format is based on byte transmission. It must be a complete serial frame format that complies with the user-defined protocol. It must include all the content of the serial frame in the mode configured by the user. If the content of other bytes except the data field is incorrect, the frame will not be sent successfully.The content contained in the serial frame: frame header, frame length, frame information, frame ID, data field, and frame end.Note: The user-configured frame ID and frame type are invalid when forwarding the user-defined protocol, and the data will be forwarded according to the format in the serial frame.Therefore, in order to facilitate the use of CAN-Bus by users, the serial frame format is closer to the CAN frame format, and the start and end of a frame are specified in the serial frame, that is, the "frame header" and "frame end" in the AT command. , the user can configure it by himself.The frame length refers to the length from the beginning of the frame information to the end of the last data, excluding the serial frame end.The frame information is divided into extended frames and standard frames. The standard frame is fixed as 0x00, and the extended frame is fixed as 0x80. In the custom protocol conversion, no matter what the length of the data contained in the data field of each frame, the content of the frame information is fixed. Change. \u0421\u0435\u0440\u0432\u0435\u0440 \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0440\u0442\u043e\u043cWhen the frame type is a standard frame (0x00), the last two bytes of the frame type represent the frame ID, with the high order first; when the frame information is an extended frame (0x80), the last four bytes of the frame type represent the frame ID, were High in the front.Note: In the custom protocol conversion, regardless of the length of the data contained in the data field of each frame, the content of the frame information is fixed. Fixed to standard frame (0x00) or extended frame (0x80). The frame ID needs to conform to the ID range, otherwise, the ID may be wrong.When a CAN bus message receives a frame, it forwards a frame. The module converts the data in the data field of the CAN message in turn, and adds frame header, frame length, frame information, and other data to the serial frame, which is actually a serial frame. The reverse form of the CAN message.