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: SPI ADS8320 and microcontroller connection (Atmega1280)

Part Number: ADS8320


Hello!

I work with Atmega 1280 microcontroller and TI ads8320 ADC.
The appearance of the installed ADC and oscillograms are attached.

The input measured signal is a stable DC signal, it was checked using 34401A Agilent digital multimeter. 
The supply and reference inputs are both provided with 2 ceramic capacitors 10 uF and 0.1 uF.

I can’t obtain good spi communication of the microcontroller with the ADC.
The frequency is 125 kHz. When applying clock pulses and a low signal to CS for 22 cycles,
and another 4 cycles after the signal to CS becomes high,
an unstable and very strange signal is observed at the output of the ADC.
I can not understand why) in accordance with the datasheet everything should work)!!

This is the first way I used

This is the second way I used.

The images from the oscilloscope are static images. In dynamics, the code coming out of the ADC is very unstable. Measurement results vary in jumps.

This is an image of how I placed the ADC.

  • Hello

    Would you clarify what frequency you are referering to that is 125Khz?
    Note that the device can support a max throughout rate of 100Khz

    Please remove the 10uF capacitor from the Reference pin, each pin does not need two capacitors, please refere to Figure 19 in the datasheet.

    As for the oscilloscope shots, would you please try using 24 cycles? I ask because after the 16 clock, you should see a repeating of the input signal, LSB first, which means that wuth CS low, you should see another HIGH bit on SDO.

    Regards
    Cynthia
  • Hello!

    I tried to work at 100 kHz, the result is about the same, the same jump signal change.

    Pro capacity thanks for the advice, I will try to remove.

    As for the cycles used. I use 24, because the first 6 go to enable the ADC, and I simply delete their values, then 16 bits of information go, and I read that it is recommended to submit another 3-6 clocking cycles after the QC becomes high.

    Processing code snippet:

    unsigned int SPI_ChangeByte (unsigned char byte)
    {
      SPDR=0x00;
      while(!(SPSR & (1<<SPIF)))//подождем пока данные передадутся (обменяются)
      {b1=SPDR;} 
      return b1;
    }

    PORTB.0=0;
            b1=SPI_ChangeByte(0);//первый байт
            b2=SPI_ChangeByte(0);//второй байт
            b3=SPI_ChangeByte(0);// третий байт
            PORTB.0=1;
            b1=b1&0b00000011;
            b=b1;
            b=(b<<16)|(b2<<8)|b3;//собираем три байта в трёхбайтовую величину
            b>>=2;//убираем ненужные биты (4 слева и 4 справа)

  • Let's focus on getting expected behavior out of the device using the oscilloscope, and then debug digital communications. We have to confirm the device is outputting correctly.

    What is your Vref and Vcc voltage levels? Vref sets the full scale range of the device, also this device outputs in straight binary.
    What is the DC input value you are using? Could you describe how the output is behaving. You mention that is it continously changing even though the input is stable. How big are the changes?

    Regarding the software, note that it is easier to read out the output bit on the rising edge of the clock, after the bit has been clocked out on the previous falling edge of the clock.
  • interrupt [TIM3_COMPA] void timer3_compa_isr(void)
    {
    PORTB.0=0;
    //data=SPI_ChangeByte(0);
    SPDR=byte;
    while(!(SPSR & (1<<SPIF)));//подождем пока данные передадутся (обменяются)
    b1=SPDR;
    SPDR=b1;
    while(!(SPSR & (1<<SPIF)));//подождем пока данные передадутся (обменяются)
    b2=SPDR;
    SPDR=b2;
    while(!(SPSR & (1<<SPIF)));//подождем пока данные передадутся (обменяются)
    b3=SPDR;
    PORTB.0=1;
    // SPDR=b2;
    // while(!(SPSR & (1<<SPIF)));//подождем пока данные передадутся (обменяются)
    b1=b1&0b00000011;
    b=b1;
    b=(b<<16)|(b2<<8)|b3;//собираем три байта в трёхбайтовую величину
    b>>=2;//убираем ненужные биты (4 слева и 4 справа)
    data=b;
    templaser1=((5.00*data)/65536.00);
    templaser=(97500000-19110000*templaser1)/(975+49*templaser1);
    templaser=((3988)/(log(templaser/10000)+13.3758))-273.15;
    }
  • Hello Thank you for help!

    On the leg Vref stable power is supplied to 5 V from the source REF195GSZ-REEL7? Vcc is powered from an external source of 5 V. The input capacitor.

    As an input signal, the output from the instrumental amplifier АD627 is used. This instrumental amplifier provides an amplified difference signal between its own reference channel and the channel where a 10 kΩ semiconductor thermistor is connected. The signal is stable, interference in general is within normal limits.

    At the output of the ADC, a stable signal is observed up to approximately 16-17 tick hours. Then the signal jumps, that is, the last data byte (the last 6 bits of the conversion and 2 unnecessary bits, which I cut off) constantly changes its value in the range from 0 to 100-150.

    In general, communication with the ADC is now organized as follows, through the built-in SPI interface of the microcontroller:

    interrupt [TIM3_COMPA] void timer3_compa_isr (void)
    {
    PORTB.0 = 0;
    // data = SPI_ChangeByte (0);
    SPDR = byte;
    while (! (SPSR & (1 << SPIF))); // wait until the data is transmitted (exchanged)
    b1 = SPDR;
    SPDR = b1;
    while (! (SPSR & (1 << SPIF))); // wait until the data is transmitted (exchanged)
    b2 = SPDR;
    SPDR = b2;
    while (! (SPSR & (1 << SPIF))); // wait until the data is transmitted (exchanged)
    b3 = SPDR;
    PORTB.0 = 1;
    b1 = b1 & 0b00000011;
    b = b1;
    b = (b << 16) | (b2 << 8) | b3; // collect three bytes into a three-byte value
    b >> = 2; // remove unnecessary bits (4 on the left and 4 on the right)
    data = b;
    }

    Timer interrupt response period of 2 ms.
  • It seems to be communicating correctly, yet there is issues with the digital communication.

    This is likely due to the the ADC on a coupon board and the use of the ribbon cable.  There is possible cross talk  between the wires. This can be seen between DOUT and SCLK, there is remnants of the clock on the output line. Suggest decreasing the length of the wires as much as possible, if a proper PCB is not available.  

    It would help to put a low pass filter on the ADC coupon board at the ADC inputs. I would like to confirm that the ADC is able to settle with the current input driving op amp. Using the DC input, does the output ever seem to settle to a value?  

    There is a calculator tool: Analog Engineer's Calculator that can help build the RC filter and make sure the the op amp you are using can in fact drive the 45pF capacitor within the ADC within the allotted acquisition time. Doing a quick calculation within the  tool, under ADC SAR DRIVE tab, it seems that the op amp would need a bandwidth of 115k, and optima RC values are given. Quickly looking at the AD267 though, it only has a bandwidth of 80kHz, you should confirm this.

    Regards, Cynthia

  • We placed the ADC directly on the board. there are no wires at all. And they installed the RC filter, everything became a little better, but the last 4 bits still jump a lot.

    We also tried to measure the AD627 without an operational amplifier. With a circuit without an amplifier, everything works almost perfectly, only the last 1-2 bits jump.

    However, we need an operational amplifier for our applications, and the ADC accuracy is at least 14-bit.

    Tell me if we can manage only the RC circuit on the output ??? Or what else can you do to improve accuracy?
  • Alexandr,


    Cynthia is out of the office, and I'm sorry that I missed your question on Monday.

    For the digital communications problem, I would make sure the master and the ADC and anything else connected to the circuit have a common ground. The ADC will not be able to make measurements of an input that is floating.

    If the master and ADC do not have the same ground, there may be problems with the digital from the ADC matching to the master, and communications may be intermittent. Also, make sure the two digital sections have the same voltage. This way the voltage levels match for all the digital. This can also cause problems with communication.

    There are a few things to look at when it comes to the analog signal measurements. What are you using for VREF and VCC. If VREF comes from a REF195, what is the source driving the reference? Note that with the dropout of the REF195, you will need a minimum of +0.95V even with a low current of 2mA out. If you use REF195 for an output of 5V, the REF will need a supply of at least 6V. If the supply is less, then you may have more noise than you expect.

    For the front end, can you provide a schematic? You refer to measuring a thermistor using an AD627. This is done with and without an operational amplifier as a buffer. If you are connecting to a AD627 instrumentation amplifier, I don't think you'll need a buffer, and you should be able to make measurements with only an RC front end. However, a schematic would be more clear. If you were using an op-amp, which op-amp were you using? Both the noise and common-mode input range of the op-amp may be important. I would also note that using the AD627, you'll also need to keep track of the input common-mode range and gain of the instrumentation amplifier.


    Joseph Wu
  • Thank! We were able to solve problems with accuracy!