SLAAEN5 February   2025 MSPM0G1106 , MSPM0G1107 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3518 , MSPM0G3518-Q1 , MSPM0G3519 , MSPM0G3519-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 Bridge between CAN and SPI
  5. 2Implementation
    1. 2.1 Principle
    2. 2.2 Structure
  6. 3Software Description
    1. 3.1 Software Functionality
    2. 3.2 Configurable Parameters
    3. 3.3 Structure of Custom Element
    4. 3.4 Structure of FIFO
    5. 3.5 SPI Receive and Transmit (Transparent Transmission)
    6. 3.6 SPI Receive and Transmit (Protocol Transmission)
    7. 3.7 CAN Receive and Transmit
    8. 3.8 Application Integration
  7. 4Hardware
  8. 5Application Aspects
    1. 5.1 Flexible structure
    2. 5.2 Optional Configuration for SPI
    3. 5.3 Optional Configuration for CAN
    4. 5.4 CAN Bus Multinode Communication Example
  9. 6Summary
  10. 7References

Bridge between CAN and SPI

The CAN-SPI bridge connects the CAN and SPI interfaces. The bridge supports the SPI to function in either slave mode or master mode. The example in this document uses the CAN analyzer to observe the CAN data. Users can also send messages from the CAN analyzer over the CAN-SPI bridge to the SPI side. For SPI data, users can use a logic analyzer or use two LaunchPADs to form a loop to observe, such as the accompanying demo in Figure 4-1.

The example in this article support both transparent transmission and protocol transmission. Figure 1-1 shows the logic analyzer observation for transparent transmission. Figure 1-2 shows the logic analyzer observation for protocol transmission.

For protocol transmission, this example specifies the SPI message format. Users can modify the format according to application requirements. When receiving the message from the SPI, the message format is < 55 AA ID1 ID2 ID3 ID4 Length Data1 Data2 ...> Users can send data through SPI with the same format. 55 AA is the header. The ID area is four bytes. The length area is one byte, which indicates the data length.

For transparent transmission, a configurable timeout is used for the SPI slave to detect one message. Data from the SPI is filled into the data area of the CAN (same in reverse). The CAN ID is the default value.

 Logic Analyzer for SPI
                    Transparent Transmission Figure 1-1 Logic Analyzer for SPI Transparent Transmission
 Logic Analyzer for SPI
                    Protocol Transmission Figure 1-2 Logic Analyzer for SPI Protocol Transmission