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.

ADS1192 initialization fail

Other Parts Discussed in Thread: ADS1192, ADS1292

Hello all,

I have two Problems.

I use an ADS1192 with an ArmSAM4E. My problem is the initialization of the ADS1192. I wrote a function for this but there is an issue.  

1. problem

I ‘m able to set different sample rates with the "init" function. The DRDY – Pin toggles correctly.

But I can't change the gain or the MUX-register for channels. If the device starts in default mode it works fine. I can read the data out and see a externally applied sinus 20mVpp on channel 1 with gain 6.

If the ADS is initialized using my function the ADS data output stays at zero. It seems like the RDATAC Command at the End of the init fails.

2. problem

Can you explain please how the  Command ADS1192_OFFSETCAL should be used. There are no detailed info’s in the data sheet.  

 

SPI Clock 500kHz

SPI Mode: Data on falling edge

void init_ADS1192(void)

{

                NVIC_DisableIRQ(PIOA_IRQn);                                                        // disable DRDY-PIN Interrupt                          

                ADS1192_RESET_low;

               wait_us(20);                                                                                               // wait µsek

                ADS1192_RESET_high;                                                                     // reset device

                ADS1192_CS_low;                                                                              // SPI CS low

                wait_us(3);                                                                                           // wait µsek

                send_Com_ADS1192(ADS1192_SDATAC);                                         // change to SingleShot Mode (register unlocked for changing)            

                wait_us(20);                                                                                         

               send_Com_ADS1192(WREG_MASK | CONFIG1);

                wait_us(5);

              send_Com_ADS1192(0x0A);                                                                 // write 11 register

                wait_us(5);

                send_Com_ADS1192(SPS1000);                                                         // Config 1

                wait_us(5);

                send_Com_ADS1192(Bit7_must_SET );                                               // Config 2

                wait_us(5);

                send_Com_ADS1192(0x10);                                                                 // LOFF - default        

                wait_us(5);

                send_Com_ADS1192(Normal_Operation | Gain2 | MUX_normal);       // CH1SET

                wait_us(5);

                send_Com_ADS1192(Normal_Operation | Gain2 | MUX_normal);       // CH2SET

                wait_us(5);

                send_Com_ADS1192(0x00);                                                                 // RLD_SENS - default

                wait_us(5);

                send_Com_ADS1192(0x00);                                                                 // LOSS_SENS - default

                wait_us(5);

                send_Com_ADS1192(0x00);                                                                 // LOFF_STAT - default

                wait_us(5);

                send_Com_ADS1192(0x02);                                                                 // MISC1 - default

                wait_us(5);

                send_Com_ADS1192(0x80);                                                                 // MISC2 - OffsetCal is on

                wait_us(5);

                send_Com_ADS1192(0x00);                                                                 // GPIO - default

                wait_us(5);

                send_Com_ADS1192(ADS1192_OFFSETCAL);                                  // after set gain must send  ?????

                wait_us(20);                                                                                         // how long???

                ADS1192_START_high;                                                                     // Startpin high

                wait_us(3);

                send_Com_ADS1192(ADS1192_RDATAC);                                        // change to Continous Mode 

                wait_us(20);

               ADS1192_CS_high;                                                                             // SPI CS High

                NVIC_EnableIRQ(PIOA_IRQn);                                                          // enable DRDY-PIN Interrupt       

}

Best regards

Patrick

  • Hi Patrick,

    Welcome to our e2e forum! At the end of you init function it looks like you are sending /CS high. The DOUT is hi-z when /CS is high, so can you let us know how are you going about trying to read the data? The offset calibration function configures the ADS1292 for the lowest data rate, resets the digital filter, and then takes 16 data points for calibration. The average of those points is stored in a register and then the offset is added or subtracted as necessary from the normal conversion results. The calibration takes about 305 ms to complete, so that may be part of the problem here with the initialization. Can you try putting a break point in your code after the OFFSETCAL function and watch the behavior of DRDY?
  • Hi Tom,

    it dosn't working.
    Can you please explane how I can change the gain on channel! With standart init it works, with my function not.
    Must I call OFFSETCAL for every channel or only one time. I wait now after the call "OFFSETCALL" 1 sec. If I read the Data out, the DRDY-Pin show not good on the Osszi and the data starts not with the right status Byte.

    See below the "read Data" function.

    Regards Patrick

    unsigned char get_Data_ADS1192(unsigned char *buf_data)
    {

    ADS1192_CS_low

    SPI->SPI_TDR = 0x00; // send dummy
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY)); // wait for sending
    *(buf_data+0) = SPI->SPI_RDR; // get answer

    SPI->SPI_TDR = 0x00;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    *(buf_data+1) = SPI->SPI_RDR;

    SPI->SPI_TDR = 0x00;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    *(buf_data+2) = SPI->SPI_RDR;

    SPI->SPI_TDR = 0x00;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    *(buf_data+3) = SPI->SPI_RDR;


    SPI->SPI_TDR = 0x00;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    *(buf_data+4) = SPI->SPI_RDR;

    SPI->SPI_TDR = 0x00;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    *(buf_data+5) = SPI->SPI_RDR;

    ADS1192_CS_high

    return 1;


    }

    void init_ADS1192(void)
    {
    unsigned int dummy;

    NVIC_DisableIRQ(PIOA_IRQn);
    NVIC_DisableIRQ(PIOB_IRQn);

    ADS1192_RESET_low;
    wait_us(100);
    ADS1192_RESET_high;

    ADS1192_CS_low;
    wait_us(3);

    send_Com_AD1192(ADS1192_SDATAC); // chance to SingleShot Mode (register free for chance)
    wait_us(20); //

    send_Com_AD1192(WREG_MASK | CONFIG1);
    wait_us(5);
    send_Com_AD1192(0x0A); // write 11 register
    wait_us(5);
    send_Com_AD1192(SPS1000); // Config 1
    wait_us(5);
    send_Com_AD1192(Bit7_must_SET ); // Config 2
    wait_us(5);
    send_Com_AD1192(0x10); // LOFF
    wait_us(5);
    send_Com_AD1192(Normal_Operation | Gain4 | MUX_normal); // CH1SET
    wait_us(5);
    send_Com_AD1192(Normal_Operation | Gain4 | MUX_normal); // CH2SET
    wait_us(5);
    send_Com_AD1192(0x00); // RLD_SENS
    wait_us(5);
    send_Com_AD1192(0x00); // LOSS_SENS
    wait_us(5);
    send_Com_AD1192(0x00); // LOFF_STAT
    wait_us(5);
    send_Com_AD1192(0x42); // MISC1
    wait_us(5);
    send_Com_AD1192(0x80); // MISC2
    wait_us(5);
    send_Com_AD1192(0x00); // GPIO
    wait_us(5);


    send_Com_AD1192(ADS1192_OFFSETCAL); // must send after change Gain
    for(dummy = 0; dummy < 1000; dummy++) wait_us(100);


    send_Com_AD1192(ADS1192_RDATAC); // change to Continous Mode
    wait_us(30);


    ADS1192_CS_high;
    wait_us(30);


    NVIC_EnableIRQ(PIOA_IRQn);
    NVIC_EnableIRQ(PIOB_IRQn);


    ADS1192_START_high;


    }
  • Hi Patrick,

    Can you send me the details on your masks for those commands and also let me know if you can read back the register contents after you program them?  The offset cal command will automatically calibrate all channels, so you only need to send it once.  Screen shots of your SPI interface shoing SCLK and DIN/DOUT would also be helpful.

  • Hi Tom,

    sorry for the delay.

    I have found the issue and solve the problem. The issue was in the simple SPI write function.

    this works:
    void send_Com_ADS1192(unsigned char data)
    {
    SPI->SPI_TDR = data;
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    }


    this dosn't work:
    void send_Com_ADS1192(unsigned char data)
    {
    while(!(SPI->SPI_SR & SPI_SR_TXEMPTY));
    SPI->SPI_TDR = data;

    }

    If I use the second function the wait_us() has no effect. :-)


    Thanks for your help.
  • Great!  Thanks for letting us know.