MCAN TX Only

This example shows how to perform only TX over CAN in CAN-FD mode.

Hardware Setup

  • MCAN TX: PA12, MCAN RX: PA11 (MCAN0)

  • UART TX: PA0, UART RX: PA1 (UC4 - on-board UART-USB converter)

  • Terminal settings: 115200 baud, 8N1

Example Usage

Board Setup

  • On AM13E230x LP board, set S6 and S4 switches towards the dot. This will route the CAN RX and TX lines towards CAN Transceiver IC (TCAN3414D).

  • Make sure to close the JP5 jumper. This will enable 120 Ohms termination resistance.

  • TCAN3414D also has an STB pins which needs to be set low. This STB pin is connected to pin PA24 of the MCU. Configure PA24 in the syscfg and in code, clear the pin so that IC is enabled.

Host Computer Setup

  • Connect external CAN logging tool.

  • Configure the external CAN logging tool for CAN-FD mode, Nominal Bit rate of 250kbps and data bit rate of 1mbps.

  • Open serial terminal and connect to the XDS110 user UART with config of 115200 8N1. serial terminal config

  • On serial terminal, status of application is seen.

NOTES

  1. Default MCAN pins selected from the syscfg is PA24 and PA25. Do not use these pins. Use PA11 and PA12 pins.

  2. On every successful packet sent the following is seen:

    [OK] TX #7016: ID=0x003
    [OK] TX #7017: ID=0x003
    [OK] TX #7018: ID=0x003
    [OK] TX #7019: ID=0x003

However, if there is an error, application logs error message, for example:

    [ERROR] PROTOCOL ERROR DURING DATA PHASE

    ============ MCAN Protocol Status ============
    LEC (Last Error Code)    : 0 (No Error)
    ACT (Activity)           : 1 (Idle)
    EP  (Error Passive)      : 0 (Error_Active)
    EW  (Warning Status)     : 0 (Below warning limit)
    BO  (Bus_Off Status)     : 0 (Not Bus_Off)
    DLEC (Data Phase LEC)    : 3
    RESI (RX ESI flag)       : 0 (ESI not set)
    RBRS (RX BRS flag)       : 0 (BRS not set)
    RFDF (RX FD Format)      : 0 (No CAN FD received)
    PXE  (Protocol Exception): 0 (No exception)
    TDCV (TX Delay Comp)     : 17

    ============ MCAN Error Counters =============
    TEC (TX Error Counter)   : 8
    REC (RX Error Counter)   : 0
    RP  (RX Error Passive)   : 0 (REC < 128)
    CEL (CAN Error Logging)  : 1
    ==============================================