How to check if SPI is working?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to check if SPI is working?

ソリューションへジャンプ
13,884件の閲覧回数
giorgiopresciut
Contributor II

Dear NXP Community,

I'm trying to use the MCIMX6Q-SDB board to communicate with an ADC. The communication is via SPI.

The i.MX6 evaluation board has a DNP NOR FLASH located in U14. I've soldered there the 4 wires of the SPI to create the connection with the ADC.

The four signals:

- SPINOR_CLK

- SPINOR_MOSI

- SPINOR_MISO

- SPINOR_CS0

are correctly routed, I've checked the R590, R586, R584, R583 resistors and they are on position A.

The device tree is the following:

&ecspi1 {
    fsl,spi-num-chipselects = <1>;
    cs-gpios = <&gpio4 9 0>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi1>;
    status = "okay";

     adc@0 {
     compatible = "ti,ads7953";
     reg = <0>;
     #io-channel-cells = <1>;
     vref-supply = <2500>;
     spi-max-frequency = <20000000>;
        };
};

The pin description of ecspi1 is the following:

pinctrl_ecspi1: ecspi1grp {
    fsl,pins = <
        MX6QDL_PAD_KEY_COL1__ECSPI1_MISO    0x100b1
        MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI    0x100b1
        MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK    0x100b1
        MX6QDL_PAD_KEY_ROW1__GPIO4_IO09        0x1b0b0
    >;
};

When I try to communicate over SPI nothing happens. I see the clock select moving but no output on the MOSI. What's wrong with my configuration? Am I using the i.MX6 EVB correctly?

Thanks and regards

ラベル(1)
タグ(4)
1 解決策
10,846件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Giorgio,

there are many thins that should be checked:

1. Enable SPI Driver by going to Device Drivers --> SPI Support and seting '*' to SPI device Driver, save changes and then exit.

pastedImage_1.png

Then make zImage and please note that you must not make imx_v7_defconfig  after you enabled spidev in menuconfig because .config may be lost.

2.  Check in your .dtsi file that adress-cells and size-cells are set on the ecspiX node

&ecspi1 {
    fsl,spi-num-chipselects = <1>;
    cs-gpios = <&gpio5 17 0>;
    pinctrl-0 = <&pinctrl_ecspi1>;
    pinctrl-names = "default";
    status = "disabled";

    spidev0: spi@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <2000000>;
    };
};
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

3. Verify that ecspiX is enabled in the .dts file (althoug you may enable ir in .dtsi the side effect is that all configurations will enable this feature)

&ecspi1 {
    status = "okay";
};‍‍‍

4. Verify that the pins you are using for SPI are not being repeated or used by other funtion in the device tree. In other words disable all other configs for

MX6QDL_PAD_KEY_COL1__xxx_xxx
MX6QDL_PAD_KEY_ROW0__xxx_xxx
MX6QDL_PAD_KEY_COL0__xxx_xxx
MX6QDL_PAD_KEY_ROW1__xxx_xxx

5. Once the i.MX boots you must see spidev0.0 listed under /dev, if you dont please rebuild zImage as indicated in step 1.

6. You can make a simple test with the command echo "hello" > /dev/spidev0.0  and you must see in oscilloscope the signals of the transfer.

7. If the problem persists you should double check hardware.


Regards,
Carlos

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

元の投稿で解決策を見る

4 返答(返信)
10,847件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Giorgio,

there are many thins that should be checked:

1. Enable SPI Driver by going to Device Drivers --> SPI Support and seting '*' to SPI device Driver, save changes and then exit.

pastedImage_1.png

Then make zImage and please note that you must not make imx_v7_defconfig  after you enabled spidev in menuconfig because .config may be lost.

2.  Check in your .dtsi file that adress-cells and size-cells are set on the ecspiX node

&ecspi1 {
    fsl,spi-num-chipselects = <1>;
    cs-gpios = <&gpio5 17 0>;
    pinctrl-0 = <&pinctrl_ecspi1>;
    pinctrl-names = "default";
    status = "disabled";

    spidev0: spi@0 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <2000000>;
    };
};
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

3. Verify that ecspiX is enabled in the .dts file (althoug you may enable ir in .dtsi the side effect is that all configurations will enable this feature)

&ecspi1 {
    status = "okay";
};‍‍‍

4. Verify that the pins you are using for SPI are not being repeated or used by other funtion in the device tree. In other words disable all other configs for

MX6QDL_PAD_KEY_COL1__xxx_xxx
MX6QDL_PAD_KEY_ROW0__xxx_xxx
MX6QDL_PAD_KEY_COL0__xxx_xxx
MX6QDL_PAD_KEY_ROW1__xxx_xxx

5. Once the i.MX boots you must see spidev0.0 listed under /dev, if you dont please rebuild zImage as indicated in step 1.

6. You can make a simple test with the command echo "hello" > /dev/spidev0.0  and you must see in oscilloscope the signals of the transfer.

7. If the problem persists you should double check hardware.


Regards,
Carlos

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

10,846件の閲覧回数
dtvs
Contributor II

Hi Carlos,

I looked in to the menu config, and as suggested by you the "User mode  SPI device driver support" was not enabled.

After enabling I was able to see the SPI devices on the target!!!

Thank you!!!!

0 件の賞賛
返信
10,846件の閲覧回数
dtvs
Contributor II

Hi Carlos_Musich, thanks for the help.

We are able to see spidev in dev folder.

Thanks and regards.

0 件の賞賛
返信
10,846件の閲覧回数
giorgiopresciut
Contributor II

Hi Carlos,

many thanks for your help. SPI configured as dev is working. I see the "hello" word in the oscilloscope's monitor.

Regards,

Giorgio

0 件の賞賛
返信