Go Down

Topic: AD7730 (Read 6151 times) previous topic - next topic

bob4i

Yes the clock is fine, I attached the oscillator to wrong pin.  Please check what value do you read from status register. After 2 reads RDY does not go LOW.
I tried to start continues mode then read and then stop it and start again, RDY always goes low but I read only zeros.
SYNC and POL are tied HIGH, I use 4.1925Mhz ,
I tried so many times without any success. When I tried to read the status register after reset the result was something 10001, that makes me think something is wrong with the code.
I will try more tricks tomorrow.
Code: [Select]


#include <SPI.h>

#define RESET 5
#define RDY 6
//#define MOSI 11
//#define MISO 12
//#define SCK 13
//#define SS 10

 



byte byte1;
byte byte2;
byte byte3;
byte byte_total;
long time;


void setup()
{
 
  pinMode(RDY, INPUT);
pinMode(RESET, OUTPUT);
pinMode(SCK,OUTPUT);
   digitalWrite(SS, HIGH);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE3);
  SPI.setClockDivider(SPI_CLOCK_DIV16);
Serial.begin(115200);

  Serial.println("Reset ADC ...");
  digitalWrite(RESET,HIGH);
  delay(500);
  digitalWrite(RESET,LOW);
  delay(500);
  digitalWrite(RESET,HIGH);
  delay(500);
  Serial.println("Set up AD7730");
  digitalWrite(SS,LOW);
  SPI.transfer(0x03);
  digitalWrite(SS,HIGH);
//  delay(100);
  digitalWrite(SS,LOW);
  SPI.transfer(0x800010);
  digitalWrite(SS,HIGH);
//  delay(100);
  Serial.println("Set DAC register settings");
  digitalWrite(SS,LOW);
  SPI.transfer(0x04);
  digitalWrite(SS,HIGH);
//  delay(100);
  digitalWrite(SS,LOW);
  SPI.transfer(0x23);
  digitalWrite(SS,HIGH);
  //delay(100);
Serial.println("Channel 1 Internal full scale calibration");
digitalWrite(SS,LOW);
SPI.transfer(0x02);
digitalWrite(SS,HIGH);
//delay(100);
digitalWrite(SS,LOW);
SPI.transfer(0xA190);
digitalWrite(SS,HIGH);
digitalWrite(SS,LOW);
SPI.transfer(0x02);
digitalWrite(SS,HIGH);
while(digitalRead(RDY) !=LOW) { Serial.println("calibration wait RDY"); delay(500); }
Serial.println("calibration done");
digitalWrite(SS,LOW);
SPI.transfer(0x02);
digitalWrite(SS,HIGH);
//delay(100);
digitalWrite(SS,LOW);
  SPI.transfer(0x9180);
  digitalWrite(SS,HIGH);
   digitalWrite(SS,LOW);
SPI.transfer(0x02);
digitalWrite(SS,HIGH);
delay(100);
while(digitalRead(RDY) !=LOW) { Serial.println("wait for RDY signal to goes LOW IN VOID SETUP2"); delay(500); }

}
 
 
void loop() {
  digitalWrite(SS,LOW);
  SPI.transfer(0x02);
  digitalWrite(SS,HIGH);
//  delay(100);
  digitalWrite(SS,LOW);
  SPI.transfer(0x2180); //continuous read from channel 1
  digitalWrite(SS,HIGH);
//  delay(100);
  digitalWrite(SS,LOW);
  SPI.transfer(0x21);
  digitalWrite(SS,HIGH);
//  delay(100);
while(digitalRead(RDY) !=LOW){ Serial.println("NOT RDY IN VOID LOOP");}
//delay(500);}
// SPI.transfer(0x30); //end continous mode
/// delay(1000);

 
// SPI.transfer(0x30); //end continous mode
//delay(1000);
delay(100);
  digitalWrite(SS,LOW);
  byte1 = SPI.transfer(0xff);
  byte2 = SPI.transfer(0xff);
  byte3 = SPI.transfer(0xff);
  digitalWrite(SS,HIGH);
byte_total=byte1<<16; 
byte2=byte2<<8;   byte_total=  byte_total|byte2|byte3; 
byte_total=(byte_total*2)+byte_total; 
     
SPI.transfer(0x30); //end continous mode

  Serial.print(byte1,BIN);
  Serial.print(" ");
  Serial.print(byte2,BIN);
  Serial.print(" ");
  Serial.print(byte3,BIN);
  Serial.print(" ");
  Serial.print(byte_total, DEC);
  Serial.print("\n");
  //delay(1000);
 
}

Hackscribble

Code: [Select]
  SPI.transfer(0x800010);

You can't send three bytes with one call to transfer().

Make separate calls like this (assumes most significant byte goes first - check your datasheet).

Code: [Select]
SPI.transfer(0x80);
SPI.transfer(0x00);
SPI.transfer(0x10);

Hackscribble.  Writing about making things
hackscribble@outlook.com

bob4i

I red the registers and they are same like in datasheet, wrote different once and red them and they are correct, in datasheet DATA REGISTER result is  000000 Hex and I red 000000 HEX I think have to do some calibration and settings for correct work but do not know what exactly to do.

bob4i

Finished the code and the pcb but the noise is too much, settings: 24bit data output chope mode on, fast mode off, 50hz rejection, AC excistation ON, I loose about 10 bits, please give me some advice to reduce the noise.
Thank you.

bob4i

Hello, I am trying a new board with AD9175 but I cannot open PCB file form analog device evaluation board CN0155. If someone can open the PCB please tell me.
http://www.analog.com/en/circuits-from-the-lab/CN0155/vc.html

rodriguesluis

Hello, i have tried the code above, but nothing happens, the rdy pin is always on high state, and when i force the rdy pin to low state only appears
1:255
2:255
3:255
Anyone can give any kind of explication why this behavior and how could i resolve it?

thanks in advance

José Rodrigues

bob4i


Thanks to  @Hackscribble I found the error in my code, you should fix the code to transfer 8 bit of data with one SPI transfer, and you have to set up the ADC for you sensor, give us more information about your parts.

Boxxylols

Those still looking for information check out my post here http://forum.arduino.cc/index.php?topic=331913.0

harikeshpatil

Hi bob4i,
I have tried a lot, I am getting output 0 0 0 0.
Please  share your codes.
Harikesh

avr_fred

You are asking a question that will never be answered by bob4i, they are no longer active. You cannot resurrect a three year old thread and expect answers.

Start a new thread. But first read this: How to use this forum

Post a schematic and your code using code tags. It's all explained in the how to guide.

Go Up