i.MX28 SPI Slave on Windows CE

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

i.MX28 SPI Slave on Windows CE

1,288 Views
salvatorepenna
Contributor I

HI,

I have some problem to let SPI  ( SSP2 )  to work in slave mode on i.MX28 board under Windows CE 6.0

I have an SPI device that send data at ~4 MHz, and I see the data and the clock on the correct Pin when the SS goes down.

I try to configure the SPI in slave mode and I try to  poll the FIFO_EMPTY bit of the SSP_STATUS register and then read the actual data from the SSP_DATA register.

Unfortunately I the FIFO_EMPTY is always set, so I can't read anything...

Here are the register configuration:

SSP: SSP_CTRL0        = 0x2b000000

SSP: SSP_CTRL1        = 0x9f1

SSP: SSP_TIMING       = 0xffff0800

SSP: SSP_XFER_SIZE    = 0x1

the status register contains always:

SSP: SSP_STATUS       = 0xe0000020  

This is the portion of code that I use for the SPITransfer:

  HW_SSP_CTRL0_CLR(m_Index,BM_SSP_CTRL0_SFTRST | BM_SSP_CTRL0_CLKGATE);

  HW_SSP_DATA_WR (m_Index, 0xFFFFFFFF);

  HW_SSP_CTRL1_SET(m_Index, BM_SSP_CTRL1_SLAVE_MODE);

  HW_SSP_CTRL1_SET(m_Index, BM_SSP_CTRL1_SLAVE_OUT_DISABLE);

  HW_SSP_CTRL0_SET(m_Index,BM_SSP_CTRL0_READ);

  HW_SSP_CTRL0_SET(m_Index,BM_SSP_CTRL0_DATA_XFER);

  HW_SSP_XFER_SIZE_WR(m_Index,1);

  HW_SSP_CTRL0_SET(m_Index,BM_SSP_CTRL0_RUN);

  count = 10000;

  while(( ( HW_SSP_CTRL0_RD(m_Index) & BM_SSP_CTRL0_RUN)  == 0 ) && count--)

  continue;

  if (count <= 0) {

  RETAILMSG (1, (L"SPI:>> Timeout on Line \r\n"));

  break;

  }

  count = 100000;

  while (count-- && ((HW_SSP_STATUS_RD(m_Index) & BM_SSP_STATUS_FIFO_EMPTY) != 0))

  continue;

  if (count <= 0) {

  RETAILMSG (1, (L"SPI:>> Timeout on RX FIFO \r\n"));

  break;

  }

  tmp = (UINT16)(HW_SSP_DATA_RD(m_Index) & 0xFFFF);

Any suggestions / help ?

Thanks in advance !!!

Labels (2)
0 Kudos
1 Reply

597 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Deactivated user can you  help on this case?

0 Kudos