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.

ADS1247 SPI Communication Problem

Other Parts Discussed in Thread: TM4C1290NCPDT, ADS1247

In my design i am using ADS1247 with TM4C1290NCPDT & LM3S5B91.

In my circuit i have permanently make CS low, RESET high & START high.

After SPI initialization i send commands for ADC configuration. Then i read the registers to check the successful writing. and then start the conversion by sending Read Data Continuous command.

But I am unable to write or read from ADC using SPI. The value of reading registers and the conversion result are random.

But then i connect CS with GPIO and after SPI initialization and before sending any command to ADC i just make CS high and then Low(falling edge) and ADC start working properly.

So is CS falling Edge must be required to run ADC works successfully??

  • Ritesh,

    To my knowledge, you do not need to have a falling edge to the /CS line. All you need to do is have it low. If you have the ability to use a controllable /CS line, I'd use it because it's the fastest way to reset the SPI communication in case there are errors or noise that disrupts communications (especially for SCLK).

    That being said, let's review what we need for communicating with the device. First, you don't need to send an RDATAC command. The device automatically sets up in this mode. Second RDATAC doesn't start a conversion. It only allows the data to be updated into the DOUT register. Also, SDATAC does not stop conversions, it only stops the data from being updated onto DOUT (and only does this after the next /DRDY indication).

    As a test to make sure that you are able to write to the register, I would do something like change the data rate (DOR) from the default of 5SPS to something like 2000SPS. Do this while putting a scope on the /DRDY line to make sure that the data rate changes. That way you know that you can write to the device.

    To test reading back the device, you need to be aware of a few things. If you are in the default RDATAC mode, data will come back automatically as you clock out the SCLKs. You could send 3 NOP signals to get out the data. I would note that this must be done after /DRDY goes low, and that it must be fully clocked out before the next /DRDY pulse going low. You can see this in the left side of Figure 76 in the datasheet. /DRDY will respond going high after the first SCLK returns low.

    To test reading back a register, I would start with a SDATAC command to stop updating DOUT wait for the conversion to finish (by finding the /DRDY going low) and then send a RREG command to get out the register value. Note that DOUT will likely start clocking out the last conversion output while it is clocking in the two byte command.

    You may need the SDATAC command if your communications are slow. If you do not use SDATAC, then you need to clock out the RREG before the next /DRDY pulse goes low because your RREG command will be interrupted by the next data conversion.

    Check to see if this works and let me know.

    Joseph Wu

  • Joseph,

    Thanks for the Reply.

    I have been using ADS1247 in many other device from a long time. But in all these devices there are separate GPIO pins from uC for CS & RESET. And ADC works fine.

    But in new design in order to save GPIO pin i directly connected CS to ground and RESET to VDD. In this case ADC starts successfully i can get 5 DRDY (default) interrupts. But i thing as you said due to device start up noise in SPI i am unable to write or read Registers or data successfully.

    But with the same code if i use CS pin from uC the ADC SPI communication works for 2 following cases

    1. GPIO pin Output initialization at starting of code execution. And then after SPI enabling i need to write GPIO write High and then low (falling edge).

    2. After SPI enabling GPIO output initialization and then only GPIO write to low. 

    If i initialize GPIO output and make pin Low at starting of execution after clock configuration, SPI communication problem occurs. But ADC will stats with last successful configuration write with one of the above conditions. But i unable to change the configuration.

    So is the ADC having non-volatile registers?

    And is there any other way to reduce noise in SPI? or reset ADC SPI without using CS pin?

     

  • Ritesh,


    If the problem is noise in the SPI communications, you may be able to see it with an oscilloscope. During the read of the device, there there is noise on SCLK, it will advance the DOUT register so that the device thinks there is an extra SCLK, where there is only noise. You may be able to see narrow DOUT pulses, which would indicate the problem.

    If the problem is noise, you can try two things. First add a pull-down resistor to the SCLK line. You may have to look up the drive capability of the micro you are using, but I would guess somewhere between 1k and 10k should be about right. Second, you can add a small cap from SCLK to ground to make the line cleaner. You will need to use an oscilloscope to check this. If the capacitance is too large, then the SCLK may be too slow to advance DIN or DOUT during the write or read of the device. SCLK needs to settle to final value well before 1/2 the SCLK period.

    Even if the noise isn't the problem, I'd still like to see the communications with an oscilloscope. If you are getting bad data, record a length of output data and report it back here.

    As I mentioned before, you should be able to run communications without needing the CS line.

    You asked about the ADC having non-volatile registers before. The ADS1247 has a set of registers that are programmed at our final test, to trim for gain error, offset, and other configuration details. Is that what you're asking about? Is there a problem with the startup that would lead to this question?


    Joseph Wu