Post Go back to editing

Problem with AD7856 SPI in Arduino... Help!!

Hi, I try using the AD7856 in Arduino Mega ADK board, I read the datasheet and I have programing under Mode 2, but the AD7856 don't answer me, I connect a oscilloscope to MOSI and MISO lines and Arduino board send correctly the 16bits in MOSI line but in MISO only LOW! so this is my code in Arduino IDE, I hope you can help me!

#include <SPI.h>
uint8_t adcMSB = 0, adcLSB = 0;
unsigned int read_adc;
void setup()
{
  SPI.begin();
  SPI.setClockDivider(SPI_CLOCK_DIV4); //master clock 4MHZ
  SPI.setDataMode(SPI_MODE3);               //mode SPI 3
  SPI.setBitOrder(MSBFIRST);
  pinMode(53,OUTPUT);     
  digitalWrite(53,HIGH);
  pinMode(46,OUTPUT);
  digitalWrite(46,HIGH);
  Serial.begin(9600);
}


void loop()
{
  digitalWrite(46,LOW);     //this start the conversion in specific pin CONVST
  delay(1);                              //wait the device busy pin
  digitalWrite(46,HIGH);     //and start the trans.
  digitalWrite(53,LOW);     //enable device
  adcMSB=SPI.transfer(0b11100001); //here I configure the bits in Control Register, read channel 1, power mode normal
  adcLSB=SPI.transfer(0b00010001); //this read from ADC OUTPUT DATA REGISTER, start the Conversion, select mode 2
  digitalWrite(53,HIGH); //disable device
  delay(300);
  
//read for results
  read_adc= word(adcMSB, adcLSB);
  Serial.print(read_adc,HEX);
  Serial.print(" ");
  Serial.println(read_adc,DEC);
  
}

and this is my schematic:

Parents
  • Hi, Miguel.

    I would just like to clarify, is the MISO line (4th image) the captured ADC result for an input of 5VDC on AIN1? Also, can you check if your channel 2 (for SCK) is also inverted? Note that the AD7856 datasheet states that when a noncontinuous SCLK is used, it should idle high.

    Regards,

    Karen

Reply
  • Hi, Miguel.

    I would just like to clarify, is the MISO line (4th image) the captured ADC result for an input of 5VDC on AIN1? Also, can you check if your channel 2 (for SCK) is also inverted? Note that the AD7856 datasheet states that when a noncontinuous SCLK is used, it should idle high.

    Regards,

    Karen

Children
No Data