SLAAEN4 March   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 UART
  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 UART Receive and Transmit (Transparent Transmission)
    6. 3.6 UART 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 CAN
    3. 5.3 CAN Bus Multi-Node Communication Example
  9. 6Summary
  10. 7References

Application Integration

Functions in Table 3-2 are categorized into different files. Functions for UART receive and transmit are included in bridge_uart.c and bridge_uart.h. Functions for CAN receive and transmit are included in bridge_can.c and bridge_can.h. The structure of the FIFO element is defined in user_define.h.

Users can easily separate functions by file. For example, if only UART functions are required, users can reserve bridge_uart.c and bridge_uart.h to call the functions.

For the basic configuration of peripherals, this project integrates the SysConfig configuration file. Users can easily modify the basic configuration of peripherals by using SysConfig.

Applications requiring this functionality must include the CAN module API and UART module API. All API files are included with the SDK download.

 Files Required by the
                    Software Figure 3-1 Files Required by the Software

Table 3-3 lists the footprint of the CAN-UART bridge design in terms of flash size and RAM size. Figure 3-1 and Table 3-3 were made using Code Composer Studio (Version: 12.7.1.00001) with optimization level 2.

The user can adjust the size of the FIFO. A larger FIFO means more cache capacity, but also takes up more RAM space. For details, see the relevant content in Section 5. In addition, the size of the data field in this code is set to a maximum of 64 bytes by default. The user can configure the data field size according to the actual data length. Using an 12 byte data field can significantly reduce RAM usage, as listed in Table 3-3

Table 3-3 Memory Footprint of the CAN-UART Bridge
Minimum Required Code Size (bytes) Flash SRAM
CAN-UART bridge
(Protocol Transmission)
U2C_FIFO_SIZE=8
C2U_FIFO_SIZE = 8
Data size = 12 bytes)
6328 910
CAN-UART bridge
(Protocol Transmission)
U2C_FIFO_SIZE=8
C2U_FIFO_SIZE=8
Data size = 64 bytes)
6416 2054
CAN-UART bridge
(Protocol Transmission
U2C_FIFO_SIZE=30
C2U_FIFO_SIZE=30
Data size = 12 bytes)
6432 1966