Problem with jedec,spi-nor on IMX8M Mini EVK

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem with jedec,spi-nor on IMX8M Mini EVK

跳至解决方案
5,919 次查看
andreasgustafss
Contributor III

Hi!

I have a Macronix mx25r1635f connected to my imx8mmini over the ecspi2 headers.

But when the board boots and 0x9f (RDID) is sent over the line, right after the command the clock stops and cs goes away, so I can't read the JEDEC info:

m25p80 spi1.0: unrecognized JEDEC id bytes: 00, 00, 00

Just like in this link: https://forum.rocketboards.org/t/chip-select-goes-away-soon-after-the-transfer-to-a-spi-slave-is-com... 

I have successfully read the id with a simple c-program and spidev-configuration in the device tree. So there is no problem with the hardware/signaling.

I have added the new macronix chip the the spi-nor.c configuration list.

Any help would be greatly appreciated!

Some snippets from my device tree:

---

                pinctrl_ecspi2: ecspi2grp {
                        fsl,pins = <
                            MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO            0x116
                            MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI            0x116
                            MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK            0x1916
                            MX8MM_IOMUXC_ECSPI2_SS0_ECSPI2_SS0              0x116
                        >;

---

&ecspi2 {                                                                       
        fsl,spi-num-chipselects = <1>;                                          
        cs-gpios = <0>;                                                         
        pinctrl-names = "default";                                              
        pinctrl-0 = <&pinctrl_ecspi2>;                                          
        status = "okay";

        flash1: mx25r1635f@0 {
        reg = <0>;
                compatible = "macronix,mx25r1635f", "jedec,spi-nor";
                spi-max-frequency = <2000000>;
                spi-cs-low;
        };
};

---

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
5,594 次查看
andreasgustafss
Contributor III

Yes,

when I changed the pinmuxing and specified the cs-gpios it did work!

Where can I find digestible information on how to do the pinctrl?

My new device-tree:

---

                pinctrl_ecspi2: ecspi2grp {
                        fsl,pins = <

                            MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13              0x40000
                            MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO            0x82
                            MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI            0x82
                            MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK            0x82
                        >;

 

---

 

&ecspi2 {
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";

 

        flash1: mx25r1635f@0 {
        reg = <0>;
                compatible = "macronix,mx25r1635f", "jedec,spi-nor";
                spi-max-frequency = <2000000>;
                spi-cs-low;
        };
};

 

---

在原帖中查看解决方案

4 回复数
5,594 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Andreas

one can check if clock is enabled for ecspi2 using

Table 6-7. CCGR setting by ROM i.MX8M Mini Reference Manual

and try to debug in spi-nor driver using sect.3.8 SPI NOR Flash Memory Technology Device (MTD)

Linux Manual and Linux L4.14.98_2.0.0 Documentation

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
5,594 次查看
andreasgustafss
Contributor III

Well I must have clock as I'm able to talk with the device when using spidev, right?

And I'm not trying to boot from the device.

0 项奖励
回复
5,594 次查看
igorpadykov
NXP Employee
NXP Employee

one can look on ecspi2 example

bulix.org / pastebin 

5,595 次查看
andreasgustafss
Contributor III

Yes,

when I changed the pinmuxing and specified the cs-gpios it did work!

Where can I find digestible information on how to do the pinctrl?

My new device-tree:

---

                pinctrl_ecspi2: ecspi2grp {
                        fsl,pins = <

                            MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13              0x40000
                            MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO            0x82
                            MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI            0x82
                            MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK            0x82
                        >;

 

---

 

&ecspi2 {
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";

 

        flash1: mx25r1635f@0 {
        reg = <0>;
                compatible = "macronix,mx25r1635f", "jedec,spi-nor";
                spi-max-frequency = <2000000>;
                spi-cs-low;
        };
};

 

---