I'm trying to configure my ADC(LM98725) registers through Arduino UNO via SPI but I'm facing a small problem, it would be great if somebody help me out. I have to configure my 16 bit ADC registers which needs 25+ clocks but right now I'm getting 16 SCLK with my 16 bit data output on MOSI pin, there is no SCLK signal without data output. How can I increase the number of SCLK for my ADC? To write to the serial registers, the timing diagram shown in a diagram. First, SEN is toggled low. The LM98725 assumes control of the SDO pin during the first eight clocks of the command. During this period, data is clocked out of the device at the rising edge of SCLK. At the rising edge of ninth clock,the LM98725 releases control of the SDO pin. At the falling edge of the ninth clock period, the master should assume control of the SDI pin and begin issuing the new command. SDI is clocked into the LM98725 at the rising edge of SCLK. The remaining bits are composed of the "write" command bit (a zero), two device addressbits (00, 01 or 10 for the LM98725), five bit register address to be written, and the eight bit register value to be written.

#include <SPI.h>

int ss=10;
int DATAOUT=11;
int DATAIN=12;
int SCLK=13;

void setup()
    pinMode(DATAOUT, OUTPUT);
    pinMode(DATAIN, INPUT);
    pinMode(SCLK, OUTPUT);
    pinMode(ss, OUTPUT);
    digitalWrite(ss, HIGH);
    SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));

void loop()
    digitalWrite(ss, LOW);
    digitalWrite(ss, HIGH);

clock requirement

  • Did you try a dummy write? Can you show us your code? – Edgar Bonet Jun 13 '16 at 18:11
  • Its a simple code I just want to send 16 bit data to my ADC but I only have 16 SCLK pulses and I need 25 pulses. – ahmerkhan88 Jun 14 '16 at 8:35
  • You are transferring only 16 bits. You should transfer at least 25, or rather 32 since it must be a multiple of 8. – Edgar Bonet Jun 14 '16 at 8:46
  • on the first 8 clocks my ADC sends data on MISO pin and then it starts receiving data from the 10th clock. If I sends 32 bit data the first 9 bits would be dummy and then my 16bits for the register configuration and then again the last 7 bits have to be dummy. That's what you are saying? – ahmerkhan88 Jun 14 '16 at 9:05
  • No. According to the graph, all the dummy bits (bits marked "x") should be sent before the register configuration. – Edgar Bonet Jun 14 '16 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.