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.

ADS1259 Clocking Out Data

Other Parts Discussed in Thread: ADS1259, PGA280

Hello,

I am currently using the PIC32MX795F512L that is on a designed board to connect an ADS1259 to it via SPI. My question is that on Figure 61 on page 31 of the ADS1259 datasheet (http://www.ti.com/lit/ds/symlink/ads1259.pdf), it says that I need to send the byte 0x12 to start the read mode. However, I couldn't find the section where it states specifically what I need to do after that to retrieve the data. My initial impression is that I have to send out 0x00 to in order to keep the clock going. Also, assuming that it is correct to write 0x00 to keep the clock going, would the sequence in storing the data be something like this:

write 0x12

read byte (throw away)

write 0x00

datamsb = read byte

write 0x00

datamid = read byte

write 0x00

datalsb =read byte

When I tried this particular sequence, it got locked up in trying to store the bytes I'm reading so I was wondering if anyone could shed some light on this. Thank you.

EDIT: 

SpiChnPutC(1,0x41); // Write 0100 0001 Write, Reg 2
SpiChnPutC(1,0x01); // Write 0000 0001 (2 bytes) -1
SpiChnPutC(1,0x00); // Flag Checksum 0 Sinc
SpiChnPutC(1,0x20); // last 3 bits are for the data rate (000 = 10 SPS)

I am also having trouble setting datarates 10SPS,16.6SPS,50SPS,60SPS, and 400 SPS. However, the ADC toggles the data line at 1200SPS,3600SPS, and 14400SPS when sent a start 0x08 command. I was wondering if anyone else had issues with lower data rates.

  • Hi Edmond,

    You are correct - keep DIN low while clocking out the data (i.e. sending 0x00 over SPI) to retrieve the data. Your sequence should work.


    A few possible causes I would look into:

    • Make sure /CS is being held low during the entire read data transaction. I believe most MCUs won't have a problem with this. Typically, you have to set the GPIO pin to control /CS in your code. Make sure your peripheral is not operating in a "frame sync" mode that toggles /CS after every SPI byte sent.

    • With the MSP430, you'll typically wait until the SPI read/write operations have occurred and you check by reading a flag. You may need to check if you are reading the correct flag so that you are not waiting on the wrong operation to finish before you can send your next byte.

    • I don't think this is an requirement with the ADS1259, but other ADC's require that you read all data bytes, including any CRC or checksum bytes that follow the data. Terminating data read out early can cause problems with those kinds of devices. If you are not reading the checksum byte, I recommend turning it off in the register settings - it should also be off by default with the ADS1259; therefore, I doubt this would be an issue.

    Best Regards,
    Chris

  • I just saw your edit... have you tried reading back the register settings?

    The data rates assume you are applying the nominal 7.3728 MHz clock. With an 8 MHz clock your actual data rates will be slightly faster.

    Regards,
    Chris

  • Hi Chris,

    I have tried reading back from the registers of the PGA280 and the ADS1259 perfectly fine using the read and write commands. I also have monitored the data ready lines to make sure that the they are being toggled correctly when I send it the start command. The issue I currently have is that when I try to assign a variable to my read function, it says that it is zero. I can see that when I send 0x00 over SPI, the data is being sent over the DOUT but I am unable to retrieve it. My intuition is that by the time I do the read, the time window to do so is already over. 

    EDIT:

    Here are some pictures I took of what I have so far:
    http://imgur.com/80gtPnQ (the top is my clock signal and the bottom is my DOUT) Note: I am also in the read data continuous mode via sending 0x10 so these are the 3 0x00 bytes I am sending in order to get the data back. 

    http://imgur.com/MAs9ltS (the top is my clock signal and the bottom is my ADC chip select line when writing the 3 0x00 bytes)

    http://imgur.com/PvnsCvA (the top is my clock signal and the bottom is my data ready line) The last clock signal there is me sending a read stop continuous 0x11 since I only wanted a single sample.

    Here is also a snippet of my code that I am using to send the 3 0x00 bytes and attempting to retrieve the data back:

    selectADS_CS(1,0); //set the specific chip select to 0
    SpiChnPutC(1,0x00); // Write 0x00 (Output to keep ADC transmitting)
    dummy1 = SpiChnGetC(1); 
    SpiChnPutC(1,0x00); // Write 0x00 (Output to keep ADC transmitting)
    dummy2 = SpiChnGetC(1);
    SpiChnPutC(1,0x00); // Write 0x00 (Output to keep ADC transmitting)
    dummy3 = SpiChnGetC(1);
    selectADS_CS(1,1); //set the specific chip select to 1

    Something interesting I noticed is that when I try introducing 2-3 variables, the function call gets locked up and CS never goes high again.  However, when I just set 1 variable, the variable passes through but every time I try to read the dummy byte, it is always 0.

    Regards,

    Edmond

  • Hi Edmond,

    What is the datatype of "dummy#" and what are you returning from the SpiChnPutC() function (and what is its datatype)?

    The scope shots look pretty good... I do see some small crosstalk, probably a result of capacitive coupling of the digital traces. Just in case the scope is not showing the full bandwidth of the crosstalk, you might try slow down the digital edges. You can do this by adding series resistance to you digital traces or additional capacitance near the digital input pins. You might have to cut some traces and scrap off some soldermask to make space for these components.

    OR

    If your digital traces are connected via jumper wire to the ADS1259EVM, then make sure the connections are short and twist your wires around the ground wire to reduce the current loop area and lower the inductance of the jumper wires. This has solved many communication problems I've run into.

    Unfortunately, I have no experience programming with the PIC32MX795F512L. If my suggestions above don't help, you might try searching for help on the Microchip website.

    Regards,
    Chris

  • Hi Chris,

    I have figured out the issue to read the characters back during the 3 0x00 bytes being written but still have some questions about the fundamental understanding of this SPI communication. The reason why it didn't work was because I didn't call the get function every time I call the put function. This leads me to believe that every time I write to the ADS1259, I would get a response back (even if it is 0x00 or something like that). Is this assessment of the situation correct? Is the data being transmitted out of the ADS1259 stored in some sort of FIFO buffer? 

    Regards,

    Edmond

  • Hi Edmond,

    Yes, that is correct!  ...You must be reading back one of the previously unread bytes.

    The ADS1259 will clock out data even when you are just writing to it. The data may be 0x00, but usually the MCU will still interpret it as incoming data. (SPI communication is always bi-directional, even when you are just performing a one-way operation.)

    The data is being stored on your MCU and needs to be cleared somehow. I' think you can always return the incoming byte, but only store it to a variable when you care about the incoming data.

    Regards,
    Chris