Dear TI, dear Angel Rodriguez,
we are testing the board that I mentioned in my previous question [1] to use the ADS1220 to measure precise temperature with RTD 3-wire Pt100 sensor.
1.Schematics
We use this schematic following the validation with the EVB and the cjmcu-1220 attached to Arduino MCU.
The ADS1220 is connected to SPI bus to the STM32H7 MCU for MOSI/MISO/CK and CS/DRDY are connected over GPIO expander.
The GPIO expander is working correctly and we can communicate with the ADS1220 over SPI configuring the registers and read the Output code however the received data seem not correct but the hardware connexion seems working properly
2.SPI communications
The probing on the SPI lines seem correct
D4=CK, D5=MISO, D6=MOSI, D7=CS
we can observe the in-coming MISO data
3.Software configuration
We are currently using the code below
#include <Adafruit_MCP23X17.h> #include <Protocentral_ADS1220.h> #include <SPI.h> #include <atomic> Adafruit_MCP23X17 mcp; #define PGA 32 // Programmable Gain, confirm that the same as set_pga_gain #define VREF 2.048 // Internal reference of 2.048V #define VFSR VREF/PGA #define FULL_SCALE (((long int)1<<23)-1) #define ADS1220_CS_PIN PIN_SPI_SS #define ADS1220_DRDY_PIN 2 // #define NUM_ADS1220 8 #define NUM_ADS1220 1 SPISettings spi_settings(1000000, MSBFIRST, SPI_MODE1); Protocentral_ADS1220 ads1220[NUM_ADS1220]; int32_t adc_data; float ADS1220Temperature; void setup() { Serial.begin(115200); while (!Serial) ; delay(5000); Serial.println("Set up MCP23017"); // if (!mcp.begin_I2C(0x20, &Wire2)) { if (!mcp.begin_I2C(0x20, &Wire2)) { Serial.println("Failed to initialize MCP23X17 device at 0x20"); } for (size_t i = 0; i < 8; i++) { mcp.pinMode(7 - i, INPUT); // 7-0: port A, DRDY, INPUT mcp.pinMode(i + 8, OUTPUT); // 8-15: port B, CS, OUTPUT } for (size_t i = 0; i < 8; i++) { mcp.digitalWrite(i + 8, HIGH); // Set CS to HIGH } Serial.println("Set up ADS1220"); SPI.begin(); for (size_t i = 0; i < NUM_ADS1220; i++) { ads1220[i] = Protocentral_ADS1220(spi_settings); ads1220[i].begin( [i] (bool level) { mcp.digitalWrite(i + 8, level); }, [i] () -> bool { return mcp.digitalRead(7 - i); } ); ads1220[i].set_pga_gain(PGA_GAIN_1); ads1220[i].set_data_rate(DR_600SPS); ads1220[i].select_mux_channels(MUX_AIN0_AIN1); //Configure for differential measurement between AIN0 and AIN1 ads1220[i].set_VREF(VREF_REFP0); ads1220[i].set_IDAC_Current(IDAC_250); ads1220[i].set_IDAC2_Route(IDAC2_AIN0); ads1220[i].set_IDAC1_Route(IDAC1_AIN1); ads1220[i].PrintRegisterValues(); ads1220[i].set_conv_mode_single_shot(); //Set Single shot mode } Serial.println("Start"); } void loop() { for (size_t i = 0; i < NUM_ADS1220; i++) { adc_data = ads1220[i].Read_SingleShot_WaitForData(); Serial.print("\n\nADS1220 No."); Serial.print(i); Serial.print(" Diff (mV): "); Serial.print(convertToMilliV(adc_data)); delay(500); // float temperature = readADS1220Temperature(i); // Serial.print("\nADS1220 No."); // Serial.print(i); // Serial.print(" Temperature in °C: "); // Serial.print(temperature); // delay(100); } delay(1000); } float convertToMilliV(int32_t i32data) { return (float)((i32data*VFSR*1000)/FULL_SCALE); } float readADS1220Temperature(size_t i) { ads1220[i].TemperatureSensorMode_enable(); delay(50); // waiting time after register changed, for 20SPS float temperature = (ads1220[i].Read_Data_Samples() / 1000 * 0.03125); // In °C ads1220[i].TemperatureSensorMode_disable(); delay(50); // waiting time after register changed, for 20SPS return temperature; }
However we receive the following data which
ADS1220 No.0 Diff (mV): -1.47
Read: 0xFFFD0D28 (-193240)
So I am wondering if the current registers configuration is correct to retrieve correctly data for 3-wire RTD measurement.
My best,
Zabieru.
[1] : e2e.ti.com/.../ads1220-ads1220-spi-connexion-to-stm32h7