Hello @benedict.hewson
Thank you for the reply. I am able to setup CAN overlay. Steps I have followed:
- Git clone BeagleBoard Device Trees
$ git clone https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees.git
$ cd BeagleBoard-DeviceTrees
- Edit k3-j721e-beagleboneai64-bone-buses.dtsi in src/arm64 and add the following lines at the end
bone_can_0: &mcu_mcan0 {
pinctrl-names = "default";
pinctrl-0 = <
&P9_19_can_pin /* mcan0_rxd */
&P9_20_can_pin /* mcan0_txd */
>;
symlink = "bone/can/1";
status = "disabled";
};
- Create new CAN0 overlay file BONE-CAN0.dts with the following content in
src/arm64/overlays/
/*
* Copyright (C) 2022 BeagleBoard.org - https://beagleboard.org/
*
* https://elinux.org/Beagleboard:BeagleBone_cape_interface_spec#CAN
*/
/dts-v1/;
/plugin/;
/*
* Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
*/
&{/chosen} {
overlays {
BONE-CAN0.kernel = __TIMESTAMP__;
};
};
&bone_can_0 {
status = "okay";
};
- Compile and install from parent directory
BeagleBoard-DeviceTrees
$ make
$ sudo make install
- Reboot
$ sudo reboot
- Test if CAN interfae is loaded
$ sudo beagle-version | grep UBOOT
UBOOT: Booted Device-Tree:[k3-j721e-beagleboneai64.dts]
UBOOT: Loaded Overlay:[BONE-CAN0.kernel]
- Check for CAN interface in ip link
$ ip link
can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
link/can
It shows can0
is DOWN. To make it available, run:
$ sudo ip link set can0 up type can bitrate 1000000
$ ip link
can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can
- Increase
txqueulen
$ sudo ifconfig can0 txqueuelen 100
After following these steps I am able to send TX messges from terminal but candump
shows no output. When I do
$ ip -det link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/can promiscuity 0 minmtu 0 maxmtu 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0
bitrate 1000000 sample-point 0.750
tq 12 prop-seg 29 phase-seg1 30 phase-seg2 20 sjw 1
m_can: tseg1 2..256 tseg2 2..128 sjw 1..128 brp 1..512 brp-inc 1
m_can: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..32 dbrp-inc 1
clock 80000000 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
It shows can state ERROR-ACTIVE
What could be the reason? I hope you help.
Thank you
Best
Shubham