SPI SLAVE MODE

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

SPI SLAVE MODE

3,440 次查看
devendra_yarama
Contributor I

Hi, 

I am using the imx8 in my project, with two spi controllers i.e ECSPI1 & ECSPI2. After checking imx6 spi controller source code i came to know that spi controller can be configured in slave mode,now i want implement same feature in imx8 also i.e ECSPI1 as master , ECSPI2 as a slave device and vice versa. Then i added the patch file provided in the below link [v2,8/8] spi: imx: Add support for SPI Slave mode for imx53 and imx6 chips - Patchwork for spi slave support in imx8. Compiled the source code successfully.

For transmitting the data from master and slave side i am using spidev_test application but facing problem while receiving the data.some time slave receiving it's own transmitting data instead of master transmitted data, other cases it' getting junk data.

Kernel_version:4.14.98

Spi connections:

ECSPI1                     ECSP2

MOSI ------------------> MOSI

MISO ------------------>MISO

SS      ------------------>SS

SCLK  ------------------->SCLK                        

 can you confirm my hardware connections and provide me the correct test procedure and commands to be applied in master and salve side.provide me the slave controller clock settings and other configurations to be done for salve mode.

NOTE: If it's not validated in imx8 then consider for imx6.i am not sure about the master and slave testing procedure, followed below test procedure   Serial peripheral interface (SPI) 

    Regards,

     Devendra

0 项奖励
回复
2 回复数

3,228 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi DEVENDRA,

1. You connections are no problem.

2. Issues on SPI Slave mode

On slave mode, it has been described in spi driver, drives/spi/spi-imx.c

...

    /* ecspi has a HW issue when works in Slave mode,
     * after 64 words writtern to TXFIFO, even TXFIFO becomes empty,
     * ECSPI_TXDATA keeps shift out the last word data,
     * so we have to disable ECSPI when in slave mode after the
     * transfer completes
     */
    if (spi_imx->devtype_data->disable)
        spi_imx->devtype_data->disable(spi_imx);

...

Therefore, please use other methods to test your eCSPI interface and configure eCSPI to work in Master mode.

Hope above information is helpful for you.

Have a nice day!

B.R,

Weidong

0 项奖励
回复

3,228 次查看
devendra_yarama
Contributor I

Hi Weidong,

Thank you for your Response,i applied the NXP patch in that slave

disable after 64 words transfer support is there.As you mentioned please

use other methods to test your eCSPI interface and configure eCSPI to

work in Master mode , can you provide the test procedure for SPI master

and slave mode testing.

Thanks & Regards,

Devendra

0 项奖励
回复