MCAN RX Only
This example shows how to receive Standard CAN frame format and CAN FD frame format.
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.
On AM13E230x SOM, there are multiple different boards that are required to make this example:
AM13E230x-SOM board
HSEC180ADAPEVM board
TMDSHSECDOCK board
XDS110 External debugger (or any debugger)
TCAN1043DEVM CAN Transceiver.
Notes on TCAN1043DEVM CAN Transceiver configuration
There are 3 different supplies that are required to be provided:
Supply Name |
Voltage to provide |
|---|---|
VIO |
3.3V |
VCC |
5.0V |
VSUP |
5.0V |
Make sure that the following signals have the required voltages:
Pin Label |
Location |
expected voltage |
|---|---|---|
EN |
JMP2 Pin 8 |
~VIO |
nSTB |
JMP2 Pin 1 |
~VIO |
INH |
JMP2 Pin 1 |
>= VIO |
Host Computer Setup
NOTES
Default MCAN pins selected from the syscfg is PA24 and PA25. Do not use these pins. Use PA11 and PA12 pins.
This app only accepts CAN ID of 0x04 and 0x05.
On every successful packet received the following is seen:
CAN RX started
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 0 XTD = 0 Data Size = 0 Bytes Standard Frame Format
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 100008 XTD = 0 Data Size = 8 Bytes Standard Frame Format
01 02 03 34 04 05 06 07
==== MCAN RX FIFO FRAME ====
ID = 14000a XTD = 0 Data Size = 8 Bytes CAN FD Frame Format
01 00 00 00 00 00 00 00
PASS
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
==============================================
