IMX8MP CAN Bus to be controller from CM7 MCU

Hi ,

I am using IMX8MP with Verdin Dev Carrier board.

i am aiming to use CAN bus from the CM7.

I did overlay to disable the CAN1 for the Linux.

       *Disable Overlay*
			"/dts-v1/;
			
			/ {
				fragment@0 {
					target = <0xffffffff>;
					__overlay__ {
						status = "disabled";
					};
				};
				__fixups__ {
					flexcan1 = "/fragment@0:target:0";
				};
			};

Need help on enabling CAN1 in the Cortex M7 side .

appreciate your help on this.

Thanks
Ramesh.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


I’d be glad to help with your CAN bus configuration for the Cortex-M7! To provide the most accurate guidance for your specific setup, could you let me know which OS and version you are running on your Verdin iMX8MP?

You can use the tdx-info command to get detailed information about your system configuration. For more details on this command, see: Getting Device Information with Tdx-Info | Toradex Developer Center

Key Information Needed:

  • Operating system (Torizon OS, BSP, etc.) and version
  • Which framework you’re planning to use for Cortex-M7 development (FreeRTOS, Zephyr, bare metal, etc.)

General Approach Overview

Based on the available documentation, enabling CAN1 on the Cortex-M7 involves several components:

1. Device Tree Configuration

Your approach to disable CAN1 on the Linux side is correct (1). For Heterogeneous Multicore Processing setups, Toradex provides device tree overlays to help with out-of-the-box experience (2).

2. RemoteProc Framework

For NXP i.MX platforms like your iMX8MP, the RemoteProc framework is used to manage the Cortex-M7 core (2). This framework allows you to:

  • Load and execute firmware on the Cortex-M7
  • Control the remote processor from the Linux side
  • Handle inter-core communication

3. Resource Domain Controller (RDC)

Shared peripherals like CAN1 require proper RDC configuration to permit access by the M7 core (3). This ensures that the Linux (A53) side doesn’t conflict with M7 usage of the peripheral.

Once you provide your OS version and preferred development framework, I can give you more specific guidance on:

  • The exact device tree overlay configuration needed
  • How to set up the RemoteProc framework for your use case
  • Firmware development considerations for CAN1 on Cortex-M7
  • Resource sharing configuration between the cores

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Thanks for the reply.

tdx-info as follows

                     **## Software summary**

                      ## Bootloader:               U-Boot
                      Kernel version:           5.15.129-rt67-6.5.0-devel+git.6f8fd49366db #1 SMP PREEMPT_RT Fri Dec 22 11:15:52 UTC 2023
                      Kernel command line:      root=PARTUUID=9e9c85a9-02 ro rootwait console=tty1 console=ttymxc2,115200 consoleblank=0 earlycon
                      Distro name:              NAME=“TDX Wayland with XWayland RT”
                      Distro version:           VERSION_ID=6.5.0-devel-20240402092141-build.0
                      Distro variant:           -
                      Hostname:                 verdin-imx8mp-15290475
                      
                      ## Hardware info
                      
                      ## HW model:                 Toradex Verdin iMX8M Plus on Verdin Development Board
                      Toradex version:          0063 V1.1B
                      Serial number:            15290475
                      Processor arch:           aarch64

Here to mention that i already enabled the RemoteProc it is working correctly as i can send data from the CM7 to the A core.

Thanks,
Ramesh.

Thank you for providing the system information! I can see you’re running TDX Wayland with XWayland RT version 6.5.0 on a Verdin iMX8M Plus with the Development Board, and that RemoteProc is already working correctly.

CAN1 Configuration for Cortex-M7

Since you have RemoteProc working and can communicate between cores, here’s how to proceed with CAN1 configuration:

1. Device Tree Overlay for HMP

For Verdin iMX8MP, Toradex provides a specific HMP (Heterogeneous Multicore Processing) overlay (1). You’ll need to enable the verdin-imx8mp_hmp_overlay.dts which is available in the toradex_6.6-2.2.x-imx branch and pre-compiled into your BSP (1).

2. Required Kernel Command Line Parameter

For RemoteProc to be functional on Verdin iMX8MP, you need a special kernel command line argument (1). Add the following command:

fw_setenv tdxargs "clk-imx8mp.mcore_booted=1"

(1), (2)

This ensures the clock configuration allows proper RemoteProc functionality (2).

3. Resource Domain Controller (RDC) Configuration

Since CAN1 is a shared peripheral, you need to ensure proper resource allocation between the Cortex-A53 (Linux) and Cortex-M7 cores. Your device tree overlay correctly disables CAN1 on the Linux side, which is the first step.

4. Firmware Development Considerations

For the Cortex-M7 firmware, you’ll need to:

  • Configure the CAN1 peripheral in your M7 application
  • Set up proper pin multiplexing for CAN1 pins
  • Ensure clock configuration matches the hardware setup
  • Handle CAN message processing in your real-time application

5. Device Tree Overlay Deployment

To deploy your overlay, you can use TorizonCore Builder or copy the compiled .dtbo file to the appropriate location and enable it in the overlays.txt file (3), (4).

Next Steps

  1. Enable the HMP overlay for your Verdin iMX8MP
  2. Ensure the kernel command line parameter is set
  3. Verify that CAN1 is properly disabled on the Linux side
  4. Configure CAN1 in your Cortex-M7 firmware
  5. Test the CAN communication from the M7 side

Which framework are you using for your Cortex-M7 development (FreeRTOS, Zephyr, or bare metal)? This will help me provide more specific guidance for the firmware implementation.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi Ramesh,

So per the information above, you should have followed below articles and succeeded to setup the NXP MCUXpresso SDK build environment for verdin imx8mp and run the hello_world/rpmsg demo, right?

https://developer.toradex.com/software/cortex-m/cortex-m-imx/setting-up-sdk-toolchain/

https://developer.toradex.com/software/real-time/freertos/freertos-on-the-cortex-m7-of-a-verdin-imx8mp/

Then, under the SDK boards/evkmimx8mp/driver_examples/ folder, there are some sample project for Flexcan driver usage you can refer to.

$ ls
interrupt_transfer loopback loopback_transfer ping_pong_buffer_transfer

And i have checked the code(pinmux.c), the sample code use CAN1 for testing by default. and in pinmux,c, you can find there is probably some other pins needed for the project, for example as below - this is the SODIMM_15 PWM1 function pin under linux, so you need to disable this pin in device tree, too.

{pin_num: AC18, peripheral: GPIO5, signal: ‘gpio_io, 05’, pin_signal: SPDIF_EXT_CLK, PUE: Weak_Pull_Up}

Hai Qin
Toradex

Hi Ramesh,

BTW, due to NXP has changed the software structure of MCUXpresso starting from 25.12 version, so I suggest to use version below 25.12 for testing.

Hai Qin
Toradex