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.

ADS124S08: ADS124s08 reg write and read analog data issue

Part Number: ADS124S08


HI,

 I am using ADS124s08 ADC. 

I have interface it with my micro-controller over SPI.

I am able to read the default reg values by generating rreg command and reading the status from my controller.

But not able to read  the status of the register if I overwrite the default register value by using wreg command.

I am not sure that the issue is with wreg command or rreg command(rreg command is believed to be working correctly as I am able to read the default status)

My procedure for reading the overwrite rreg is below.

CS=0  // over writing register

send write command = 0x45(overwrite ref register)

send NOP

Send NOP

CS= 1

reading register

CS = 0

send read reg command 0x25(read ref reg)

send NOP

send NOP read data

CS = 1

For reading ADC data I am unable to get the correct data  procedure is below

CS = 0;

start commad = 0x08;

CS=1;

read data

CS = 0;

send six NOP's and read data at every nop

CS = 1;

But data read is not correct .

Kindly suggest me how to solve the issue

 

  • Hi Durgesh,

    The easiest way to verify communication is to see oscilloscope or logic analyzer plots of the communication.  Can you send me plots of your communication so that I can evaluate?  Can you also send me your schematic?  See my additional comments below.

    Best regards,

    Bob B

    Durgesh Koli said:

    Part Number: ADS124S08

    HI,

     I am using ADS124s08 ADC. 

    I have interface it with my micro-controller over SPI. [Bob] What SCLK frequency and SPI mode are you using?  You should be using SPI Mode 1 and the SCLK frequency must be less than 10MHz.

    I am able to read the default reg values by generating rreg command and reading the status from my controller.

    But not able to read  the status of the register if I overwrite the default register value by using wreg command. [Bob] SPI Mode 1 uses the SCLK dwelling low, data changes on the rising edge of SCLK and holds stable on the falling edge.  You should verify that your communication is working this way with an oscilloscope or logic analyzer.

    I am not sure that the issue is with wreg command or rreg command(rreg command is believed to be working correctly as I am able to read the default status)

    My procedure for reading the overwrite rreg is below.

    CS=0  // over writing register

    send write command = 0x45(overwrite ref register) [Bob] This is correct for a register write to the the REF register (0x05).

    send NOP [Bob] It is ok to use the NOP, but you are really writing this value to the ADS124S08, which is 0x00 and in the WREG command this is the second byte of the command sequence which is to write the number of registers indicated by the value -1.  In this case you are writing 1 register, and the value would be 1 - 1 which is 0x00 for this 2nd command byte, which happens to be the value of the NOP.

    Send NOP [Bob] This 3rd byte is the data to be written to the register, it should not normally be a NOP, but rather the data.  In this case you are writing 0x00 to register 0x05.

    CS= 1

    reading register

    CS = 0

    send read reg command 0x25(read ref reg)

    send NOP

    send NOP read data

    CS = 1

    For reading ADC data I am unable to get the correct data  procedure is below

    CS = 0;

    start commad = 0x08;

    CS=1;

    read data [Bob] Before reading the data you must wait until the conversion has completed.  This will be signaled by a high to low transition on DRDY, or you can wait the period of time based on the data rate and digital filter settings in the register.

    CS = 0;

    send six NOP's and read data at every nop [Bob]  What you are doing is reading the data twice by sending 6 NOPs.  You must have a valid reference selected/provided or the conversion data will be incorrect.  If you did not wait for the conversion to completed, you will not get a valid conversion result.

    CS = 1;

    But data read is not correct . [Bob] You have not given much information as to what you are applying to the analog inputs, the register settings being used, the reference value selected, the value you expect and the value you are seeing.  Based on uncertainty that the WREG command is working, I suspect you are using the default settings.  The default data rate is 20sps, so you must wait at least 50ms before you see a conversion result.  As the device is in a low powered state you should wait longer than 50ms as shown in Table 15 of the datasheet.  At 20sps the first conversion for the low-latency filter is 56.504ms after the Start command is issued.  The default reference is REF0, so you should have a valid reference voltage connected to the REFP0/REFN0 inputs.  The analog inputs should be connected to the default mux settings of AIN0/AIN1.

    Kindly suggest me how to solve the issue

     

  • Hi Bob Thanks for your reply.

    SO far I am able to read the default values of the registers, and read the analog input data for default configuration.
    The value varies correctly between 0 to 5V.
    But still I am facing issues with writing values to register.


    Procedure for wreg(writing data to register INPMUX) command
    CS = 0;
    send command: 42;
    send NOP= 0x00;
    send data=0x31;
    CS= 1;

    Then reading the same register to check that correct data is written on the reg
    Procedure
    CS = 0;
    send command: 22; data don't care
    send NOP= 0x00; data don't care
    send NOP= 0x00; read data: it should be 0x31, but I am getting 0 (zero) here
    CS =1;
    data is coming out as zero.

    I tried with sending wakeup command before writing to register but not of use.

    Please suggest some solutions.
    Thanks Adnan.
  • Hi Bob,

    Below are timing diagrams captured for wreg and rreg command(rreg command timing diagram is captured after wreg command is given to ADC)

    wreg command timing diagram

    rreg Timing diagram, taken after the wreg command is given to ADC 

    If I set try to set the INPMUX reg with value 21 or 31 and try to read the analog input data connected to it then I get the wrong data.

    I have applied 0V to default negative input(IN1) and to the positive IN0, IN2, IN3 my device is connected with full scale 0 to 5 V.

    Please let me know how to solve the issue.

  • Hi Adnan,

    The pictures didn't come through.  Could you try reposting them again?  When replying make sure you select the Insert Code, Attach Files and more...

    And then select the appropriate icon to insert a picture.

    Thanks,

    Bob B