第 25 页 共 60 页
Figure 3.17 CAN frame to SPI frame (transparent conversion)
(1) Frame information conversion enable
Frame information refers to the "frame type" and "data length" information of CAN frame, with the length
of one byte.
When frame conversion is enabled, the data in CAN receiving buffer is a collection of frame information
and frame data. When the CAN terminal receives a CAN data frame, the product puts the frame
information and frame data into the buffer at the same time. Frame information bytes and frame data bytes
form a "byte segment". Each byte segment includes information and data of an independent CAN frame, in
which frame information is the first byte of the byte segment, followed by data. After acquiring the size of the
CAN receiving buffer, the master can read out the N byte segments stored in the buffer by one SPI frame at a
time. 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.
If the user enables frame information conversion, the converted data mode is shown in Figure 3.18.