AnsweredAssumed Answered

How to design the i.MX27 work as the slave mode

Question asked by wason on Oct 16, 2013

Hi,

I want to configure spi1 in slave mode in Linux 2.6.19.2 for i.mx27. That is I am using an i.mx27 board as a SPI MASTER and other board as a SLAVE to communicate with each other.

I adopt the 3-wire link each other such as master MOSI<->slave MOSI , master MISO<-> slave MISO  and master CLK->slave CLK . The master SPI only send the data and slave SPI only receive the data..

According to the SPI device and driver of the i.MX27 we only change the master to the SLAVE of the MODE bit in the CONREG Register in Linux and tranfer same 8bit every time at about 8*1000*1000 bauterate .

The master mode work well where the mosi pin can transfer the data and the clk pin can get the clock .But the SLAVE mode can’t work and the i.mx27 cannot react the interrupt and still only stay in the spi_put_tx_data function state and can not go to the receive mode in which the processor is  be the slave mode.

Follow is the debug informations:

 

cmd->port is 1

The SPI is 1 and the fd is 4

spi_bitbang :bitbang_work

mxc_spi :mxc_spi_chipselect

The origin mxc_spi_chipselect control register is 1024

The origin mxc_spi_chipselect control registre masked is 1024

mxc_spi :spi_find_baudrate The SPI probe as slave and work mode is SPI_MODE_0.

The mxc_spi_chipselect control register is 66567

mxc_spi :mxc_spi_transfer

mxc_spi :spi_enable_interrupt

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_get_rx_data

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

       mxc_spi :mxc_spi_isr

       mxc_spi :spi_put_tx_data

 

The SPI can only inturrupt to receive once and later transfer the data.  I donot know why the slave can't receive anything.

I do't know where I forget or make mistake to change both software and the hardware. So In order to work in slave mode can any body provide me some link.

Or how to update i.mx27 spi device file and driver file.

Outcomes