imx8mp ECSPI1 SCLK is not continuous

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

imx8mp ECSPI1 SCLK is not continuous

18,822 Views
arunlee
Contributor II

Hi,

We have an im8mp board (solidrun) based HW running yocto zeus. I am trying to configure the ecspi1 to use BME280 sensor.

Here is my device tree configuration:

From imx8mp.dtsi:

 

 

                        ecspi1: spi@30820000 {
                                #address-cells = <1>;
                                #size-cells = <0>;
                                compatible = "fsl,imx8mp-ecspi", "fsl,imx6ul-ecspi";
                                reg = <0x30820000 0x10000>;
                                interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
                                clocks = <&clk IMX8MP_CLK_ECSPI1_ROOT>,
                                         <&clk IMX8MP_CLK_ECSPI1_ROOT>;
                                clock-names = "ipg", "per";
                                assigned-clock-rates = <80000000>;
                                assigned-clocks = <&clk IMX8MP_CLK_ECSPI1>;
                                assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>;
                                dmas = <&sdma1 0 7 1>, <&sdma1 1 7 2>;
                                dma-names = "rx", "tx";
                                status = "disabled";
                        };

 

 

From imx8mp-hummingboard-pulse.dts

 

 

&ecspi1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;
        cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
        status = "okay";

        spidev@0x00 {
            compatible = "linux,spidev";
            reg = <0>;
            spi-max-frequency = <10000000>;
            status = "okay";
        };

        pinctrl_ecspi1: ecspi1grp {
                fsl,pins = <
                        MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK           0x06
                        MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI           0x06
                        MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO           0x06
                        MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09             0x86
                >;
        };

 

 

 

I get the spidev

 

 

 

lrwxrwxrwx  1 root root 0 Nov 24 10:05 spidev1.0 -> ../../devices/platform/soc@0/30800000.bus/30820000.spi/spi_master/spi1/spi1.0/spidev/spidev1.0
root@vision-platform:~# ls /dev/spidev1.0
/dev/spidev1.0
root@vision-platform:~#

 

 

 

I am trying the spi_fdx.c adapted to the device address for BME280.

What i am seeing is that as soon as the address byte is sent out the SCLK is stopped, which makes the BME280 unable to send any data back.

arunlee_0-1638180780766.png

 

 

What do i need to change in the device configuration so that the CLK is active as long as the CS is low?

 

regards

Arun

 

Tags (2)
0 Kudos
17 Replies

18,673 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee What is the address byte sent out ? Does CS pin return to idle state at the same time? If you set master to send 5 bytes data, master will send 5, even there is no slave device connected on the spi bus. The master will just receive 0x0 or 0xff in this case. 

0 Kudos

18,747 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee Can you please try the latest BSP as SPI DMA is supported from 5.10. Alternatiively, you can also try the INT mode.

0 Kudos

18,736 Views
arunlee
Contributor II

@kshitij_shah  is there a known issue with 5.4? ecspi2 is working fine though

0 Kudos

18,702 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee Can you please keep pad settings as ecspi2, such as:

pinctrl_ecspi1: ecspi1grp {
                fsl,pins = <
                        MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK           0x82
                        MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI           0x82
                        MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO           0x82
                        MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09             0x40000
                >;
        };

 

0 Kudos

18,675 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee Can you please provide all changes made by you including spi_fdx.c/dts and any other changes. We will try to reproduce issue. Also the test command used.

0 Kudos

18,688 Views
arunlee
Contributor II

There is no change in behavior. In fact i had started with these as you have mentioned before ending up with what i pasted in the query.

I am afraid there is something in solidrun SoM which makes this behavior. escpi2 works fine with the same configurations.

0 Kudos

18,670 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee Please provide following:

Please help to get:

1. Kernel version they use

2. Changes to kernel

3. Their test case/ command

4. Any special settings like CPOL/CPHA/CS_POL_HIGH/Bit per word...

5. Which mode did they use, PIO or DMA mode?

6. How much data did you send every time?

Do they see any logs when encounter the issue?

0 Kudos

18,666 Views
arunlee
Contributor II

1. Kernel version they use

  5.4.70-2.3.0

2. Changes to kernel

Solidrun Yocto layer: https://github.com/SolidRun/meta-solidrun-arm-imx8/tree/zeus-imx8mp

Solidrun doesn't use ecspi1 at all. even in the hummingboard they have used escpi2.

3. Their test case/ command

4. Any special settings like CPOL/CPHA/CS_POL_HIGH/Bit per word...

5. Which mode did they use, PIO or DMA mode?

6. How much data did you send every time?

To the above meta layer we have added the following changes in device tree for ecspi1 and enabled bmp280 kernel driver.

&ecspi1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
/*cs-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;*/
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

bmp280@0 {
compatible = "bosch,bmp280";
reg = <0x0>;
spi-max-frequency = <500000>;
default-oversampling = <1>;
status = "okay";
};

};

        pinctrl_ecspi1: ecspi1grp {
                fsl,pins = <
                        MX8MP_IOMUXC_ECSPI1_SCLK__ECSPI1_SCLK           0x82
                        MX8MP_IOMUXC_ECSPI1_MOSI__ECSPI1_MOSI           0x82
                        MX8MP_IOMUXC_ECSPI1_MISO__ECSPI1_MISO           0x82
                        MX8MP_IOMUXC_ECSPI1_SS0__GPIO5_IO09             0x40000
                >;
        };

Default bmp280 driver tries to read the address 0xD0 to know the chip id.

Do they see any logs when encounter the issue?

Driver failed in probe. The driver is expecting a value of 0x58 instead gets only 0xFF

0 Kudos

18,636 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee did a test on 8mp, and I haven't found any problems so far. I tested it with spidev_test, this is the waveform of the test. The transmission of both modules is normal. The CS line is also normal. Please confirm that the connection between MISO and MOSI and the slave is correct. Also, can you test it with imx8mp ?

0 Kudos

18,621 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee Attached is the waveform generated for imx8mp. Also looking at your waveform, the MISO does not have data on line. Or the MISO looks is set as Open Drain? The rising edge is so slow.

0 Kudos

18,610 Views
arunlee
Contributor II

@kshitij_shahcould you please try transfering more than 2 bytes (1k bytes) and share the wave forms?

Tags (1)
0 Kudos

18,516 Views
kshitij_shah
NXP Employee
NXP Employee

MicrosoftTeams-image (2).png

@arunlee Attached is the waveform. Also, the waveform provided by you, the data sent by the host's three wires (MOSI, SCK, CS) are all correct.

0 Kudos

18,639 Views
kshitij_shah
NXP Employee
NXP Employee

@arunlee  Can you provide a patch for any changes made to kernel. Also, what platform are you using to test ecspi1, as i noticed you say hummingboard uses ecspi2 ?

0 Kudos

18,611 Views
arunlee
Contributor II
0 Kudos

18,764 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos

18,743 Views
arunlee
Contributor II

Thanks @igorpadykov I will try out stuff from those links. But what is puzzling me is that ecspi2 works fine without any modifications. All we need to do was to make the ECSPI2_SSO as a output by modifying the GPIO register.

0 Kudos

18,775 Views
arunlee
Contributor II

I tried using the kernel driver for bm3280, and the driver failed in probe with FF received from the device.

Nov 30 09:19:23 vision-platform kernel: spi_imx 30820000.spi: probed
Nov 30 09:19:23 vision-platform kernel: bmp280 spi0.0: spi0.0 supply vddd not found, using dummy regulator
Nov 30 09:19:23 vision-platform kernel: bmp280 spi0.0: spi0.0 supply vdda not found, using dummy regulator
Nov 30 09:19:23 vision-platform kernel: bmp280 spi0.0: bad chip id: expected 60 got ff
Nov 30 09:19:23 vision-platform kernel: bmp280: probe of spi0.0 failed with error -22

The signal looks the same that there is no clock persisting.

Any help in fixing this would be really helpful. A simple SPI device is not working through ecspi1.

0 Kudos