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.

ADS1231: Problems reading data from converter with MSP430

Part Number: ADS1231
Other Parts Discussed in Thread: MSP430FR2433,

Hi I have an ADS1231 connected to an MSP430FR2433 in a circuit that is similar if not identical to the reference design.

Essentially I have a load cell connected to the ADS1231 which feeds to an MSP430. There are also some switches and LEDs at the bottom which you can ignore.

As you can see, the data rate is set to the slower 10Hz rate. I'm using the internal clock.

I have SCLK feeding to and output on the MSP430, and DRDY/DOUT to an input.

This is all on a 2 layer PCB. The two chips are 10 mm apart. 

Power is USB via a Launchpad @ 3.3V.

Here are my problems.

  1. When the MCU is setting SCLK high or low, I can see nothing on my scope. I can only assume it is a low impedance pin that is sinking my signal.
  2. The output at DRDY/DOUT is strange. Under some conditions it is normal. If SCLK is held LOW, DRDY is HIGH.
  3. However if I try to read data, DOUT is giving me strange output. Take a look at this plot:

In my program in the MCU, I wait for DRDY to go low. When it does I blip an unrelated output which is the blue line that you see. Note that this pulse is about 1ms@3.3V.

Then I set SCLK HIGH, wait 1ms, read DOUT, set SCLK LOW, etc. and repeat for the next 23 (+1) bits.

However the yellow waveform that you are seein at DOUT is really simply reflecting SCLK, except note that it is only ~1.4V. That is invalid since the datasheet says that LOW should be MAX 0.66V and HIGH should be minimum 2.9V, given 3.3V in.

You can also see that I get some 3.3V spikes kind of erratically; which does not seem to relate to anything.

The program reflects what I just described:

#include <Arduino.h>

#define DOUT P1_3
#define CLK P1_2
#define PULSE_WIDTH 1000

uint16_t in[3];
void pause(void);
uint8_t SPI_transfer_byte(uint8_t);

void setup() {
  Serial1.begin(9600);
  pinMode(6, OUTPUT);
  pinMode(CLK, OUTPUT);
  pinMode(DOUT, INPUT);

  // Reset DOUT with a pulse.
  digitalWrite(CLK, HIGH);
  pause();
  digitalWrite(CLK, LOW);
  pause();
}

void loop() 
{
  if(digitalRead(DOUT) == LOW)
  {
    // Blip an output to trigger scope.
    digitalWrite(6, HIGH);
    pause();
    digitalWrite(6, LOW);

    for(int i=0; i<3; i++)
      in[i] = SPI_transfer_byte(0);
    Serial1.print(in[0], HEX);
    Serial1.print(in[1], HEX);
    Serial1.print(in[2], HEX);

    // Reset DOUT with a 25th pulse.
    pause();
    digitalWrite(CLK, HIGH);
    pause();
    digitalWrite(CLK, LOW);
  }
  Serial1.write(".");
}

uint8_t SPI_transfer_byte(uint8_t byte_out)
{
    uint8_t byte_in = 0;
    uint8_t bit;

    for (bit = 0x80; bit; bit >>= 1) 
    {
        pause();
        digitalWrite(CLK, HIGH);
        if (digitalRead(DOUT) == HIGH)
            byte_in |= bit;
        pause();
        digitalWrite(CLK, LOW);
    }

    return byte_in;
}

void pause()
{
  delayMicroseconds(PULSE_WIDTH);
}

I have tried:

  • Connecting or not connecting a load cell.
  • Changing the pulse width. The datasheet says I should be reading 24 bits in less than 100ms.
  • A different PCB with different chips in case of damage or faulty PCB.
  • Double checking the reference designs against my schematic and PCB layout.

This is the PCB

Thanks in advance.

  • Hi Yvan,

    Welcome to the E2E forum!  You are actually using the wrong connections in your code for the pins connected to the ADS1231.  For example, P1.3 is defined in your code as DOUT but this pin is actually connected to the SCLK pin on the ADS1231 in the schematic. The P1.2 pin is defined as CLK but it is actually connected to DRDY/DOUT.  If you change the labels in the code I think it may work.  So CLK should connect to P1.3 and DOUT to P1.2.

    Best regards,

    Bob B 

  • Wow Bob, thank you so much.

    The funny thing is that that is the first thing I looked at. In fact I was using pin numbers before I started using the pin aliases, and switched to the aliases because I was sure I had the wrong. I guess I just needed a fresh pair of eyes.

    Thank you again for the very prompt response and solution.