This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS7066: SPI Communication between Arduino Uno and ADS7066

Part Number: ADS7066

Hi I am trying to do SPI comm. between ADC7066 and Arduino Uno. I am giving 2V from the external Power supply to the CH1 (AIN1) but  getting some random data on SDO. I am using manual mode and SPI mode 0.

Connections:

ADC7066 Uno
CS Digital Pin 10
SDI MOSI (D11 )
SDO MISO (D12)
CLK CLK (D13)
5V 5V
AVDD 3.3V
AIN1 2V

Arduino CODE:

#include <SPI.h>


const int CS = 10;
uint32_t ADC_GET(int CS);
#define DELAYTIME 2 //delay, in seconds

void setup(){

pinMode(13, OUTPUT); //SPI SCK
pinMode(11, OUTPUT); //SPI MOSI
pinMode(12, INPUT); //SPI MISO

pinMode (CS, OUTPUT);
digitalWrite(CS, HIGH);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV2);
Serial.begin(9600);

}


void loop() {



uint8_t RD_REG = 0b00010000;
uint8_t Add = 0x11;
uint8_t Data = 0x00;
digitalWrite(CS, LOW);
SPI.transfer(WR_REG);
SPI.transfer(0b00010001);
SPI.transfer(Data);
digitalWrite(CS, HIGH);
uint32_t data = (RD_REG)+(Add)+ (Data); //combine bytes, scale 32bit to 24bit
return data;

delay(5000);

}

  • Hello Sachin,

    Thank you for your post.

    The register write frame in the scope image above looks correct: 01h 11h 00h (write 00h to address 11h). If you want to change the channel to AIN1, you'll need to send 01h 11h 01h.

    Regards,

    Ryan

  • Hi Ryan, thank you for the reply. Just a quick question what I have to do to read data from CH1? As I am giving 2V to CH1 but I get nothing on SDO line. 

    byte RD_REG = 0x10;
    byte Add = 0x11;
    byte Dummy = 0x00;
    digitalWrite(CS, LOW);
    SPI.transfer(RD_REG);
    SPI.transfer(Add);
    SPI.transfer(Dummy);
    digitalWrite(CS, HIGH);

    digitalWrite(CS, LOW);
    byte value = SPI.transfer(Dummy);
    SPI.transfer(Dummy);
    SPI.transfer(Dummy);
    digitalWrite(CS, HIGH);

    serial.println(value, BIN);

  • This is the Scope image, I am giving 2V to the CH1, but i am not reading anything back. I used the read command as in the code specified below: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    byte RD_REG = 0x10;
    byte Add = 0x11;
    byte Dummy = 0x00;
    digitalWrite(CS, LOW);
    SPI.transfer(RD_REG);
    SPI.transfer(Add);
    SPI.transfer(Dummy);
    digitalWrite(CS, HIGH);
    digitalWrite(CS, LOW);
    byte value = SPI.transfer(Dummy);
    SPI.transfer(Dummy);
    SPI.transfer(Dummy);
    digitalWrite(CS, HIGH);
    serial.println(value, BIN);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    And for some reason my SDI goes high after every 8bit clock cycle? is this normal?

  • Hi Sachin,

    Please refer to section 7.4.2 Manual Mode. Figure 7-13 summarizes the operation required to switch the MUX to another channel and receive data. If you send the command in frame N to switch the MUX channel, data from that channel will be available in frame N + 2.

    Regards,

    Ryan