I'm so confused by the ADS2750 datasheet here, I can't seem to figure the proper bit shift to read data from bits 15-27 properly. I'm not even sure what some of the acronyms mean on page 23 table 1. I get that the first 15 bits are empty while the ADC takes a reading and then the last 12 bits for the 12 bit ADC are the value from that ADC that matches the SPI A or B input. Would someone be willing to explain to me how you would read data based on this datasheet using information from table 2 page 24?
My hardware set up to ADC7250 VCC 5 Volts
- D5 SS fro Both SPI & SPI1
- D13 SCK for Both SPI & SPI1
- D11 MISO SPI_A from ADC
- D4 MISO SPI_B from ADC
- No MOSI connected
I'm not sure what to send in the SPI.Transfer(0x00)
. I'm also not sure if I'm setting up the modes properly, SPISettings settings(24*MHZ, MSBFIRST, SPI_MODE1);
as I not 100% on the clock speed. I also I'm confused if this is LSB or MSB as the datasheet has two conflicting notes, the transfer function used LSB and then two paragraphs say "MSBs of ADC_A and ADC_B are output"
I'd love some help decoding this data sheet and getting a script that can read data from this chip using both SPI and SPI1 simultaneously.
Working on only reading SPI first the will add SPI1.
unsigned int readRegister(byte thisRegister, int bytesToRead);
const int CS_ADC_ISOLATOR = D5;
__SPISettings settings(24*MHZ, MSBFIRST, SPI_MODE0);
const int buffersize = 30;
unsigned char dataBuffer [buffersize];
const byte READ = 0x22;
// setup() runs once, when the device is first turned on.
void setup() {
Serial.begin(115200);
pinMode (CS_ADC_ISOLATOR, OUTPUT);
digitalWrite (CS_ADC_ISOLATOR, HIGH);
SPI.begin();
SPI1.begin();
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
digitalWrite (CS_ADC_ISOLATOR, LOW);
SPI.beginTransaction(settings);
for(unsigned char i = 0; i < buffersize; i ++)
{
dataBuffer[i] = SPI.transfer(0x00 << 14);
}
digitalWrite (CS_ADC_ISOLATOR, HIGH);
SPI.endTransaction();
for(unsigned char n = 0; n < buffersize; n ++)
{
Serial.print(dataBuffer[n]);
}
Serial.print("::");
}