logo资料库

USB(串口)CAN转换的定义&&串口CAN协议二次开发文档(文件:USB_(Serial_port)_to_CAN_protocol_defines).pdf

第1页 / 共9页
第2页 / 共9页
第3页 / 共9页
第4页 / 共9页
第5页 / 共9页
第6页 / 共9页
第7页 / 共9页
第8页 / 共9页
资料共9页,剩余部分请下载后查看
The definition of the serial (USB) conversion CAN protocol The serial port baud rate default is 2000000, 8 bit data bit, 1 bit stop bit, no check. Two communication protocols are supported within the converter, one is a fixed 20 byte communication protocol, and the other is a variable length communication protocol. 1. Variable length communication format When the software is not selected ,
(for example, the red line is checked in the box above), click setup and start button. The internal communication of the converter is a variable length communication protocol. The specific protocol is as follows: Definition Packet header 0xaa Tyep 0xc0 Tyep bit5(frame type 0- standard frame (frame ID 2 bytes), 1-extended frame (frame ID 4 bytes)) bit4(frame format 0- data frame, 1 remote frame) Bit0~3 Frame data length (0~8) 1~8 bit (BYTE1) 1~8 bit (BYTE1) Frame ID Extended 9~16 bit (BYTE2) Standard frame 17~24 bit (BYTE3) Frame 9~11 bit (BYTE2) 25~29 bit (BYTE4) CAN sends or accepts data 1 Frame data CAN sends or accepts data 2 (frame data CAN sends or accepts data 3 may be 0~8 CAN sends or accepts data 4 data) CAN sends or accepts data 5 CAN sends or accepts data 6
CAN sends or accepts data 7 CAN sends or accepts data 8 End code 0x55 Sample description (standard frame): 1. For example, send the CAN standard frame ID to 0x123, and the corresponding data as 0x11 0x22 0x33 0x44 0x55 0x66 0x77 0x88 Then the serial port sends data format to AA C8 23 01 11 22 33 44 55 66 77 88 55 The following is an explanation AA Packet header C8 Bit5 is 0 standard frame, bit4 is 0, data frame bit0~3 is 8, data length is 8, sending 8 bytes 23 01 For the frame ID 0x123 11 22 33 44 55 66 77 88 Send frame data for CAN 55 End code For example, the serial port is received: AA C8 23 01 11 22 33 44 55 66 77 88 55
The received CAN is the standard frame, ID is 0x123, the corresponding data is 11 22 33 44 55 66 77 88, 8 bytes, and the resolution is the same as above 2. For example, send CAN standard frame ID to 0x103, and the corresponding data is 0x 11 0x22 Then the serial port sends data format to: AA C2 03 01 11 22 55 The following is an explanation: AA Packet header C2 bit5 is 0 standard frame, bit4 is 0, data frame bit0~3 is 2, data length is 2, sending 2 bytes 03 01 For the frame ID 0x103 11 22 Send frame data for CAN 55 End code For example, the virtual serial port is received: AA C2 03 01 11 22 55 The received CAN is the standard frame, ID is 0x0103, the corresponding data is 11 22, 2 bytes, and the resolution is the same as above Sample description (extended frame): 1. For example, the CAN extended frame ID is 0x1234567, and the corresponding data is 0X11,
0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 Then the serial port sends data format to: AA E8 67 45 23 01 11 22 33 44 55 66 77 88 55 The following is an explanation: AA Packet header E8 Bit5 is 1, extended frame bit4 is 0, data frame bit0~3 is 8, data length is 8, sending 8 bytes 67 45 23 01 For the frame ID 0x1234567 11 22 33 44 55 66 77 88 Send CAN frame data 55 End code For example, the serial port is received: AA E8 67 45 23 01 11 22 33 44 55 66 77 88 55 The accepted CAN is an extended frame, ID is 0x1234567, and the corresponding data is 11 22 3344 55 66 77 88, 8 bytes, parsed as above 2. For example, the CAN extended frame ID is 0x1033021, and the corresponding data is 0x 11 0x22: Then the serial port sends data format to: AA E2 21 30 03 01 11 22 55 The following is an explanation:
AA Packet header E2 Bit5 is 0, extended frame bit4 is 0, data frame bit0~3 is 2, data length is 2, sending 2 bytes 21 30 03 01 For the frame ID 0x1033021 11 22 Send CAN frame data 55 End code For example, the serial port is received AA E2 21 30 03 01 11 22 55 The accepted CAN is an extended frame, ID is 0x1033021, and the corresponding data is 11 22, 2 bytes, parsed as above
2. Fixed 20 byte transceiver protocol When the software is selected , (for example, the red line is checked in the box above), click setup and start button. The definition of the converter's internal communication is fixed 20 byte transceiver definition. The specific protocol is as follows. 0 1 2 3 4 5 6 7 8 9 Definition Packet header Packet header 0xaa 0x55 TYPE 0x01-Data Frame type Frame format Frame ID data 1 0x01-Standard frame, 0x02-Extended frame 0x01- Data frame,0x02-Remote frame 1~8 bit, high bytes at the front, low bytes at the back Frame ID data 2 9~16 bit, high bytes at the front, low bytes at the back Frame ID data 3 17~24 bit, high bytes at the front, low bytes at the back Frame ID data 4 25~32 bit, high bytes at the front, low bytes at the back Frame data length The data length of the CAN bus that is sent or accepted
CAN sends or accepts data 1 CAN sends or accepts data 2 CAN sends or accepts data 3 CAN sends or accepts data 4 CAN sends or accepts data 5 CAN sends or accepts data CAN sends or accepts data 7 CAN sends or accepts data 8 0x00 From frame type to error code, accumulating and low 8 bits (red part) Frame data 1 Frame data 2 Frame data 3 Frame data 4 Frame data 5 Frame data 6 Frame data 7 Frame data 8 Reserve Check code 10 11 12 13 14 15 16 17 18 19 For example, we accept or send the data standard frame ID to 0x123, and the data is 11 22 33 44 55 66 77 88 It is configured as follows 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Packet header Packet header TYPE Frame type Frame format Frame ID data 1 Frame ID data 2 Frame ID data 3 Frame ID data 4 Data 0xaa 0x55 0x01 0x01 0x01 0x23 0x01 0x00 0x00 Frame length data 0x08 Frame data 1 Frame data 2 Frame data 3 Frame data 4 Frame data 5 Frame data 6 Frame data 7 Frame data 8 11 22 33 44 55 66 77 88
分享到:
收藏