Send 32 bit SPI Request and Receive 32-bit Using Arduino

Hello, There !

I am working on one of my project; In that i am using 16-bit ADC (ADS8681) and trying to read the data from it with Arduino MEGA using SPI mode. I am able to write the 32-bit data (WRITE Instruction with Data) and getting correct waveform on oscilloscope of which data shared. When i am trying to read the 16-bit data from ADC by applying analog voltage it shows correct variation (Reading the 16-bit data ) but when removed load it shows random value. Is it the problem of reading ADC data? for 32-bit read instruction. Can anyone will give suggestions.

References Which I used:

  1. SPI library : SPI - Arduino Reference
  2. SPI Examples : https://www.arduino.cc/en/Tutorial/LibraryExamples/BarometricPressureSensor
  3. Forum : Send 32 bit SPI request and receive 32 bit response - Networking, Protocols, and Devices - Arduino Forum

Arduino SPI Pins :

  1. SCK 52
  2. MOSI 51
  3. MISO 50
  4. SS 53
     #include <SPI.h>
     #include <LiquidCrystal.h>

     #define SS 53    
     uint16_t receivedVal16 = 0 ;

     LiquidCrystal lcd (38,37,36,35,34,33);

     void setup()
     {
      lcd.begin(16,4); 
      SPI.begin();                  
      SPI.setBitOrder(MSBFIRST); 
      SPI.setDataMode(SPI_MODE0);
      digitalWrite(SS,OUTPUT);
 
     digitalWrite(SS, HIGH); //Write on REG
     delay(10); 
     digitalWrite(SS,LOW); 
     SPI.transfer(0xD4);
     SPI.transfer(0x14);
     SPI.transfer(0x00);
     SPI.transfer(0x01);
     }

     void loop() 
     {
     digitalWrite(SS, HIGH); //Write on Register 
     delay(10); 
     digitalWrite(SS,LOW);
     SPI.transfer(0xD4); // Write Command
     SPI.transfer(0x14); // Reg. Address
     SPI.transfer(0x00); // Data
     SPI.transfer(0x01); // Data

     digitalWrite(SS, HIGH);  //Read REG
     delay(10); 
     digitalWrite(SS,LOW); 

     receivedVal16 = SPI.transfer16(0x0000);
     lcd.setCursor(0,1);
     lcd.print(receivedVal16);

     delay(100);
     }

Welcome,

It seems to be normal behavior, from datasheet

If the analog input pin (AIN_P) to the device is left floating, the output of the ADC corresponds to an internal biasing voltage. The output from the ADC must be considered as invalid if the device is operated with floating input pins.

A schematic might help. What does removing the load tell us?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.