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.

    Thanks for providing these. Am I correct to assume that SS refers to your /SYNC line? If so, why is this high? This pin is level triggered active low and frames the serial clock for the read and write operations. Also, please check how you are configuring the part. The 1st two bits of MOSI determine which register is addressed, and the subsequent 14 bits of data are written to the addressed register. From the scope shots, the first two bits are 00 which does not address any register. Hence, the next 14 bits are ignored.

    Regards,

    Karen

Reply
  • Hi, Miguel.

    Thanks for providing these. Am I correct to assume that SS refers to your /SYNC line? If so, why is this high? This pin is level triggered active low and frames the serial clock for the read and write operations. Also, please check how you are configuring the part. The 1st two bits of MOSI determine which register is addressed, and the subsequent 14 bits of data are written to the addressed register. From the scope shots, the first two bits are 00 which does not address any register. Hence, the next 14 bits are ignored.

    Regards,

    Karen

Children
No Data