Hi
I am running this code on esp32
/***************************************************************************
* Example sketch for the ADS1220_WE library
*
* This sketch shows how to use two ADS1220 modules attached to the same SPI
* interface. This sketch was tested on an Arduino UNO R3 and Arduino UNO R4.
* For an Arduino UNO R4 (WIFI or Minima) pay attention to lines 29-32!
*
***************************************************************************/
#include <ADS1220_WE.h>
#include <SPI.h>
// Pin definitions
#define ADS1220_1_CS_PIN 7 // Chip Select
#define ADS1220_1_DRDY_PIN 6 // Data Ready
#define ADS1220_2_CS_PIN 5 // Chip Select
#define ADS1220_2_DRDY_PIN 4 // Data Ready
#define SPI_INITIALIZED true
#define SPI_NOT_INITIALIZED false
/* Create ADS1220 objects */
ADS1220_WE ads1 = ADS1220_WE(ADS1220_1_CS_PIN, ADS1220_1_DRDY_PIN);
ADS1220_WE ads2 = ADS1220_WE(ADS1220_2_CS_PIN, ADS1220_2_DRDY_PIN);
/* For reasons I don't know, the Arduino UNO R4 WIFI and Minima (and maybe other boards?) don't like
* it if SPI.begin() is called a second time, which happens by default if using the above constructors.
* To avoid this use these alternative constructors: */
// ADS1220_WE ads1 = ADS1220_WE(ADS1220_1_CS_PIN, ADS1220_1_DRDY_PIN, SPI_NOT_INITIALIZED);
// ADS1220_WE ads2 = ADS1220_WE(ADS1220_2_CS_PIN, ADS1220_2_DRDY_PIN, SPI_INITIALIZED);
void setup() {
Serial.begin(115200);
while (!Serial);
/* Choose SPI clock speed here. */
// ads1.setSPIClockSpeed(4000000); // set SPI clock speed, default is 4 MHz
// ads2.setSPIClockSpeed(4000000);
digitalWrite(ADS1220_1_CS_PIN, HIGH);
pinMode(ADS1220_1_CS_PIN, OUTPUT);
digitalWrite(ADS1220_2_CS_PIN, HIGH);
pinMode(ADS1220_2_CS_PIN, OUTPUT);
Serial.println("CS of ADS1220 #1 and ADS1220 #2 forced to HIGH (inactive).");
Serial.println("Initializing ADS1220 #1...");
if (ads1.init()) {
Serial.println("ADS1220 #1 connected and functioning!");
} else {
Serial.println("ERROR: ADS1220 #1 not responding.");
//while (1);
}
delay(100);
Serial.println("Initializing ADS1220 #2...");
if (ads2.init()) {
Serial.println("ADS1220 #2 connected and functioning!");
} else {
Serial.println("ERROR: ADS1220 #2 not responding.");
//while (1);
}
delay(100);
ads1.setGain(ADS1220_GAIN_1);
ads1.setDataRate(ADS1220_DR_LVL_0);
ads1.setConversionMode(ADS1220_CONTINUOUS);
ads2.setGain(ADS1220_GAIN_1);
ads2.setDataRate(ADS1220_DR_LVL_0);
ads2.setConversionMode(ADS1220_CONTINUOUS);
float vRef1 = ads1.getVRef_V();
Serial.print("VRef (ADS1220 #1): ");
Serial.print(vRef1, 3);
Serial.println(" V");
float vRef2 = ads2.getVRef_V();
Serial.print("VRef (ADS1220 #2): ");
Serial.print(vRef2, 3);
Serial.println(" V");
delay(3000);
}
void loop() {
ads1.setCompareChannels(ADS1220_MUX_0_1);
float result1 = ads1.getVoltage_mV();
Serial.print("1. AIN0 vs. AIN1 [mV]: ");
Serial.println(result1);
ads2.setCompareChannels(ADS1220_MUX_0_1);
float result2 = ads2.getVoltage_mV();
Serial.print("2. AIN0 vs. AIN1 [mV]: ");
Serial.println(result2);
Serial.println();
delay(1000);
}
and have this error on serial monitor
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4980
load:0x40078000,len:16612
load:0x40080400,len:3480
entry 0x400805b4
ets Jul 29 2019 12:21:46

