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

Structure of Custom Element

Custom_Element is the structure defined in user_define.h. Custom_Element is also shown in Figure 2-5.

Origin Identifier indicates the origin of the message. The following are the examples(CAN_ID_LENGTH =0,UART_ID_LENGTH =4).

  • Example 1 - CAN interface receive and transmit
    • When CAN-UART bridge receives a CAN message, the ID from the CAN frame is the Origin Identifier, which indicates where the message came from.
    • When CAN-UART bridge transmits a CAN message, Origin Identifier will be ignored(CAN_ID_LENGTH is set to 0 default).
  • Example 2 - UART interface receive and transmit (UART protocol transmission)
    • When CAN-UART bridge receives the UART message(UART protocol transmission), DEFAULT_UART_ORIGIN_ID is the Origin Identifier since the UART does not have an ID.
    • When CAN-UART bridge transmits the UART message(UART protocol transmission), Origin Identifier will be 4-byte ID in UART data(UART_ID_LENGTH is set to 4 default), indicating where the message came from.
  • Example 3 - UART interface receive and transmit (UART transparent transmission)
    • When the CAN-UART bridge receives the UART message (UART transparent transmission), DEFAULT_UART_ORIGIN_ID is the Origin Identifier since the UART does not have an ID.
    • When the CAN-UART bridge transmits the UART message (UART transparent transmission), Origin Identifier will be ignored (Transparent transmission does not have an ID area).

Destination Identifier indicates the destination of the message. The following are the examples(CAN_ID_LENGTH =0,UART_ID_LENGTH =4).

  • Example 1 - CAN interface receive and transmit
    • When the CAN-UART bridge receives a CAN message, the DEFAULT_CAN_DESTINATION_ID is the Destination Identifier since the CAN_ID_LENGTH is set to 0 by default. UART transmit does not require an ID.
    • When the CAN-UART bridge transmits a CAN message, Destination Identifier will be CAN ID in CAN frame. In this example, 11 bit or 29 bit are both supported.
  • Example 2 - UART interface receive and transmit (UART protocol transmission)
    • When the CAN-UART bridge receives a UART message (UART protocol transmission), the 4-byte ID from UART data is the Destination Identifier (UART_ID_LENGTH is set to 4 default). The CAN transmit requires ID information.
    • When the CAN-UART bridge transmits a UART message (UART protocol transmission), Destination Identifier will be ignored since UART transmit does not require an ID.
  • Example 3 - UART interface receive and transmit (UART transparent transmission)
    • When CAN-UART bridge receives UART message (UART transparent transmission), DEFAULT_UART_DESTINATION_ID is the Destination Identifier. (Transparent transmission does not have an ID area). CAN transmit requires ID information.
    • When the CAN-UART bridge transmits a UART message (UART transparent transmission), Destination Identifier will be ignored since UART transmit does not require an ID.
/*user-defined information storage structure */
typedef struct {
    /*! Origin Identifier, indicating the origin of the message */
    uint32_t origin_id;
    /*! Destination Identifier, indicating the destination of the message */
    uint32_t destination_id;
    /*! Data Length Code */
    uint8_t dlc;
    /*! Data bytes */
    uint8_t data[TRANSMIT_DATA_LENGTH];
} Custom_Element;