SPI read/write with changing modes fail

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI read/write with changing modes fail

192 Views
abhinandanbr
Contributor I

Hi all,

I am testing spi read and write in imx6 as master. The method of my testing includes testing read/write for all modes.

So, first I test read/write separately for SPI mode 0... then do the same read/write test for mode 1... then for mode 2 and finally mode 3.

But this sequence of changing modes and repeating the read/write test is failing.

A single test application is used to test the above sequence.

If we change the sequence of testing to SPI mode 1, mode 0 mode 3 and then mode 2 in the end, it is found to be working fine and also this sequence is repeatable.

In all cases, frame size is 32bits and data length is 12 bytes.

Below is the spi configuration used in imx6 dts

&ecspi2 {
 pinctrl-names = "default";
 pinctrl-0 = <&pinctrl_ecspi2>;
 fsl,spi-num-chipselects = <2>;
 cs-gpios = <&gpio2 26 0>, <&gpio2 27 0>;
 dmas = <&sdma 5 7 1>, <&sdma 6 7 2>;
 dma-names = "rx", "tx";
 status = "okay";

 spi@0 {
 compatible = "spidev";
 spi-max-frequency = <50000000>;
 reg = <0>;
 };

 spi@1 {
 compatible = "spidev";
 spi-max-frequency = <50000000>;
 reg = <1>;
 };

}

Please let me know if this behavior is expected in this testing.

If not, please point me to the recommended fix I can try out, so that all sequences works.

Regards,

Abhinandan

Labels (2)
0 Kudos
3 Replies

105 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Abhinandan

to avoid such issues one can try to follow sect.21.5 Initialization before each mode

i.MX 6Dual/6Quad Applications Processor Reference Manual

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

0 Kudos

105 Views
abhinandanbr
Contributor I

Hi Igor,

Thanks for the reply.

The section indicates code changes from the driver point of view.

But from the application perspective, is it possible to follow the steps mentioned in the sect. 21.5?

I am using the SPI driver available as part of Yocto BSP18.1.0.

Regards,

Abhinandan

0 Kudos

105 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Abhinandan

section indicates code changes from the hardware point of view.

So violating it may cause ecspi module malfunction.

Best regards
igor

0 Kudos