Imx8 Mini, M4 Core gpio pulse

I’m working on a board with Imx8 Mini and I’m trying to use the M4 core to generate pulses on some GPIO pins. I’ve build the OS and M4 Core firmware to generate a pulse on a GPIO pin successfully and also have verified that the M4 firmware is correctly running. When I start M4 with this firmware from uboot the pulse is showing up on the gpio and everthing is working fine but as soon as the kernel boots up the pulse is vanished. I’ve checked and made sure that the M4 core is still running but somehow it cannot toggle the value of that pin anymore (when the kernel loaded).
How can I achieve this and make the pulse remains after the kernel boots up?

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:


To ensure that the pulse generated by the M4 core on the GPIO pins remains after the Linux kernel boots up on your iMX8 Mini board, you need to prevent the Linux kernel from taking control of these pins, which are being used by the M4 core. This can be achieved by modifying the Device Tree Blob (DTB) used by the Linux kernel to exclude or alter the configuration of the pins in question.

Here are the steps you can follow to achieve this:

  1. Identify the GPIO Pins: First, identify the exact GPIO pins you are using for the M4 core to generate pulses.

  2. Modify the Device Tree: Locate the Device Tree Source (DTS) file for your specific board configuration within the Linux kernel source code. This file is responsible for configuring the hardware peripherals and their properties for the Linux kernel.

  3. Disable or Reconfigure the Pins: In the DTS file, find the pin configuration for the GPIO pins you are using with the M4 core. You might need to either:

    • Disable the pin configuration by removing or commenting out the pin definition, which will prevent the Linux kernel from initializing and using these pins.
    • Reconfigure the pin function to ensure it is not used by any other kernel drivers or subsystems that might interfere with the M4 core’s operation.
  4. Recompile the Device Tree Blob (DTB): After modifying the DTS file, recompile it to generate a new DTB file.

  5. Deploy the New DTB: Replace the existing DTB file on your board with the newly compiled DTB file. This can typically be done by copying the DTB file to the boot partition or specifying the DTB file location in the U-Boot environment.

  6. Test the Configuration: Boot the board and verify that the pulse generated by the M4 core remains after the Linux kernel has booted up.

By following these steps, you should be able to maintain the functionality of the GPIO pins controlled by the M4 core even after the Linux kernel has taken over the system. This approach ensures that the kernel does not reconfigure or claim the pins needed for the M4 core’s operation, allowing the pulses to continue uninterrupted.

Best regards,
Toradex AI Assistant

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

How to Run a Hello World on the Cortex-M | Toradex Developer Center.

As @ToradexAI answered, probably you use one of the pins that the Linux kernel needs.
You should verify the Device Tree files (*.dts) of your Linux distribution and see which GPIO pin you can use without any conflict between M4 and Linux itself.

Hello @alirezah95,

What @vix suggested is right. Also, @ToradexAI has listed down the steps correctly for implementing this.

@rudhi.tx @vix The point is that I have tested multiple patches to the kernel dt to make sure that pin is not taken by the kernel but it didn’t help either.
I’m going to test different gpio pin may be that helps. Thanks for your hints though

1 Like