This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ezdsp C5515 SPI interfacing problem with ADS1255

Other Parts Discussed in Thread: ADS1255

Hi,

I am trying to interface the ADS1255 with the C5515 ezDSP board. The ADC generates a falling-edge trigger each time the data is ready, this trigger is used to generate a GPIO interrupt on the DSP. The ISR for the GPIO interrupt looks like this

    IRQ_disable(GPIO_EVENT);
   
    // Check for GPIO Interrupt Flag Register
    if((1 == GPIO_statusBit(hGpio,CSL_GPIO_PIN13,&status)))
    {
        //Clear GPIO Interrupt Flag Register
        GPIO_clearInt(hGpio,CSL_GPIO_PIN13);
       
        CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CLEN, 7);
   
        {   
            CSL_SPI_REGS->SPIDR1 = 0;
            CSL_SPI_REGS->SPIDR2 = 0;
            CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD,
                                    CSL_SPI_SPICMD2_CMD_READ);
           
            for(delay = 0; delay < SPI_READ_DELAY; delay++);
   
            do
            {
                spiStatusReg = CSL_SPI_REGS->SPISTAT1;
                spiBusyStatus = (spiStatusReg & CSL_SPI_SPISTAT1_BSY_MASK);
                spiWcStaus = (spiStatusReg & CSL_SPI_SPISTAT1_CC_MASK);
            }while((spiBusyStatus == CSL_SPI_SPISTAT1_BSY_BUSY) &&
                    (spiWcStaus != CSL_SPI_SPISTAT1_CC_MASK));
   
            CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD,
                                    CSL_SPI_SPICMD2_CMD_READ);
           
            for(delay = 0; delay < 100; delay++);
   
            do
            {
                spiStatusReg = CSL_SPI_REGS->SPISTAT1;
                spiBusyStatus = (spiStatusReg & CSL_SPI_SPISTAT1_BSY_MASK);
                spiWcStaus = (spiStatusReg & CSL_SPI_SPISTAT1_CC_MASK);
            }while((spiBusyStatus == CSL_SPI_SPISTAT1_BSY_BUSY) &&
                    (spiWcStaus != CSL_SPI_SPISTAT1_CC_MASK));
   
            spi_val[0] = (CSL_SPI_REGS->SPIDR1);
   
            CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD,
                                    CSL_SPI_SPICMD2_CMD_READ);
           
            for(delay = 0; delay < 100; delay++);
   
            do
            {
                spiStatusReg = CSL_SPI_REGS->SPISTAT1;
                spiBusyStatus = (spiStatusReg & CSL_SPI_SPISTAT1_BSY_MASK);
                spiWcStaus = (spiStatusReg & CSL_SPI_SPISTAT1_CC_MASK);
            }while((spiBusyStatus == CSL_SPI_SPISTAT1_BSY_BUSY) &&
                    (spiWcStaus != CSL_SPI_SPISTAT1_CC_MASK));
   
                   
            spi_val[1] = (CSL_SPI_REGS->SPIDR2);
        }
       
        printf("ADC: %x,%x\n",spi_val[0],spi_val[1]);
    }
    IRQ_enable(GPIO_EVENT);

The output on the debug console looks like this

ADC: 97fd,fd97
ADC: a0fd,fda0
ADC: a3fd,fda3

Somehow I am only receiving two bytes from the ADC, and those too get reversed in the SPIDR2. Is there something wrong in my approach of reading data off the SPI bus?

Thanks!

Mayank