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.

ADS1299 Problem with register value reading

Other Parts Discussed in Thread: CC2541, ADS1299

Hello,

1. I am trying to use CC2541 to send register read command to ADS1299, but it seems i can't read the register data back correctly.

Could someone help to check my code please?

What could be the reason?

void ads1299_read_reg(uint8 ADR, uint8 *register_data)
{

CS_ADS = 0;


spiWriteByte(_RREG|ADR);

us_delay(5);


spiWriteByte(0x00);
us_delay(5);

spiReadByte(register_data, 0xFF);  
us_delay(5);

CS_ADS = 1;
}

void spiReadByte(uint8 *read, uint8 write)
{
U0CSR &= ~0x02; // Clear TX_BYTE
U0DBUF = write;
while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set
*read = U0DBUF;

}

void spiWriteByte(uint8 write)
{
U0CSR &= ~0x02; // Clear TX_BYTE
U0DBUF = write;
while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set
}

2. Another question is every time after i set the START pin to high, even the ADS is not powered up, i still could read data from ADS on SPI, Is this normal?

The reason i ask this question is i can't find out what kind of data i will be reading in this way. 

Thanks a lot.

  • Hello Shiping,

    Do you have a logic analyzer or oscilloscope to capture the SPI signals while you are trying to read the registers? This will be the easiest way to debug the problem.

    Regards,
    Brian Pisani
  • Hi Brian,

    Thanks for replying.

    Yes, i have oscilloscope and i checked the voltage according each instruction in power up. Also i check on SPI the signal i sent to ADS. They were correct.
    But after i sent the register read command, it still only send all 0 back on SDO_ADS.

    So i am think about maybe i didn't power it up correctly or there is some other problems.

    How can i verify whether ADS is powered up correctly? Any suggestion?
    The way i use is trying to read register value back, but all i got are 0.

    Thanks.

    void ads1299_set_up(void)
    {
    START_ADS = 0;

    ms_delay(1); //internal oscillator

    PWDN_ADS = 1;
    RESET_ADS = 1;
    ms_delay(200);

    RESET_ADS = 1;
    us_delay(5);
    RESET_ADS = 0;
    us_delay(5);
    RESET_ADS = 1;
    us_delay(20);
    }

    Also i post my code to power the ADS up, could you please check it for me?
  • Shiping,

    Can you post the images of the signals here? The vast majority of communication issues come down to an error in the SPI sequencing that can easily be identified in the image. Indeed it is easier than evaluating code since code issues could involve a large number of different things.

    Brian
  • Brian

    Sure,

    when I send read register command (0010 0000, 0000 0000, 0xFF) to read ID register. I still can't detect any data back on DOUT.

    Yellow is for DIN, blue is for SCLK.

    same capture

    the picture below is for DOUT and SCLK, DOUT has nothing.

    Is my DIN timing correct? What could be the reason?

    Thanks a lot.

  • Thanks Brian,

    Finally it works, actually it's because i forgot to mute another GPIO interrupt in my code, it always go to that ISR. after i mute it, i could capture the right signal on SPI.

    Thank you very much!