How to enable CAN peripheral

Hi I am working on Colibri iMX6ULL module and I want to use CAN peripheral. I used the below reference and edited the device tree source include file (.dtsi)


What should be my next step?

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


After editing the device tree source file to enable the CAN peripheral by setting the status of the &can1 and/or &can2 node to okay, your next steps should involve recompiling the device tree and deploying it to your Colibri iMX6ULL module. Here’s a concise guide on what to do next:

  1. Recompile the Device Tree: Use the appropriate commands to compile the device tree source files into a binary format (.dtb). This process typically involves using the dtc (Device Tree Compiler) tool or executing a build process through a build system like Yocto Project or Buildroot, depending on how you manage your software development.

  2. Deploy the Compiled Device Tree: Copy the compiled device tree binary to the boot partition of your module or use the U-Boot environment to tell the bootloader where to find the new device tree file. The exact method may vary depending on your setup and whether you’re using a carrier board’s specific configurations.

  3. Reboot the Module: After deploying the new device tree, reboot your Colibri iMX6ULL module to apply the changes. The system will use the updated device tree on boot, enabling the CAN peripheral as configured.

  4. Verify the CAN Interface: Once the system is up, verify that the CAN interface is recognized and correctly configured by the kernel. You can use the ip link show command to list all network interfaces, including CAN interfaces. If the CAN interface is correctly enabled, it should appear in the list.

  5. Configure the CAN Interface: Before using the CAN interface, you’ll need to configure it with the appropriate settings for your CAN network, such as bitrate. This can be done using the ip or ifconfig command-line tools.

  6. Test the CAN Interface: Finally, test the CAN interface to ensure it’s working as expected. You can use can-utils, a collection of utilities for Linux designed to work with CAN networks, to send and receive CAN frames.

Remember, any changes to the device tree or system configuration should be thoroughly tested to ensure they do not adversely affect your system’s stability or functionality.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

How to Use CAN on Torizon OS | Toradex Developer Center.

Hi @kp_2024,

To enable can, do device tree modification as per article and make sure pins assigned to can node is not used elsewhere.

Best regards
Ritesh Kumar

yes, I made the modifications as mentioned. But I am confused that what should be my next step- Do I regenerate the image directly using $bitbake core-image-minimal or is there a step I am missing in between?

Hi @kp_2024,

At this moment I will suggest if you can work with source code outside oe build specially for device tree. Please check below article:

Once you verified your device tree, then you can move to oe/yocto to generate final image.
Best regards
Ritesh Kumar

Thanks! This will definitely help me…

Hello Ritesh,

I build the device tree binary (dtb) with the applied changes as mentioned in the

Once the dtb file is build, I copied it and pasted it into my core-image-minimal tezi file (unzipped) replacing the imx6ull-colibri-eval-v3.dtb file (old).

I rebooted the module with the new image (containing new dtb file), but sill I cannot see any device of CAN using command: $ip link show or $ifconfig

Could you guild me here little bit as the above steps that I mentioned are correct or not?

Krutarth Purohit

hi @kp_2024 ,
You must have forgotten to check whether the CAN pins are used somewhere else or not and to disable them.
In your case, looking into the imx6ull-colibri.dtsi file, can0 and can1 pins (pinctrl_gpio3 pinctrl_gpio7) are used in &iomux.
Please delete/comment out these pins , recompile the device tree and test.

If you did something wrong with pinmuxing, like pins assigned to different modules, then something like dmesg | grep iomux should reveal such issues.
If you enable some node in DT, or do other changes in DT, inspecting /sys/firmware could help confirming got your changes successfully applied or not. For example checking for can status=“okay” could look like this

# find /sys/firmware -name "*can*"

# ls /sys/firmware/devicetree/base/soc/bus@40000000/can@40020000
clock-names    compatible     name           pinctrl-names  status
clocks         interrupts     pinctrl-0      reg

# cat  /sys/firmware/devicetree/base/soc/bus@40000000/can@40020000/status

@Edward @sahil.tx

Hi thanks for replying, I have run the command and it seems like CAN-0 device is running.

root@localhost:~# find /sys/firmware/ -name "*can*"
root@localhost:~# ls /sys/firmware/devicetree/base/soc/aips-bus@2000000/spba-bus@2000000/spi@2008000/can@0/
clocks             name               reg                xceiver-supply
compatible         phandle            spi-max-frequency
interrupt-parent   pinctrl-0          status
interrupts         pinctrl-names      vdd-supply
root@localhost:~# cat /sys/firmware/devicetree/base/soc/aips-bus@2000000/spba-bus@2000000/spi@2008000/can@0/status

This is about MCP2515 SPI-CAN device on eval-v3 board, which is enabled by default in BSP. Your first message, at least the reference in it, was about SOC build-in FlexCAN devices, so you should check your DT flexcan instances:

cat /sys/firmware/devicetree/base/soc/aips-bus@2000000/flexcan@2090000/status
cat /sys/firmware/devicetree/base/soc/aips-bus@2000000/flexcan@2094000/status