I can't see Cortex M7 UART messages after Torizon kernel starts

Hi!

I’m using Verdin iMX8M-plus SoC with Yavia and TorizonOS and came up with this UART4 problem forethought by the cortex-m tutorial:

  1. I build a firmware using MCUXpresso SDK successfully;
  2. Load it on Cortex-M7 using uboot;
  3. Run the firmware from uboot and it behaves as expected;
  4. As soon as the Torizon kernel starts, M7 stop working;

The real issue is that it persists even after I configured the correct device tree overlay to disable UART4 for Torizon."

After further research into Torizon’s device tree usage, I realized that the overlay example from the tutorial is already implemented in imx8mp-verdin-nonwifi.dtsi, a .dtsi file included in imx8mp-verdin-nonwifi-yavia.dts.

Finally, I’ve already tried multiple approaches, but none of them worked. My last attempt involved following these instructions using TorizonCore Builder. My tcbuild configuration was:

# Sample configuration file:
input:
  easy-installer:
    local: torizon-docker-verdin-imx8mp-Tezi_7.2.0+build.13.tar
# Sample customization: insert the hdmi overlay in the IMX6
customization:
  device-tree:
    include-dirs:
      - linux/include
    custom: linux/arch/arm64/boot/dts/freescale/imx8mp-verdin-nonwifi-yavia.dts
    overlays:
      add:
        - device-trees/overlays/verdin-imx8mp_spidev_overlay.dts
        - device-trees/overlays/verdin-imx8mp_hdmi_overlay.dts
        - device-trees/overlays/verdin-imx8mp_dsi-to-hdmi_overlay.dts
        - device-trees/overlays/verdin-imx8mp_hmp_overlay.dts

output:
  easy-installer:
    local: torizon-docker-verdin-imx8mp-Tezi_7.2.0+build.CUSTOM

I thought using the HMP overlay might resolve the issue, but the problem persisted.

Additionally, in the imx8mp-verdin-nonwifi.dtsi file, I don’t understand why ‘SODIMM_151’ and ‘SODIMM_153’ (the UART4 pins) are assigned to &gpio5.

Any insights would be greatly appreciated! :blush:

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

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


Hello! Thank you for your detailed description and configuration information. Let’s break down your issues and offer guidance focused on the Verdin iMX8M Plus running TorizonOS.


1. Cortex-M7 FreeRTOS Firmware Stops Running After Linux Boot

This is a common pain point when sharing peripherals between Linux and the Cortex-M7 (M7) core. The root cause in most cases is the re-initialization, reconfiguration, or claim of a resource (like UART4) by the Linux kernel once it’s up, even if you try to disable it via overlays.

How Peripheral Ownership Works

  • The Cortex-M7 can access peripherals if the Linux device tree doesn’t “claim” them.
  • If Linux’s device tree or kernel driver claims the UART (e.g., “status = ‘okay’” or driver bound), the kernel can reinitialize the peripheral, causing the M7 side to lose access or crash.

Possible Reasons Why the Issue Persists

  • The typical overlays (such as [verdin-imx8mp_hmp_overlay.dts]) disable UART4 via “status = ‘disabled’”, but this might not fully prevent kernel-side initialization or pinmux changes—especially if something else reconfigures the relevant pins for GPIO.
  • If another overlay or the main device tree re-assigns the pins as GPIO (see your gpio5 question), then the M7 loses hardware access to those pins.

2. Overlay & Device Tree Guidance

Ensure that all overlays and device tree fragments that could affect UART4 are disabled or removed. This includes not only overlays explicitly setting UART4 to “disabled”, but also any other overlays (yours or BSP-provided) that reference SODIMM_151/SODIMM_153 or uart4 at all.

Check this:

  • Only your HMP overlay should touch UART4—it should not appear as enabled or remapped anywhere else (including the base .dts/.dtsi).
  • No other overlay should reference SODIMM_151/SODIMM_153 as part of another function or as generic GPIO.

Please review the overlay process documentation:


3. Why SODIMM_151 and SODIMM_153 May Be Assigned to gpio5

In default device trees, when UART4 is disabled, the pins SODIMM_151 and SODIMM_153 could be reassigned to GPIO by default. That’s why you see something like this:

pinctrl_gpio5: gpio5grp {
    fsl,pins = <
        IMX8MP_IOMUXC_UART4_RXD__GPIO5_IO28 0x1c6    /* SODIMM_151 */
        IMX8MP_IOMUXC_UART4_TXD__GPIO5_IO29 0x1c6    /* SODIMM_153 */
    >;
};

This makes them generic GPIOs for Linux, not for the M7. If these pins are switched to GPIO by Linux, the SoC’s IOMUXC (I/O multiplexer) updates accordingly, preempting M7 ownership.


4. Solution Approach

A. Confirm Only HMP Overlay Affects UART4 Pins
Double-check your overlays and the resulting compiled device tree to ensure no other place assigns these pins except for your disable UART4 overlay.

B. Remove any GPIO Assignment for These Pins
If the device tree or overlays reassign the UART4 pins as GPIOs, remove those assignments. They should be left “unclaimed” by Linux, so only the M7 can use them.

C. Recompile and Apply the Device Tree
Use TorizonCore Builder to verify and compile the resulting .dtb, ensuring only the expected modifications are present.

# Example command to check memory map
hexdump -C your-custom-image.dtb

5. General Reference

See Toradex’s instructions about running firmware on the Cortex-M7 alongside Linux:


In Summary:

  • Carefully review all overlays and the base device tree for assignments to SODIMM_151/SODIMM_153 (UART4 pins).
  • Ensure no other overlays claim these pins as GPIO or for other peripherals.
  • Only the HMP/disable-UART4 overlay should reference/disable UART4, without reassigning pins.
  • After changes, rebuild and deploy your image using TorizonCore Builder.

If you need guidance on checking your resulting device tree, or building a minimal overlay that only disables UART4 without making them GPIO, let me know!

Best regards,
Toradex AI Assistant.


References:

Hello @ramf !

Welcome to the Toradex Community!

I was able to reproduce the issue on my side, and it is indeed a bug in our OS. We will be investigating this over the next few weeks to find a solution and will update you as soon as possible.

In the meantime, I can share a workaround that uses remoteproc to start and stop the Cortex-M from userspace. To make it work properly, please first configure the following flag in U-Boot:

Verdin iMX8MP # setenv tdxargs 'clk-imx8mp.mcore_booted=1'
Verdin iMX8MP # saveenv

Then, on the Linux side, you can use remoteproc as described in this article without any issues.

About this question, the SODIMM_151 and SODIMM_153 pins are listed under &gpio5 because they physically belong to the i.MX8MP’s GPIO5 bank. The gpio-line-names property only assigns user-friendly names for tools like libgpiod and doesn’t configure the pins as GPIOs. Since they are not required to be set in the iomuxc, the pins can still be muxed for UART4 or any other function and remain available for use by the Cortex-M (M7 core).

Please let me know if you have any questions.

Best regards,
Daniel Morais