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.

ADS1148-Q1: ADS1148-Q1 SPI Configured properly(verified by reading configured registers), but can't able to get data on DOUT(MISO) pin.

Part Number: ADS1148-Q1


1. Waveforms for SCLK, CS, MOSI(DIN) are verified for data getting transferred.

2. As all adc input channels of ads1148-q1 can act as GPIO also, so configured AIN7 pin as gpio. Can able to turn ON/Off Led connected to pin AIN7 through program.

3. Code is as per pseudo code given in datasheet.

4. Can't able to get data on DOUT pin, what could be the reason? please help me with this, thanks in advance.

My code is as below:

int main(void)
{
    uint8_t high_byte;
    uint8_t low_byte;
    uint16_t adc_data;
    uint8_t data_ready;

    uint8_t received_val = 0;
    init_USART1(9600);
    GPIO_config();

    //Reset low to high
    GPIO_ResetBits(GPIOC, GPIO_Pin_12); //RESET is Low
    Delay_ms(10);
    GPIO_SetBits(GPIOC, GPIO_Pin_12);    //RESET is High

    /************************** Steps ***************************/
    Delay_ms(16);
    init_SPI1();    //SPI Initialization

    GPIOE->BSRRH |= GPIO_Pin_7; //set PE7 (CS) low
    Delay_ms(16);        //minimum delay of tcssc*/
    SPI1_send(0x06);    //RESET command
    Delay_ms(1);
    SPI1_send(0x16);    //SDATAC Command

    SPI1_send(0x40);
    SPI1_send(0x0E);
    SPI1_send(0x01);    //MUX0
    SPI1_send(0x00);    //VBIAS
    SPI1_send(0x30);    //MUX1
    SPI1_send(0x52);    //SYS0
    SPI1_send(0x00);    //OFC0
    SPI1_send(0x00);    //OFC1
    SPI1_send(0x00);    //OFC2
    SPI1_send(0x00);    //FSC0
    SPI1_send(0x00);    //FSC1
    SPI1_send(0x00);    //FSC2
    SPI1_send(0x06);    //IDAC0
    SPI1_send(0x89);    //IDAC1
    SPI1_send(0x80);    //GPIOCFG
    SPI1_send(0x00);    //GPIODIR
    SPI1_send(0x80);    //GPIODAT
    GPIOE->BSRRL |= GPIO_Pin_7;     //set PE7 (CS) high
    Delay_us(10);

    //Read all registers
    GPIOE->BSRRH |= GPIO_Pin_7;     //set PE7 (CS) low

    SPI1_send(0x20);    //Read starting from address 0
    SPI1_send(0x0E);    //Read 0xE + 1 = 15 bytes
    uint8_t MUX0 = SPI1_send(0xFF);        //Read Mux0
    uint8_t VBIAS = SPI1_send(0xFF);
    uint8_t MUX1 = SPI1_send(0xFF);
    uint8_t SYS0 = SPI1_send(0xFF);
    uint8_t OFC0 = SPI1_send(0xFF);
    uint8_t OFC1 = SPI1_send(0xFF);
    uint8_t OFC2 = SPI1_send(0xFF);
    uint8_t FSC0 = SPI1_send(0xFF);
    uint8_t FSC1 = SPI1_send(0xFF);
    uint8_t FSC2 = SPI1_send(0xFF);
    uint8_t IDAC0 = SPI1_send(0xFF);
    uint8_t IDAC1 = SPI1_send(0xFF);
    uint8_t GPIOCFG = SPI1_send(0xFF);
    uint8_t GPIODIR = SPI1_send(0xFF);
    uint8_t GPIODAT = SPI1_send(0xFF);
    GPIOE->BSRRL |= GPIO_Pin_7;     //set PE7 (CS) high

    GPIOE->BSRRH |= GPIO_Pin_7;     //set PE7 (CS) low
    SPI1_send(0x04);                //SYNC Command
    Delay_us(10);                    //delay >tsccs

    //GPIO_ResetBits(GPIOC, GPIO_Pin_12);    //RESET High
    //Delay_ms(10);
    while(1)
    {
        GPIO_SetBits(GPIOE, GPIO_Pin_14);    //START is High
        Delay_ms(10);
        GPIO_ResetBits(GPIOE, GPIO_Pin_14);    //START is Low

        data_ready = 0x01;
        Delay_ms(1);
        while (data_ready == 0x01)
        {
            data_ready = GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_11);
        }

        GPIOE->BSRRH |= GPIO_Pin_7;     //set PE7 (CS) low

        Delay_ms(7);

        SPI1_send(0x12);                //RDATA Command

        //Delay_ms(1);

        high_byte = SPI1_send(0xFF);
        low_byte = SPI1_send(0xFF);

        /*SPI1_send(0xFF);
        high_byte=SPI_I2S_ReceiveData(SPI1);
        SPI1_send(0xFF);
        low_byte=SPI_I2S_ReceiveData(SPI1);*/

        Delay_ms(20);

        GPIOE->BSRRL |= GPIO_Pin_7;     //set PE7 (CS) high

        adc_data = (((uint16_t) high_byte) << 8) | ((uint16_t) low_byte);

        USART_SendData(USART1, adc_data);
    }

    while(1);
    return 0;
}