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.

ADS1263: SPI Communication with ADS1263 and ATxmega256a3bu

Part Number: ADS1263

Hello,

i'm using the ADS1263 with the atxmega256a3bu microcontroller. I got now problems to configure the SPI communication.

(I've added the schematics in the attachments.)

The problem is, that i cant get any signal at the MISO(DOUT/DRDY) line. 

Im using Spi_mode1, 500kHz and i'm reading directly from the ADC like describted in the datasheet of the ADS1263 on page 68.

Now the problem is, that my DRDY pin (which to synchronisize with) never gets low, even if i toggle the reset-pin for 1s (sleep mode <9ms or so), the DRDY Pin stays always high.

Is it an indication for that the ADS1263 is broken or are there any mistakes in the schematics?

In my C-Code, i pull the CS and MOSI(DIN) line permanently low, and the start pin always high. Than i wait with:

while(!(PORTA.IN & 0x10));

for getting DRDY low (PortA - pin4), to read 6 Bytes (1 Status 4 Data 1 CRC Byte) afterwards and putting them in an array.

But like already mentioned, DRDY never goes low, and the microcontroller stucks in the while loop.

What can i do?

I will be thankful for every reply on this post.

Mikrokontroller_ATXmega256A3BU_Schaltplan.pdfADS1263 + MCxmega.rar

  • Hi Ratimir,

    Welcome to the TI E2E forums!

    Before debugging the SPI communication I would focus on the /DRDY issue. When the ADC is converting, you should see /DRDY pulsing at regular intervals (1/data rate, to be exact). If /DRDY is not pulsing it could be an indication of one of the following problems:

    1. The ADC is not properly powered.

    Looking at your schematic, I didn't see an obvious place to connect the power supply(ies) ground to the GND of the ADC board, particularly if you're using a bipolar supply. If however, you're using the unipolar supply mode (AVDD = 5V and AVSS = 0V), you could connect all of your supply grounds to AVSS...I would double check that your supplies are properly connected and the ADC is powered.

     

    2. The ADC does not have a clock signal.

    You're using the internal oscillator (XTAL1 connected to GND), so this shouldn't be an issue.

     

    3. The ADC is in power-down mode or is not converting.

    Check the logic levels of the PWDN and START pins. Both pins should be high to activate the device.

     

    4. The ADC may be damaged if all of the above conditions are meet, but still no /DRDY signal is seen.

    I would suggest probing the /DRDY signal with an oscilloscope to check if it is toggling, just in case the microcontroller is not registering the /DRDY low condition.

     

    Another note, if you're jumper wiring the MCU board to the ADC board, make sure to keep the jumper wires short and close together to avoid excessive inductance on the SPI signals. Also, don't forget to connect the PCB grounds together (...I have forgotten to make this connection!).
     

    Best Regards,
    Chris

  • Hello Chris,

    first, thank you for your response and help.

    The ADC works - or kind of. I can read and write the register of the ADC. I checked it with the Debugger and an Osci.

    Now, when i try to read the values of the inputs, it reacts to the input voltage (it change the digits and i can see something happening at the Osci when i put on the volatage). But the value seems to be false.

    When I put the voltage to 0 Volts, i expect the data to be about 0 too. But this is never the case. All values seem not to match. 

    Here is how i do my code after initializing, enabling clock, chipselect permanently low, SPI (***, 500000Hz, Mode1, Mastermode) and USART (USARTE0, 9600 Baud, 8N1) - i know that both are working fine. 

    int main {

    uint8_t RX[6].. // receive Buffer

    ..blablabla init, spi, usart, board_config blablabla..

    start_adc; // Sending start command 

    while(1){

    read_ADC(); // sending read command

    spi_read_packet(&***, RX,6)  // spi_read_packet (volatile avr32_spi_t *spi, uint8_t *data, size_t len)

    // RX[0] should be status byte?

    //RX[1-4] data bytes?

    //RX[5] CRC byte

    for(int i=0; i < 4;i++)

    {

    uint32_t adc32_raw |= RX[i+1] << ((3-i)*8); // Putting Data Bytes to a 4 Byte integer value

    //Example: x =1232; char first = (x/1000) would be 1232/1000 = 1 (first digit)

    // than i would to like: 1232 - 1*1000 = 232

    // 232/100 = 2 (second digit) .. and so on

    //than i add +48 or 0x30 for ASCII Code 0-9

    for (int i = 0;i<=9;i++)

    {

    char c[i+i] = adc32_raw/(10^(9-i)); // I can only send chars over usart, so i divide the  32-Bit value into seperat digits like in example above

    }

    for(int i = 0; i<10;i++)

    {

    usart_putchar(c[i]+48);

    }

    delay_ms(500); // wait a bit for next loop

    }

    }

    DRDY works, CS, works, SPI works,.. all works.. but my data is never like it should be at my terminal (putty). I tried the same with just the direct mode:

    Here i set the start-pin permanantly high, and do like 

    while(1){

    while(PORTA.IN & DRDY_PIN); // wait for Data ready to be low, so data is new and ready to read

    spi_read_packet(&***, RX,6);

    }

    But the values are still wrong. Maybe i doing something wrong in the order of the communication?

    Thank you,

    Ratimir

  • Hi Ratimir,

    Does the SPI data look okay on the oscilloscope?

    It can be hard to debug the problem when your data is going through so many different stages (SPI communication, C post-processing, ASCII encoding, UART communication, terminal display & decoding). If you can go through each stage independently (for example, looking at the raw SPI data on an oscilloscope) it can help you determine where the issue might be.

    NOTE: Due to noise and the two's-compliment data format, a 0V input will provide results close to 0x00000000 and 0x80000000 Correction: 0xFFFFFFFF.

    Ratimir Brester said:

    for(int i=0; i < 4;i++)

    {

    uint32_t adc32_raw |= RX[i+1] << ((3-i)*8); // Putting Data Bytes to a 4 Byte integer value

    Make sure you clear the adc32_raw value by setting it to zero before combining the data. Otherwise, you'll be OR'ing the data with the previous data.

    I'm not sure about the binary to ASCII conversion implementation... It doesn't look like you're handing the hexadecimal alphabetical characters (A, B, C, D, E, F) and I didn't understand the following operation: "char c[i+i] = adc32_raw/(10^(9-i));". I would double check that those parts of your code are performing their expected operations.

     

    Best Regards,
    Chris

  • Hi Chris,

    Does the SPI data look okay on the oscilloscope?

    Yes. SPI & Usart are working fine. 

     

     I didn't understand the following operation: "char c[i+i] = adc32_raw/(10^(9-i));


    Well, I put the 4 Bytes to one 32 Bit Number. Afterwards, I split every digit of the number. The reason is, that I can only put chars over USART.

    The biggest Number that you can get is 2^32. This number has 10 digits. So i divide it in thousands, hundrets, thens, ones.. 

    But nevertheless, all is working fine, except the values. I soldered a complete new board. And now i get the zeros. But the values doesn't fit.

    So my questions are:

    1.) If i do AVDD = 5V & AVSS = GND(0V) as Supplys, what am I allowed to put at the inputs with:

    - Bypassed and not bypassed PGA?

    - Single and differential mode

    I configured, for example, AIN8 as positive and AIN9 as negative input (0x89h in ADC1MUX register). 

    2.) On page 119 of the datasheet, they say that you aren't allowed to put 0 V to negative input, if PGA isn't disabled and you use 5V supply. Maybe i destroyed the inputs before, because first, I didnt bypassed the intern PGA and put at AIN8 = 1 V and AIN9 = 0 V (GND) with my voltage source? 

    3.) As mentioned, i use AIN8 pos and AIN9 neg and i bypassed the PGA (before i didnt bypassed and used gain=1). So with my configuration, on page 109 you say that Vinp > -0.1V and VInn < 5.1V ? So if i put AIN8 = 1 V and AIN9 = GND, there should be no problem? 

    But with PGA not bypassed and gain=1: Vinp > 0.3V and Vinn < 4.7V. So with (like in question 2) AIN8 = 1V and AIN9 = 0V it should match? 

    4.) Which input configuration you would recommend, to test the values?

    Thanks so much! 

    Ratimir

  • Hi Ratimir,

    OK - I see in essence what you're trying to do. You're converting the data to a decimal value and then trying to convert to ASCII. Is that part of your code working? You might try setting your "adc32_raw" to a constant value in your code and seeing if you get the correct ASCII output.

    Regarding your other questions...

    Ratimir Brester said:

    1.) If i do AVDD = 5V & AVSS = GND(0V) as Supplys, what am I allowed to put at the inputs with:

    - Bypassed and not bypassed PGA?

    - Single and differential mode

    There is an excel calculator that can help you determine what are acceptable input voltages for all of these settings. You can find it here:  

    Ratimir Brester said:
    2.) On page 119 of the datasheet, they say that you aren't allowed to put 0 V to negative input, if PGA isn't disabled and you use 5V supply. Maybe i destroyed the inputs before, because first, I didnt bypassed the intern PGA and put at AIN8 = 1 V and AIN9 = 0 V (GND) with my voltage source? 

    As long as you don't exceed the absolute maximum ratings, the device should be okay. Connecting the inputs to ground with the PGA enabled violates the PGA common-mode voltage and produces a non-linear result, since the PGA output cannot go to 0V (AVSS).

     

    Ratimir Brester said:

    3.) As mentioned, i use AIN8 pos and AIN9 neg and i bypassed the PGA (before i didnt bypassed and used gain=1). So with my configuration, on page 109 you say that Vinp > -0.1V and VInn < 5.1V ? So if i put AIN8 = 1 V and AIN9 = GND, there should be no problem? 

    But with PGA not bypassed and gain=1: Vinp > 0.3V and Vinn < 4.7V. So with (like in question 2) AIN8 = 1V and AIN9 = 0V it should match? 

    For a PGA gain of 1 V/V and 5V unipolar supply, the input voltages must be in the range of: 0.3V < VIN < 4.7V.
    With the PGA bypassed, the input voltages must be in the range of: -0.1V < VIN < 5.1V.

    When the PGA is bypassed, you can connect the inputs to ground. Otherwise, you would need to provide a bipolar ADC supply (+/- 2.5V).

     

    Ratimir Brester said:
    4.) Which input configuration you would recommend, to test the values?

    For testing, I usually short the inputs to AINCOM (select AINCOM for both AINp and AINn) and then enable VBIAS (the level-shifter), so that both inputs are connected to 2.5V.

     

    Best regards,
    Chris