Other Parts Discussed in Thread: SYSCONFIG
How to test MCAN external loopback example on AM62x/AM62A using an external transceiver ?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How to test MCAN external loopback example on AM62x/AM62A using an external transceiver ?
The AM62 SKs support CAN-FD, but do not carry a CAN-FD transceiver to experiment with. Hence, to test the full functionality of CAN, we need to connect an external transceiver. MCU+ SDK contains internal loopback example, in this guide, we will modify it, to make it compatible to run MCAN on an external setup.
If you are looking to test MCAN on Linux, please refer here: https://software-dl.ti.com/processor-sdk-linux/esd/AM62AX/09_01_00/exports/docs/linux/How_to_Guides/Target/How_to_test_MCAN_on_AM62x.html#mcan-overview
Hardware setup:
To establish MCAN external loopback communication, the tested hardware setup includes a AM62A, connected to the TCAN, which is connected to a PCAN module, and the data can be viewed on PCAN view software.
AM62x/AM62A EVM to TCAN connections:
MCU_MCAN0_TX --> TXD JMP 2 on TCAN
MCU_MCAN0_RX --> RXD JMP 2 on TCAN
VCC (5 V) --> VCC JMP2 on TCAN
GND --> GND JMP2 on TCAN
TCAN to PCAN connections:
CANL on TCAN JMP7 -->CANL on PCAN
CANH on TCAN JMP7 -->CANH on PCAN
GND on TCAN JMP7 -->GND on PCAN
Note:
TCAN1042D EVM requires 5V supply(min. 4.5V) to operate properly. Hence for this experiment, 5V pin supply pin on User Expansion is enabled from Linux terminal using the below steps:
//To find out the GPIO chipset name # gpiodetect . . gpiochip3 [1-0022] (24 lines) //gpiochip3 has ID [1-0022] in which ‘1’ means I2C1 and ‘0022’ is I2C address //gpiochip3 is the GPIO chipset of the IO Expander. # gpioinfo gpiochip3 gpiochip3 - 24 lines: ... line 5: "EXP_PS_3V3_En" unused input active-high line 6: "EXP_PS_5V0_En" unused input active-high ... //EXP_PS_5V0_EN is line 6. To turn on the 5V pins, run the following command: # gpioset gpiochip3 6=1
MCAN bit timing configuration settings:
Bitrates and sampling point are calculated using the following formulae:
bit rate(bits per second) = (CAN clock in Hz) / BRP / (1 + TSEG1 + TSEG2)
Sampling Point(%) = (1 + TSEG1) / (1 + TSEG1 + TSEG2)
(Note: Values selected in Sysconfig / the values set in structure are directly programmed in MCAN register bit fields. The actual interpretation by the hardware of this value is such that one more than the value programmed.)
For example:
Default values used for NOM bit rate are
MCAN_BitTimingParams::nomRatePrescalar = 7 (BRP = 8)
MCAN_BitTimingParams::nomTimeSeg1 = 12 (TSEG1 = 13)
MCAN_BitTimingParams::nomTimeSeg2 = 5 (TSEG2 = 6)
bit rate = 80MHz / 8 / (1 + 13 + 6) = 0.5 Mbps
Run the Example:
[MCAN] External read - write test, application started ... After transmitting messages it will wait to recieve ten messages for test to pass ... All tests have passed!!
Things to keep in mind while creating the setup:
1) CAN bus should have proper termination(120 ohm).
2) The CAN parameters including sampling point needs to be calculated and set correctly on the host side, matching configurations of the board (refer syscfg)
3) SoC pins/PADs for CAN are configured properly.
4) CAN module is powered up and configured properly.