Ok guide to writing the overlay.
This is on the BBAI-64.
By the way if you haven’t updated the default image on the board I would do so at some point. Obviously reflashing will overwrite any changes you do.
If you check the file system, you should find an /opt/source directory.
Depending on the kernel you are booting there should be a dtb-x.xx directory to match your kernel.
So mine is dtb-5.10-ti, yours may be different.
Inside /opt/source/dtb-5.10-ti/src/arm64/overlays/
create your overlay file. e.g BONE-CAN0.dts
edit this to add
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/k3.h>
&main_pmx0 {
main_mcan0_pins_default:main_mcan0-pins-default {
pinctrl-single,pins = <
J721E_IOPAD(0x20C, PIN_OUTPUT, 0) /* W6: MCAN0_TX W6_AE25 */
J721E_IOPAD(0x138, PIN_INPUT, 7) /* AE25: PRG0_PRU1_GPO14 W6_AE25 */
J721E_IOPAD(0x208, PIN_INPUT, 0) /* W5: MCAN0_RX W5_AF29 */
J721E_IOPAD(0x13C, PIN_INPUT, 7) /* AF29: PRG0_PRU1_GPO15 W5_AF29 */
>;
};
};
&main_mcan0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&main_mcan0_pins_default >;
};
edit the Makefile in that directory to add you new dts file
dtbo-$(CONFIG_ARCH_K3) += \
BONE-CAN0.dtbo \
BBAI64-CSI1-imx219.dtbo \
from /opt/source/dtb-5.10-ti/
do
make
and then
make install
Assuming there are no errors that should create the dtbo file and then copy it to
/boot/dtbs/5.10.153-ti-arm64-r84/ti/overlays/
Double check to make sure it is there.
Then edit /boot/firmware/extlinux/extlinux.conf
Either add or edit the fdtoverlays line
fdtoverlays /overlays/BONE-CAN0.dtbo
save and reboot.
Once booted you can then do
ls /proc/device-tree/chosen/overlays/
And you should see BONE-CAN0 assuming everything has worked.
Then proceed with configuring the CAN interface and testing.