Cortex-M4 issue on IMX8QM Stuck boot

this is the output shown by the M4 side

/* Power on Peripherals. */
    if (sc_pm_set_resource_power_mode(ipc, SC_R_GPIO_3, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
    {
        PRINTF("Error: Failed to power on GPIO\r\n");
    }

from the message, I’m a little confused where the problem is because according to the .c gpio example code snippet that I customized, it seems like there is a problem in the SC_R_GPIO_3 resource. Then after I checked also the ownership of the resource also has a false output.

sc_bool_t owned = sc_rm_is_resource_owned(ipc, SC_R_GPIO_3);
    if (!owned)
    {
        PRINTF("GPIO3 not owned...\r\n");
    }

Then on

$ dmesg

I found that there was a failure on pinctrl. But I still don’t know the cause why, because it’s not all gpio that doesn’t work but after I checked only gpio 1 - 6 are dead (because the UART that I use for serial debug and gpiofan is running properly).

[ 0.216244] imx8qm-pinctrl system-controller:pinctrl: initialized IMX pinctrl driver
[ 0.218176] imx8qm-pinctrl system-controller:pinctrl: pin_config_set op failed for pin 13
[ 0.218183] imx8qm-pinctrl system-controller:pinctrl: Error applying setting, reverse things back
[ 0.218198] imx8qm-pinctrl system-controller:pinctrl: failed to select default state

Hi @Azkaaa ,

Let’s take MXM3_3/GPIO2 as an example. MXM3_3 is in M4_0 partition in default SCFW. It has to be freed from the partition. According to sc_fw_api_qm_b0.pdf, the pad of MXM3_3 is SC_P_M40_GPIO0_01.

In platform/board/mx8qm_apalis/board.c, comment out //RM_RANGE(SC_P_M40_I2C0_SCL, SC_P_M40_GPIO0_01).

            /* List of pads */
            static const sc_pad_t pad_list[2U] =
            {
                //RM_RANGE(SC_P_M40_I2C0_SCL, SC_P_M40_GPIO0_01)
                SC_P_M40_I2C0_SCL
            };

Rebuild the SCFW and assemble the boot container again.
MXM3_3 can be set to high or low by the following command.

root@apalis-imx8-06494587:~# gpioset -c gpiochip2 9=0
^C
root@apalis-imx8-06494587:~# gpioset -c gpiochip2 9=1
^C

ohh i see, for the case of M4_0 and M4_1 partitions in SCFW already by default have authority in the resource. So to use gpio on the Linux side, I need to disable the resource on the M4 side first?

and also why when I access gpio 3 and 4 on M4_1 it is still not working? even though the sc_fw_api_qm_b0.pdf documentation and also from apalis_imx8 show that gpio 3 and 4 are on the M4_1 partition.
image

the result still :

is there also an adjustment if the GPIO is used in M4_1?