STM32 program of AD1256-STM32 test high precision ADC articles (4)

1. ADS1256 overview

 

        ADS1256 is a low-noise and high-resolution 24-bit Sigma-Delta (Ev) analog-to-digital converter (ADC) launched by TI (Texas Instruments). Compared with the traditional successive approximation and integral ADCs, E-vADC has the advantages of small conversion error and low price. However, due to the limitation of bandwidth and effective sampling rate, E-vADC is not suitable for high-frequency data acquisition. The ADS1256 is suitable for systems that collect analog data with a maximum frequency of only a few kilohertz. The data output rate can be up to 30K sampling points per second (SPS), 4 differential and 8 pseudo differential inputs, and perfect self-correction And system calibration system, SPI serial data transmission interface. This article combines the author's own application experience to briefly introduce the basic principles and applications of the ADC.

        ADS1256 is very cost-effective. It is one of the largest ADCs shipped in TI's 24-bit ADC. It is used in a large amount. The online information is relatively complete and the supply is stable. It is very suitable for mid-bottom speed and high-precision testing, such as strain. Application of meter, gas analysis, instrumentation, pressure sensor, blood analysis, industrial process control, medical scientific instrument, etc. The author did a comparative test on ADS1256 and shared the test results

 

 

2. Hardware design analysis

 

 

 

        It can be seen from the structure diagram that AD1256 is an ADC with completely independent analog and digital areas, that is, AVDD supplies power to the analog area, and DVDD supplies power to the digital area. In terms of schematic design, in accordance with the official guidelines, the two areas need to be independent Wiring and isolation processing can make the signal-to-noise ratio the best. Another reliable reference voltage is the lifeblood of a high-precision ADC. In this experiment, TI’s REF5025 was selected as the reference reference. REF5025 can be lower than 3µVpp/V noise, 3ppm/°C drift, and its performance is very excellent.

 

 

 

        Because I often do high-frequency projects, I really hate the Dupont line/flying line test method. In the high-precision field, 2416777216 of the 24-bit ADC gradient value 2, if the reference voltage is 2.5v, the theoretical resolution can reach 0.149μV. Engineers who have done high frequency are well aware of the evil of DuPont lines. According to the above technical analysis, even if the line is introduced into 1μV interference, the accuracy can be discounted. In order to fully demonstrate the performance of ADS1232, a test carrier was specially made. The design of the carrier is also very important. At the same time, the analog and digital area is divided, and a large number of tantalum capacitors are used as a bypass circuit in the connection place to minimize the ripple. Layout and routing are also very important. The copper-clad area also needs to be separated from the module and separated by magnetic beads or 0-5R/inductance.

 

 

3. Chronological diagram

 

 

 

        It can be seen from the timing diagram that ADS1256 reads and writes is a simple 3-wire serial reading method, which belongs to the Microwire serial interface. STM32's SPI interface can be perfectly matched with it. Of course, soft imitation SPI can also be used to replace STM32's hardware SPI. The program is more portable. The implementation of SPI timing is also relatively simple. The CS line of ADS1256 is only used for chip selection (as shown in the figure above). It is needed in the T10 stage at the end of the data output and needs to send a pulse. When the first pulse of SCLK DIN begins to accept data input, SCLK needs to be kept low in T6 after the data input is completed, and then modulate a pulse signal of one cycle, and all the data can reach the DOUT bus, and read and write are completed at one time.

 

4. Core source code

 

 

 
  1. //写一个字节

  2. void ADS1256_write_bit(u8 temp)

  3. {

  4. u8 i;

  5. for(i=0;i<8;i++)

  6. {

  7. ADS1256_Write_SCLK_H;

  8. if(temp&0x80)

  9. ADS1256_Write_DIN_H;

  10. else

  11. ADS1256_Write_DIN_L;

  12. temp=temp<<1;

  13. ADS1256_delayus(1);

  14. ADS1256_Write_SCLK_L;

  15. ADS1256_delayus(1);

  16. }

  17. }

 

 
  1. //读一个字节

  2. u8 ADS1256_read_bit(void)

  3. {

  4. u8 i;

  5. u8 date;

  6. for(i=0;i<8;i++)

  7. {

  8. ADS1256_Write_SCLK_H;

  9. date=date<<1;

  10. ADS1256_delayus(1);

  11. ADS1256_Write_SCLK_L;

  12. date= date | ADS1256_Read_DOUT;

  13. ADS1256_delayus(1);

  14. }

  15. return date;

  16. }

 

 
  1. //初始化:

  2. u8 ADS1256_Init(void)

  3. {

  4. u8 ReturnData = 0;

  5. u8 ADS1256_reg_Init[5]={

  6. 0x02, //状态寄存器初始化值

  7. 0x01, //模拟多路选择器初始化值

  8. 0x00, //AD控制寄存器初始化值

  9. 0x03, //数据速度寄存器初始化值

  10. 0x00, //I/O控制寄存器初始化值

  11. };

  12. ADS1256_Write_CS_H;

  13. ADS1256_Write_SYNC_H;

  14. ADS1256_Write_SCLK_L;

  15. ADS1256_Write_RST_L;

  16. ADS1256_delayms(1);

  17. ADS1256_Write_RST_H;

  18. ADS1256_delayms(1);

  19. ADS1256_Write_CS_L;

  20. ADS1256_delayms(1);

  21.  
  22. ADS1256_write_reg(0x00,ADS1256_reg_Init[0]);//状态寄存器初始化

  23. ADS1256_delayus(1);

  24.  
  25. ADS1256_write_reg(0x01,ADS1256_reg_Init[1]);//模拟多路选择器初始化

  26. ADS1256_delayus(1);

  27.  
  28. ADS1256_write_reg(0x02,ADS1256_reg_Init[2]);//AD控制寄存器初始化

  29. ADS1256_delayus(1);

  30.  
  31. ADS1256_write_reg(0x03,ADS1256_reg_Init[3]);//数据速度寄存器初始化

  32. ADS1256_delayus(1);

  33.  
  34. ADS1256_write_reg(0x04,ADS1256_reg_Init[4]);//I/O控制寄存器初始化

  35. ADS1256_delayus(1);

  36.  
  37. if(ADS1256_reg_Init[1] != ADS1256_read_reg(0x01)) ReturnData = 1;

  38.  
  39. if(ADS1256_reg_Init[2] != ADS1256_read_reg(0x02)) ReturnData = 1;

  40. ADS1256_delayus(1);

  41.  
  42. if(ADS1256_reg_Init[3] != ADS1256_read_reg(0x03)) ReturnData = 1;

  43. ADS1256_delayus(1);

  44.  
  45. if(ADS1256_reg_Init[4] != ADS1256_read_reg(0x04)) ReturnData = 1;

  46. ADS1256_delayus(1);

  47.  
  48. while(ADS1256_Read_DRDY);

  49.  
  50. return(ReturnData);

  51. }

 

 
  1. //读数程序:

  2. u32 ADS1256_Read_a_Data(void)

  3. {

  4. u32 Data,Data1,Data2,Data3;

  5. Data1 = ADS1256_read_bit();

  6. Data2 = ADS1256_read_bit();

  7. Data3 = ADS1256_read_bit();

  8. Data = (Data1<<16) | (Data2<<8) | Data3;

  9. return (Data);

  10. }

 

5. Test Results

 

 

 

        The test source is the 2.50v reference output voltage value, and the actual added voltage is: 2.50000000v (measured by an 8-digit half-meter). Through the analysis of the error curve, the swing is stable at -2- -8µV, and the effect is still very satisfactory. The official test conditions Gain=128, VREF=5V, the figure below is the relationship between the effective bit and the test voltage provided in the manual, it can reach nearly 22 effective values ​​when sampling at 1ksps, but only 20 effective values ​​when sampling at full speed 30kHz , Frequency acquisition is fast, there will be some distortion, this is a common problem of all AD conversion chips, of course, impedance matching also has certain reasons. Therefore, it is necessary to calibrate zero and full scale before use.

 

 

 

6. to sum up

        As a medium-to-low-speed and high-precision ADC, ADS1256 has a conversion frequency of 30kHz, 4 differential inputs or 8 pseudo differential inputs. Although the price is slightly higher than AD7190, its performance is much higher than that of ADI’s AD7190. , There are 8 pseudo-differential input channels, especially the sampling rate. In this test, it has a good price/performance ratio and excellent performance that will make it very competitive in the same level of ADC. Welcome everyone to exchange more technology, QQ: 1625874998, can provide some information for your design reference.

Guess you like

Origin blog.csdn.net/qq_25814297/article/details/107921339