Gyroscope handled by M4 program stop to work when linux boot

Dear all,

Gyroscope is using pin 59 and 67 and so I checked the NXP reference manual and I set the linux to avoid conflicts. Which was shown by a check with an Oscylloscope:

Linux set:

&iomuxc {
        pinctrl_pwm1: pwm1-grp {
                fsl,pins = <
                        MX7D_PAD_GPIO1_IO08__GPIO1_IO8          0x79
                        MX7D_PAD_ECSPI2_MOSI__ECSPI2_MOSI        0x3
                >;
        };

        pinctrl_pwm4: pwm4-grp {
                fsl,pins = <
                        MX7D_PAD_GPIO1_IO11__GPIO1_IO11         0x79
                        MX7D_PAD_ECSPI2_SCLK__ECSPI2_SCLK        0x3
                >;
        };
        pinctrl_gpio2: gpio2-grp { /* On X22 Camera interface */
                fsl,pins = <
                        MX7D_PAD_ECSPI2_SS0__GPIO4_IO23         0x03 /* SODIMM 65 */
                        MX7D_PAD_SD1_CD_B__GPIO5_IO0            0x74 /* SODIMM 69 */
                        MX7D_PAD_I2C4_SDA__GPIO4_IO15           0x14 /* SODIMM 75 */
                        MX7D_PAD_ECSPI1_MISO__GPIO4_IO18        0x14 /* SODIMM 79 */
                        MX7D_PAD_I2C3_SCL__GPIO4_IO12           0x14 /* SODIMM 81 */
                        MX7D_PAD_ECSPI2_MISO__ECSPI2_MISO       0x3 /* SODIMM 85 */
                        MX7D_PAD_ECSPI1_SS0__GPIO4_IO19         0x14 /* SODIMM 97 */
                        MX7D_PAD_ECSPI1_SCLK__GPIO4_IO16        0x14 /* SODIMM 101 */
                        MX7D_PAD_ECSPI1_MOSI__GPIO4_IO17        0x14 /* SODIMM 103 */
                        MX7D_PAD_I2C3_SDA__GPIO4_IO13           0x14 /* SODIMM 94 */
                        MX7D_PAD_I2C4_SCL__GPIO4_IO14           0x14 /* SODIMM 96 */
                        MX7D_PAD_SD2_RESET_B__GPIO5_IO11        0x14 /* SODIMM 98 */
                >;
        };
};

Init M4:

+gpio_config_t gpio1IO11 = {
+    "CLKSENS",                                       /* name */
Add a comment to this line 
+    &IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO11,               /* muxReg */
+    0,                                               /* ALT 0 _ GPIO */
+    &IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO11,               /* padReg */
+         IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO11_PS(1) |         /* padConfig */
+        IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO11_PE_MASK |
+         IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO11_HYS_MASK,
+    GPIO1,                                           /* base */
+    11                                               /* pin */
+};

Dear @andreat

If you don’t see any difference in your oscilloscope measurements, there must be another reason why your gyroscope stops working. As the pins are still toggling, I would search for a part of your code which misconfigures the gyro and renders it unfunctional.

Regards, Andy

Dear andy.tx,

thank you for reply.
To be more accurate, using the Oscylloscope I can see that ECSPI CLOCK stop to be a clock timing when the kernel start. So it is not a bug code issue.
Do you have any suggestion?

Hi @andreat

This are this double occupied pins. I guess the easiest would be to just not touch it in the devicetree at all if they work when not running Linux. I think now Linux reconfigures the pins when starting and therefore it overwrites the stuff the Cortex M4 did.

So please try something like:

&pwm1 {
        status = "disabled";
};

&pwm4 {
        status = "disabled";
};

 &iomuxc {
         pinctrl_pwm1: pwm1-grp {
                 fsl,pins = <>;
         };
 
         pinctrl_pwm4: pwm4-grp {
                 fsl,pins = <>;
         };
 };

pinctrl_gpio2 shouldn’t have an influence on that.

Regards,
Stefan

Thank you for reply.
We already tried, but we are going to try again.

@stefan_e.tx
We tested again, but unfortunately we faced same issue.

Hi @andreat

Do you still face this issue or is it solved?

Best regards,
Jaski