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.

ADS8320 not reaching reference voltage range.....Loosing bits?

Other Parts Discussed in Thread: ADS8320

Hi,

I am trying to read ADC ADS8320 values via SPI communication. I am reading 16 bit data as mentioned in datasheet, it gives values always 0 to 32767 range only. I am not able to get full range like 0 to 65536.

I have tried with 2.5V and 5V reference voltage, in both cases i am able to read values only 0 to 32767. I was not able to figure what might be the problem.

As mentioned in the datasheet that first six bits are dummy bits (sample=5 and one null bit) and next 16 bits are the actval data. here is the code i have tried to read ADc values.

Here is the code i have written to read ADC values via SPI. My SPI configuration is read MSB bit first.

unsigned int AD8320_16(unsigned int value) 
{ 
   uint16_t result;

    AD8320_CS_Status(0);
    while(GIODOUTA&X2);
    
    result = ((uint16_t)(spi2(value >> 16) & 3U)) << 14;
    result |= ((uint16_t)spi2(value >> 8)) << 6;
    result |= ((uint16_t)spi2(value)) >> 2;

    AD8320_CS_Status(1);
    return result; 
} 

unsigned int readADC8320(void)  
  {                 
       value = AD8320_16(0xFFFFFF);                           // read registe    
       return value;
  }

I am trying to read 24bits. read first 8 bits but shift it with 14 bits it means skip MSB 6 bits and LSB 2 bits are our MSB data so i have 2 MSB bits, then read second 8 bits and shift with six and finally read read 8 bits but take only 6 bits and remove 2 extra bits in 24 bits.

Can anyone suggest me , why its limiting values to 32767?

Regards,

Pavan.

  • Hi all,
    Can anyone help me with this problem, i was struggling with it and need to solve ASAP.
    Regards,
    Pavan.
  • Hello Pavan,

    I would first suggest checking your interface timing (as specified by Table I and Figure 3) using an oscilloscope. This will help validate your code. Table II of the datasheet shows the expected codes for each input voltage. What output codes do you read when you apply those input voltages (with VREF = 5V for example)? And could you share your schematic along with oscilloscope plots of the interface showing conversion cycles for a couple of different inputs?

    Best Regards,
    Harsha
  • Hi Harsha,

    Thanks for your quick reply, 

    I have checked interface timing using an oscilloscope. When i validate the code from oscilloscope it seems perfect but when i read with SPI the value is not exactly same to the oscilloscope code but half of it.

    I have 5V reference voltage. here are some images from oscilloscope. 

    1) input voltage at ADC =0.451V , i am reading equivalent value via SPI =2827 (0xB0B) but from oscilloscope image i am getting value code =5688(0x1638). With 5V reference i should get 5688(0x1638) value which is equivalent to 0.45V.

    2)input voltage at ADC =1.14V , i am reading equivalent value =7199 (0x1C1F) but from oscilloscope image i am getting value code =14552(0x38D8). 

    3) at input voltage at ADC =2.4511V  and 4.517V i am getting similar way. 

    it seems I am getting proper reply from ADC but when it comes to SPI readings i am getting half of the oscilloscope code value. 

    Am i loosing LSB bit in SPI reading? If you want i can update schematic.

    Regards,

    Pavan.

  • Hi Pavan,

    Basically, it looks like the ADC output is correct but there is something wrong with the way you are extracting valid bits from the 24-bit output stream you are capturing. I think the bit extraction/assembly process can be simplified significantly if you did the following:

    ADCoutput = (24bitWord & 0x03FFFC) >> 2

    Please try this out and let me know if it works.

    Regards,

    Harsha

  • Hi Harsa,
    Thanks for you help, It was some intialization problem. I am running SPI at diffrent phase thats why i am getting diffrent readings.
    Now its working fine.
    Regards,
    Pavan.