AnsweredAssumed Answered

SPI1 (Slave mode) doesn't send data out on MISO

Question asked by James007 on May 23, 2017
Latest reply on May 31, 2017 by Jithul_Janardhanan

Hi,

I wrote a very simple code (see the attachment & below) for the BF703's SPI1 interface:

  • Configure the BF703 SPI1 as Slave, 16 bits word
  • Send 0x55F1 back to the Master SPI after it receives data from the Master SPI.

 

The code receives data from the Master SPI correctly, but it doesn't send anything back to the Master SPI.  For some reasons, the MISO signal of the SPI1 stays high the whole time.  Could you please have a look?

 

void Init_SPI1(void)
{
    *pREG_SPI1_CLK     = 0X0F;
    *pREG_SPI1_DLY     = 0x0;
    *pREG_SPI1_SLVSEL= 0x0;

 

    *pREG_SPI1_CTL      = ENUM_SPI_CTL_SLAVE | ENUM_SPI_CTL_SIZE16;
    *pREG_SPI1_TXCTL = ENUM_SPI_TXCTL_ZERO;
    *pREG_SPI1_RXCTL = ENUM_SPI_RXCTL_RTI_EN;

 

    *pREG_SPI1_TXCTL |= ENUM_SPI_TXCTL_TX_EN;    //    enable Tx SPI
    *pREG_SPI1_RXCTL |= ENUM_SPI_RXCTL_RX_EN;    //    enable Rx SPI
    *pREG_SPI1_CTL      |= ENUM_SPI_CTL_EN;
}

 

int main(int argc, char *argv[])
{

    unsigned int RxData;
    adi_initComponents();

 

    *pREG_PORTA_DIR = 0x0000DE8A;
    *pREG_PORTA_FER = 0x00001FF7;
    *pREG_PORTA_INEN = 0x00002060;
    *pREG_PORTA_MUX = 0x03AAA0000;
    *pREG_PORTA_POL = 0x0;

 

    Init_SPI1();

 

    while (1)
    {
        if ( (*pREG_SPI1_STAT & 0x7000) >= 0x1000)
        {
            RxData = *pREG_SPI1_RFIFO;
            *pREG_SPI1_TFIFO = 0x55F1;
        }

 

    }
    return 0;
}

Attachments

Outcomes