第 39 页 共 60 页
3. CAN frame to SPI frame conversion( CAN
→
SPI )
TD5(3)USPCAN, as an SPI slave, can't actively control SPI peripherals. When the product receives a frame
of data from the CAN bus, it can only be stored in the CAN receiving buffer immediately. When the number
of CAN frames in the CAN buffer reaches the feedback trigger frame number or trigger time, the INT pin
outputs a low level to inform the SPI master to read the data. After the SPI master acquires the size of the CAN
buffer from TD5(3)USPCAN, SPI CAN read out all the CAN frame data contained in the CAN buffer by one
frame. In the custom conversion mode, the CAN receiving buffer stores a collection of bytes in multiple valid
formats. When the CAN terminal receives a CAN data frame, it converts it into a byte segment conforming to
the user-defined format and places it in the buffer.
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 converted data format is shown in Figure 3.33.
Figure 3.33 CAN frame to SPI frame (custom protocol conversion)