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.

ADS1232REF: SCLK low on Refboard? How to read DATAOUT Pin with STM32

Part Number: ADS1232REF
Other Parts Discussed in Thread: ADS1232, MSP430F449, ADS1234

Hello I have a question about the ADS1232REF Board.

I am trying to read the DOUT to a STM32 uController simple as possible with bitshifting.
1 PIN as Digital IN and 1 Pin as Digital OUT for the Clock.


In ads1232.pdf -> "DATA RETRIEVAL" section is an example.

But on the ADS1232REF Board the O-Pins ("SCLK" or "EXTCLK") are low.
So where can I read the Clock?
My question is how can the "MSP430F449 uController" read the Data from ADS1232 without the SCLK?

Best Regards
Ibrahim

  • Hi Ibrahim,

    Welcome to the E2E forum! The ADS1232 communication follows Mode 1 SPI where SCLK idles low (when not clocking) and shifts data on the rising edge of SCLK and is read on the falling edge. It is not clear as to how you are connecting your signals to the ADS1232REF, but you cannot connect both clocks together as the output drivers will be in contention.

    To answer your specific question, the MSP430 must provide the SCLK on the ADS1232REF or the data cannot be read from the ADS1232. It will idle low between conversion readings. If you connect an oscilloscope or logic analyzer to the test point locations on the ADS1232REF for SCLK and DOUT you will be able to monitor the communication.

    If you want to connect your own controller to the ADS1232REF, you will need to break or cut the trace for the SCLK between the MSP430 and the SCLK test point and then provide your own SCLK (or GPIO output for the SCLK) at the SCLK test point. The DOUT test point can be connected to the micro input pin. You will also need to connect the ground of the microcontroller to a ground point on the ADS1232REF.

    I would suggest that you first monitor the SCLK and DOUT test points for what the communication should look like with a scope or logic analyzer. Then make the modifications and verify that your communication is working in the same way.

    Best regards,
    Bob B
  • That was a fast response. Thank you Bob.
    Really appreciate it :)

    Ok I have also a ADS1232 seperately but this will come later like you said and I have already found a topic for some questions I had:
    [CCS/ADS1232: Problem in measuring data from ADS1232]
    https://e2e.ti.com/support/data-converters/f/73/t/660399#

    But yes I am still stuck at monitoring or testing the SCLK test point with a scope. I dont know why its low.
    So as you said the MSP430 must provide the SCLK maybe I am missing something. 

    If you want to connect your own controller to the ADS1232REF, you will need to break or cut the trace for the SCLK between the MSP430 and the SCLK test point and then provide your own SCLK (or GPIO output for the SCLK) at the SCLK test point. The DOUT test point can be connected to the micro input pin. You will also need to connect the ground of the microcontroller to a ground point on the ADS1232REF.

    Thank you for your answer I will consider that.


    DOUT test point is working fine because I can see the Data coming out with an oscilloscope.
    So I was expecting something at the SCLK test point with an oscilloscope. [ (Figure 34. Data Retrieval Timing)]

  • Hi Ibrahim,

    I'm not sure what to tell you. If you are seeing DOUT toggling, this could be from end of conversion (DRDY portion) and not the actual data read. This is the signal that the conversion is ready to be read. If you have already cut the SCLK line as described in your last post, then this is the cause. There must be an SCLK for the conversion data to be read.

    If you see the LCD display toggling, then there is an SCLK. If the display is not changing, the the MSP430 SCLK is not getting to the ADS1232. You must provide external power. The USB does not power the device except for programming it. SW9 must be in the JTAG position.

    Best regards,
    Bob B
  • Thank you Bob :)

    I'm not sure what to tell you. If you are seeing DOUT toggling, this could be from end of conversion (DRDY portion) and not the actual data read. This is the signal that the conversion is ready to be read. If you have already cut the SCLK line as described in your last post, then this is the cause. There must be an SCLK for the conversion data to be read.

    -Yes you were right I was looking at 100ms  TIME / DIV so I was looking at the Ready Signal maybe. :/
    -When I changed it to 4us Time/ DIV I am getting something similar from osciloscope and on the LCD. FFFFEBh (last value is chaning so I am sure its working and measuring)
    -I connected IN1+ and IN1- Pins to GND (No jumper at J7 and J8) if IN1+ is not connected to GND LCD is showing 004FFh so its working fine.
    -Yes I am providing a external power, not a nice DC Power Supply but a normal 6V DC. 
    -And no, I didnt cut anything.


    -I thought t7 is about 100ms but so that means the f_clk is different than 4.915 MHz?
    -It seems to me that the 24 bit Signal is divided to 3x 8 bit so its a SPI standard? [Motorola, 8 Bits , MSB first] because later with STM32 I dont think the standard SPI config will work. (In Receive Only Master MODE)
    Thats why I am trying to understand the SCLK signal and DOUT signal on the Refboard.
    -So if the SCLK is with t2 = 5.7 us, and if t3 something near t3=250ns -> 

    t3=100ns ->   4.915 MHz
    t3=250ns -> 12.288 MHz





    So my next step is to get this Code work.
    Is t2= 100ms too much?
    t3 = 1ms -> is this too much?

        data=0;
        data_state = HAL_GPIO_ReadPin(GPIOB, Data_IN_Pin); //SCL/D15 PIN
        
        switch(state){
            case -1:   //start
                HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,1); //Set SCLK HIGH
                HAL_Delay(100);  // t2, wait for MSB
                state=0;
                break;
            case 0: //idle
                if(data_state==1){
                    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,0); //Set SCLK LOW
                    state=1;
                }
                break;
            case 1: //wait data ready
                if(data_state==0){
                    state=2;
                }
                break;
            case 2: //read data
                HAL_Delay(1);  // t2, wait for MSB
                for(int i =0; i<25; i++){
                    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,1); //Set SCLK HIGH
                    HAL_Delay(1);
                    if(i<24){
                        data += HAL_GPIO_ReadPin(GPIOB, Data_IN_Pin)<<i; // Read and shift the bit in data
                    }
                    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,0); //Set SCLK LOW
                    HAL_Delay(1);
                }
                state=3;
                break;
            case 3:
                HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5,1); //Set SCLK HIGH
                HAL_Delay(1000);  // t2, wait for MSB
            state=0;
                break;            
            default:
                break;
                
        }

    Best regards

  • Hi Ibrahim,

    The MSP430 is using the built in SPI peripheral. To initiate the SCLKs you write a byte of data to the TX buffer to start the clocks. When 8 clocks have been sent (entire TX buffer write) you read the contents of the RX buffer. This process would be very similar for any micro SPI peripheral. To read the entire conversion result you would need to write/read the buffers 3 times (24 bits).

    Now that we have established that the micro is sending the SCLKs as intended, we need to clear up a few things. The ADS1232 is a delta-sigma oversampling ADC. Do not confuse fclk with SCLK. The fclk is the master clock of the ADS1232 that is used for internal timing of the device to make the analog to digital conversion. The device is sampling and 256kHz and decimating to 10sps. This differs from a typical SAR device that uses the SCLK for conversion. With the CLK pin of the ADS1232 connected to GND, the internal oscillator is used which relates to the fclk = 49152MHz clock. This results in a conversion completion with the SPEED bit low of once every 100ms. You must read out the data result completely between the end of one conversion to the end of the next conversion.

    The t2 time refers to the setup time of the ADS1232 output communication. As this minimum time is specified as 0, you can start to read the data as soon as DOUT/DRDY makes the high to low transition. We generally prefer to use a GPIO interrupt to determine this transition. If you waited 100ms, then you would be missing the data and reading the next data result (as conversion completes every 100ms).

    The t3 time refers to the minimum low time and high time of the SCLK. With a 50% duty cycle this would be one clock period of 100ns high and 100ns low. The minimum clock period would be 200ns, or an SCLK frequency maximum of 5MHz. I would suggest targeting an SCLK frequency of around 1 to 2 MHz. You could use a 1ms period (1kHz) which is 24+ms of data retrieval time, but this length of time does not allow for you to do much of anything else by way of averaging, displaying or manipulating the data between conversion results.

    Best regards,
    Bob B
  • Thank you Bob :)

    Just want to update: - As you suggested I didnt manage the 1 ms period but 2 ms (HAL_Delay(1) -> gives me 2 ms Delay and HAL_Delay(0)-> gives a 1 ms Delay)
    So 1 ms HIGH and 1 ms LOW so I am at 48 ms data retrieval time. Just with a simple Bitshift function.

    Thats actually my aim to collect some weights(measurements), averaging and save it to a Sd-Card.



    #Picture1: AINP1,AINN1 are connected to GND. Thats what I am getting with gain: 128.

    On Table (8) with the Ideal Output Code I dont understand the connection with my Output.
    Does the Output FF FE16 has to do with (-0.5Vref/128)/ (2^23 -1)? 
    So GND - GND = is negative? Why not 0?





    #Picture3: Output with a Loadcell.


    So for me it looks like its working. So I can add some weights and than to make some calculations to get g...

    I have just a general question, is it possible that the ads1234 will have a drift when the load cell is continous loaded?
    Or should it stay stable?

    I was trying to measure for 1 week but the refBoard ads1232 stopped everytime when I checked it (idle and not aquiring) somehow. (Dont know why but turning the light on and off restarted the connection on USB because I saw the recording stopping. Now I am trying with another PowerSupply)

    Best Regards 
    Ibrahim E

  • Ibrahim,


    Bob is out of the office this week, so I thought I'd post a response.

    The output you see when you ground the inputs is likely just an offset voltage, which can also be negative. As an offset voltage is rather small. You can convert the output code to a voltage (assuming you have a 5V supply and reference), you get:

    FFFE16h = -1EAh = -490d

    (-490/2^23) * (2 * 5V / 128) = -1.1uV

    As for the long term stability of the ADS1232 and ADS1234, there shouldn't be drift because the load cell is continuously loaded. There shouldn't any drift or changes in characteristics because of normal operation of the device and readings should be stable.

    I'm not sure what caused your reference board to stop collecting data, but I don't have any experience with long collections with this board. Bob may have more insight into this when he returns.


    Joseph Wu