SPI issue in imx6ul

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

SPI issue in imx6ul

14,672 Views
anandkrs
Contributor I

I am struggling with an spi issue on imx6ul.

Any pointer will be helpful to fix / debug this issue

When I trace the SPI line, it seems that there us a drift in CS line, Also on clk line there are sometime 7 pulses and sometime 8 pulses.

Below is my device tree setting 

spi0 = &ecspi2;  

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

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

pinctrl_ecspi2: ecspi2grp {
 fsl,pins = <
 MX6UL_PAD_JTAG_MOD__GPIO1_IO10 0x0b0b0 /* CSPI_SS */
 MX6UL_PAD_UART5_TX_DATA__ECSPI2_MOSI 0x0b0b0 /* CSPI_MOSI */
 MX6UL_PAD_UART5_RX_DATA__ECSPI2_MISO 0x0b0b0 /* CSPI_MISO */
 MX6UL_PAD_UART4_TX_DATA__ECSPI2_SCLK 0x0b0b0 /* CSPI_SCLK */
 >;
};

1.png2.png

Labels (4)
0 Kudos
Reply
5 Replies

14,073 Views
TomE
Specialist II

There was a bug in the i.MX53 clock setup that stopped the SPI clocks and the SPI sending when the CPU "slept". it is unlikely that this problem is in the far newer kernel that you're using, but it may have crept in.

https://community.nxp.com/message/593611#comment-587236

There were all sorts of other bad problems with the CURRENT i.MX53 SPI Linux Drivers that made them useless for us, but they were fixed in 2.6.38 as the drivers were replaced by the "mainline" ones. You distribution should have the newer one. Details here:

https://community.nxp.com/message/593611#comment-585209

Tom

0 Kudos
Reply

14,073 Views
anandkrs
Contributor I

Thanks Tom for your reply.

The thread you posted had mentioned 2.6.35 kernel and for the imx53 & imx28.

Here I am using 4.4. kernel and imx6ul, is it same issue been discussed in these threads ?

With Regards

Anand

0 Kudos
Reply

14,073 Views
TomE
Specialist II

You should search for "eCSPI" in the Search Box. There are a lot of previous issues there. Some may relate to your problem. One is having a problem with chip-selects, partly because the driver supports them as very slow GPIOs which the software turns on and off, rather than having the better solution where the hardware CS lines are used instead.

i.MX53 is only supported by Freescale with 2.6.35. The SPI drivers were quite buggy.

2.6.38 was released for some reason, but isn't the "official" release for i.MX53.

The Freescale SPI drivers in 2.6.35 were replaced with "mainline" drivers in 2.6.38.

I would assume (but don't know) that the "mainline" drivers were used in 3.x and 4.x Linux.

The Link in my post (above) links to the post detailing one of the problems I had with SPI. Those problems weren't in the SPI driver itself, but in the "platform setup" code that controlled the master clock power modes. As detailed in my post, in 2.6.35 this was set in "arch/arm/mach-mx5/system.c". I have no idea how this is set up in 4.4 and on the i.MX6 (this stuff tends to move around), but suggest you check the i.MX53 and i.MX6 Reference Manuals, find the equivalent control registers and search for any code in 4.4 doing the same thing.

This is unlikely to be related to your problem.

> there us a drift in CS line

What do you mean by that? "Drifting" in level up and down or time early and late? You can expect a lot of variation in time as they're being driven as GPIOs in software. In this post there's a clock glitch, and sometimes I think it said the chip-select was too late and happened after the eCSPI had started clocking:

https://community.nxp.com/thread/386935#comment-625531

The "7 or 8 pulses" is just plain weird. something seriously wrong there.

Tom

0 Kudos
Reply

14,073 Views
igorpadykov
NXP Employee
NXP Employee

Hi Anand

one can check ECSPIx_CONREG[BURST_LENGTH] value described in

sect.20.7.3 Control Register (ECSPIx_CONREG) i.MX6UL Reference Manual

and that during transmitting burst fifo was not empty.

http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6ULRM.pdf

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

0 Kudos
Reply

14,073 Views
anandkrs
Contributor I

Thanks igor for your reply

Just wanted to know before trying that, is the vaule of ECSPIx_CONREG[BURST_LENGTH] is related to the clock issue ?

 

Regards

Anand

0 Kudos
Reply