lpspi0 of imx8dxp in the linux is used as the slave controller

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

lpspi0 of imx8dxp in the linux is used as the slave controller

1,063 次查看
changshui
Contributor I

Hello, I encountered a problem when using lpspi0 of imx8dxp as a slave controller in linux. The linux kernel build by Yocto, uses NXP i.MX Release Distro 5.4-zeus.

Connected to lpspi0 is an MCU spi controller pin, there is a 100R resistor between the two chip's spi pins connected. MCU spi controller as master, and sends messages periodically. 

Device tree set as follow(only the relevant parts are listed):

pinctrl_lpspi0: lpspi0grp {
    fsl,pins = <
        IMX8QXP_SPI0_CS0_ADMA_SPI0_CS0   0x0600004c
        IMX8QXP_SPI0_SCK_ADMA_SPI0_SCK  0x0600004c
        IMX8QXP_SPI0_SDI_ADMA_SPI0_SDI     0x0600004c
        IMX8QXP_SPI0_SDO_ADMA_SPI0_SDO 0x0600004c
    >;
};

&lpspi0 {
     #address-cells = <0>;
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_lpspi0>;
     status = "okay";
     /* as a slave mode */
    spi-slave;
    slave {
        compatible = "rohm,dh2228fv";
    }
};

Now I can find the correct device node in /dev directory, but in user space open /dev/spidev0.0 node calls kenel space read interface of spidev.c sync to read the message, the read result is all 0.

Observe each signal pin through an oscilloscope. When the user space program is not running, the signal of the MOSI pin is normal(about 3.3V). When the user space test program is run, the signal level of the MOSI pin is about 300mv, but MCU's MOSI pin is correct.( there is a 100R resistor between the two pins connected.)

The strange thing is that the CS and SCLK signals are correct regardless of whether the user space program is running or not.

I have tried to modify the pin configuration status of lpspi0 of imx8dxp, but it has no effect. Can any friends provide some solutions? Thank you very much !

0 项奖励
回复
1 回复

1,057 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Hu

 

one can connect two boards, configured one as master other as slave, use slave dts :

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8qxp-lpdd...

 

Best regards
igor

0 项奖励
回复