i.MX6 SPI CS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6 SPI CS

1,514 Views
pan_liu2
Contributor I

Hello:

I am trying to interface a SPI peripheral (slave) to my i.MX6 (master). 

According to the timing diagram requirements of this SPI peripheral, the i.MX6 needs to send a 16-bit command first, and then receive 16-bit data from the peripheral. During this period, the CS needs to be kept low. I set the burst length to 16. The CS will always be set high between the two bursts. 
How should I set the IMX6ul SPI to keep the CS signal line low between the two bursts? Now no matter what I try to set it, I can't achieve it, eg (SMC = 0, SS_CTL = 0, XCH = 1).

Thanks!!

Labels (1)
Tags (1)
0 Kudos
3 Replies

1,261 Views
MicMoba
Contributor V

solved my problem by using the cs-gpio property instead of cs-num in the DT. So the SPI driver manage the CS as GPIO and the cs_change property works. (Thanks to Sasch Hauer for support)

 

&ecspi1 {
    status = "okay";
    compatible = "fsl,imx53-ecspi";
    #address-cells = <1>;
    #size-cells = <0>;    
    cs-gpios = <&gpio2 30 0>, <&gpio3 19 0>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_generic_ecspi1>;  
    fram: fram@0 {
        compatible = "rohm,dh2228fv";  /* spidev -> cause buggy DT message */
        reg = <0>;
        spi-max-frequency = <34000000>; /* max 34MHz */
    };     
};

 

 

pinctrl_generic_ecspi1: spi0grp {
            fsl,pins = <
                MX6QDL_PAD_EIM_D18__ECSPI1_MOSI             0x0001B0B0     
                MX6QDL_PAD_EIM_D17__ECSPI1_MISO             0x0001B0B0     
                MX6QDL_PAD_EIM_D16__ECSPI1_SCLK             0x0001B0B0     
                MX6QDL_PAD_EIM_EB2__GPIO2_IO30                0x0001B0B0
                MX6QDL_PAD_EIM_D19__GPIO3_IO19                0x0001B0B0
            >;
        };

1,261 Views
MicMoba
Contributor V

Is there a solution? I have a similar problem. Send one byte and receive 3 byte without CS going high between send and receive.

Thanks

Michael

0 Kudos

1,261 Views
jimmychan
NXP TechSupport
NXP TechSupport

You can try to change the CS pin as a GPIO pin.

Then use the gpio's output function to set the pin low.

0 Kudos