第 31 页 共 60 页
Figure 3.23 Example of serial frame to CAN frame
2. CAN frame to UART frame conversion (CAN
→
UART )
For CAN frames, it is also to forward a frame to the UART interface immediately after receiving a frame.
When forwarding each time, the ID in the received CAN frame is correspondingly converted according to
the position and length of the CAN frame ID configured by the user in the UART frame, and other data are
forwarded in sequence. In this mode, the frame information of CAN frame is converted to the first byte of
UART frame by default. As shown in Figure 3.24.
The information is represented by one byte, in which 7~4 bits represent the frame type, 0000 represents
the standard frame and 1000 represents the extended frame. 3~0 bits represent "data length", and
"0000~1000" respectively represent "0~8" bits of data.
For example, the frame information is 0x05, which means that the CAN frame type is a standard frame,
and the data length of the CAN frame is 5 bytes. The frame information is 0x86, which means that the CAN
frame type is extended frame, and the data length of CAN frame is 6 bytes.