AnsweredAssumed Answered

ad7928 connect  ADSP21369 with spi

Question asked by tracy on Mar 17, 2011
Latest reply on Mar 22, 2011 by DeepV

hello friends

 

i design a system using ad7928 collect the data.

now the spiclk , mosi and cs has signals,but the miso cann't catch the signal.it always high.

 

below is my functions.


    SRU(SPI_MOSI_O,DPI_PB01_I)      //Connect MOSI to DPI PB1.
    SRU(DPI_PB02_O, SPI_MISO_I)     //Connect DPI PB2 to MISO.
    SRU(SPI_CLK_O, DPI_PB03_I)      //Connect SPI CLK to DPI PB3.
    SRU(SPI_FLG0_O, DPI_PB04_I)     //Connect SPI FLAG3 to DPI PB4.
    //---------------------------------------------------------------------------
    // Tie pin buffer enable from SPI peipherals to determine whether they are
    // inputs or outputs

 

    SRU(SPI_MOSI_PBEN_O, DPI_PBEN01_I);
    SRU(SPI_MISO_PBEN_O, DPI_PBEN02_I);
    SRU(SPI_CLK_PBEN_O, DPI_PBEN03_I);
    SRU(SPI_FLG0_PBEN_O, DPI_PBEN04_I);

 

void SPITransmit(int val)
{
     *pTXSPI = val;
     Delay(10);

 

    //Wait for the SPI to indicate that it has finished.
    while (1)
    {
        if (*pSPISTAT & SPIF)
            break ;
    }
    Delay (10) ;
}

 

void adcommand()

{

       SPITransmit(0xff);
     SPITransmit(0xff);
      
       SPITransmit(0xff);
     SPITransmit(0xff);   

 

    SPITransmit(0x3f);
     SPITransmit(0x08);

}

 

//ad7928
void SPIisr (void)
{
     int ad_temp=0,temp=0,temp1,ad_temp1=0;

 

    temp++;

 

    SPITransmit(0x3f);
    SPITransmit(0x00);   
   
    //ad_temp = ;
//    ad_temp1= *pTXSPI;
    ad_temp = *pRXSPI;

}

 

now i can go into the interrupt,but the value of  *pRXSPI always  zero, but the pin is high!!!!!

 

 

thanks

tracy

Outcomes