I am attempting to add a CAN transceiver to the boar using J9 pins 16 and 22.
Once done How do I enable the MCU_MCAN0 interface to make use of it
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.
You can download the latest MCU+SDK installer for AM62x, from the link attached below:
You can have a look at the MCAN example provided in the MCU+SDK to get an understanding on how to enable the MCU_MCAN0 module. Please note that the example provided in the MCU+SDK is an internal loopback example, so a CAN transceiver would not be needed to run it. You can follow similar steps and work with an external transceiver as well.
I am also attaching the MCU+SDK MCAN documentation link below:
Hope this helps.
I download the SDK installed it on my VM ad attempted a "make".
it failed with:
make: /home/nbdev/ti/ti-cgt-armllvm_2.1.3.LTS/bin/tiarmclang: Command not found
makefile.am62x.m4f.ti-arm-clang:95: recipe for target 'led.obj' failed
make: *** [led.obj] Error 127
Isn't it just a case of editing the DTB to include the can interface, to allow use of the Linux can support?
I am just trying to enable the CAN0 interface for Linux which I believe to be the A53 main quad core.
for example I need to be able to see a can0 interface when I issue the command "ip link show" at the command prompt also see data when I issue "candump can0"
I understand you want to use MCU_MCAN0 on AM62x from Linux Kernel using 9.0 SDK.
If so, 3x CAN should be enabled on 9.0 SDK (No DTB changes necessary), please look at the following doc:
All you have to do is enable the MCAN overlay at u-boot stage and you should see 3x CAN at Linux Kernel using ifconfig -a command.
If you are using MCU header J9 pins 16 and 22, it should work. Simply follow the doc on instructions on how to connect external CAN transceiver to the pins on the MCU header.
The inference of the linked document is that the MCAN0 interface is already enabled on the AM62x platform, which I find not to be the case.
There are no instructions on how to enable it. What I get when I attempt to set up the interface is the following:
ip link set can0 type can bitrate 62500
Cannot find device "can0".
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether f4:84:4c:fc:1c:bd brd ff:ff:ff:ff:ff:ff
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether 70:ff:76:1e:a4:9e brd ff:ff:ff:ff:ff:ff
Can you please let me know how to enable MCAN0, I suspect I need to edit the DTB code pretty much the way the linked document shows for the other CAN interfaces.
The MCAN nodes are already in the 9.0 SDK:
The ones missed are for AM62ax, and you have AM62x device, so you should not have to modify anything in device tree.
Likely your issue that the overlay is not getting applied, so please try the following in u-boot:
Hit any key to stop autoboot: 0 => => setenv name_overlays ti/k3-am625-sk-mcan.dtbo => boot
OK, so that is now working, but I am now getting errors when I send data on can0
cansend can0 123#DEADBEEF
root@netbotz761ea64a:~# [ 326.346329] m_can_platform 4e00000.can can0: bus-off, scheduling restart in 100 ms
[ 326.458051] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready. I will check my hardware interface, but I know it worked on my other environment.
Ok so my transceiver is good, I am using a TJA1050 with pin 8 (MCAN0_RX) on User Expansion connected to pin 4 and pin 10 (MCAN0_TX) on User Expansion connected to pin 1.
I have a 120 Ohm terminator resistor across pins 6 ( CAN_L) and 7 (CAN_H). I am pulling 5volts of the SK-AM62x development card to pin 3 and ground to pins 2 and 8 of the TJA1050. On my other STM development platform I can send a receive data without error
The 5V from SK-AM62x might be the problem. Can you verify this power source is good. 5V on User expansion is not enabled by default. If you need to bring them up, here is an example using GPIO: https://dev.ti.com/tirex/explore/node?node=A__ANR3bSoQUtte3JSAV7ex0g__linux_academy_am62x__XaWts8R__LATEST
OK I have it now the reason is the canX ( where X = 0, 1, or 2)
AM62x pin 22 (MCU_MCAN0_RX) on MCU Header to pin 2 (CAN_RX) on the CAN transceiver Header 1 = can0
AM62x pin 16 (MCU_MCAN0_TX) on MCU Header to pin 1 (CAN_TX) on the CAN transceiver Header 1 = can0
AM62x pin 11 (MCU_MCAN1_RX) on MCU Header to pin 2 (CAN_RX) on the CAN transceiver Header 1 = can1
AM62x pin 10 (MCU_MCAN1_TX) on MCU Header to pin 1 (CAN_TX) on the CAN transceiver Header 1 = can1
AM62x pin 8 (MCAN0_RX) on User Expansion to pin 2 (CAN_RX) on the CAN transceiver Header 1 = can2
AM62x pin 10 (MCAN0_TX) on User Expansion to pin 1 (CAN_TX) on the CAN transceiver Header 1 = can2
ok so now I have traffic without errors