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.

ADS8328IBPW ADC VALUE READING PROBLEM

Other Parts Discussed in Thread: ADS8328

 I HAVE CONFIGURED ADC  ADS8328IBPW  in Auto Channel Select Mode. but it gives adc value only for one channel. i am unbale to get adc value for second channel.

, how to check  that configuration is proper. can you suggest some example code for handling this ic.

  • Hi Ram,

    Can you let us know how youy have the CFR of the ADS8328 configured and perhaps share a schematic and/or screen captures form an oscilloscope of the control lines?

  • Thanks for Reply,

     I have attach schematic and screen captures form  oscilloscope. i am unable  to attach in single post so ihave attached in differnt post 

  •  CODE:

    WRITE_ADC_CFR:

           

            ADC_CONFIG =0 ;

            ADC_CONFIG = WRITE_CFR | /*write REQUIRED settings to CFR */

            AUTO_CHAN | CCLK_INT | !MAN_TRG | D8_DNC| /* 1101*/

            !POL_INT_EOC_LOW| PIN10_EOC | PIN10_OUTPUT | ANAP_DISABLE| /*0111*/

            RESUME_NAP | RESUME_DEEP| !TAG | NO_RESET; /* 1101*/

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 0)  ;

            WRITE_ADC8328(ADC_CONFIG) ; //SEND SPI

            SPI1_Buffer_Rx[4]=GET_DATA_INT ;

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ;

           

    /////////////////////////////////////////////////////////////////////////////

    READ_ADC_CFR:

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 0)  ;

            WRITE_ADC8328(READ_CFR) ;//SPI GET TRANSFER

            SPI1_Buffer_Rx[5]=GET_DATA_INT ;

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ;

     /////////////////////////////////////////////////////////////////////////////////////////

      void GET_ADC_DATA(void)

     {

                GPIO_WriteBit(ADC_STRT_PORT,ADC_STRT_PIN,(BitAction) 0)  ; 

                GPIO_WriteBit(ADC_EOC_PORT, ADC_EOC_PIN,(BitAction) 1) ; 

                TEMP_BIT=1 ;

                while(TEMP_BIT==1) 

                TAG_BIT =GPIO_ReadInputDataBit(ADC_EOC_PORT, ADC_EOC_PIN) ;

                GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 0)  ; //nss0

                WRITE_ADC8328(READ_DATA) ;

                SPI1_Buffer_Rx[0]=GET_DATA_INT ;

                WRITE_ADC8328(READ_DATA) ;

                SPI1_Buffer_Rx[1]=GET_DATA_INT  ;

                GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ; //nss1

                GPIO_WriteBit(ADC_STRT_PORT,ADC_STRT_PIN,(BitAction) 1)  ; 

         }

  • Hi Ram,

    Thank you for the details!  Lets start with your code for the ADS8328.  I don't see any issues withe either the write or read CFR functions, with the exception of perhaps enabling the TAG bit and running in AUTO_TRIGGER mode, more on that later...

    Your GET_ADC_DATA function seems a bit strange.  You have two WRITE_ADS8328(READ_DATA) lines and by the scope capture of READ ADC DATA, the first seems to be sending the 0xE command, which would re-write the configuration register.  If you count down through the SCLK transitions, the first four are sending 0x1110 (Eh) and the next 12 are sending your configuration data again (0xD7D).  The MISO data under those 16 SCLK transitions looks to me like the value 0x3C2D, which may or may not be a valid conversion result from CH0.

    Starting with the 17th clock, I see the expected Read data (1101b or Dh) command nibble on MOSI, with 0x0000 on MISO.  Since there was no transition on the FS/CS line, the ADS8328 is looking at these clock transitions as 16 additional clocks - the command nibble is not recognized in this case and the data buffer has already been read, so the device outputs trailing zeros.  Commands are only decoded during the first four SCLKS following the FS/CS high to low transition so this makes sense to me.  If you run in a continuous loop with this MOSI combination, you will always be re-starting with CH0 and never get data from CH1.  You'll need to figure out why your transmission here seems double buffered and get the leading 0xED7D out of there.

    Now, back to the TAG bit and the AutoTrigger mode - to be sure you are getting the expected channel data, the ADS8328 has a TAG bit feature.  This requires at least 17 SCLKs to be sent during the data retrieval process.  The 17th clock will output a 0 for CH0 and a 1 for CH1, you can mask this bit in SW to ensure your data array contains the correct channel data information. 

    By your schematic, it appears you have the CONVST input tied to 'something'.  Assuming this is a GPIO pin, configure the ADS8328 in Manual Trigger mode (remove the ! from | !MAN_TRG |) and try pulsing that pin low to high when you want to trigger a conversion sequence.  In Auto trigger mode, the ADS8328 is going to provide data at a rate of 500K samples per second.  You would have to get the conversion results out of the buffer in under 2u seconds in order to keep up with the data transfer rate.  Looking at your screen captures, your SCLK seems to be something on the order of 10us (100kHz).  It believe it would be in your best interest to run in manual CONVST mode which is going to give you significantly more acquisition/settling on both your battery and charger voltages which should give you better results.

    Hopefully this helps - let us know if you have any additional questions!

  • Hi TOM SIR,

    i have modified my  GET_ADC_DATA function now iam getting value  for single channel , channel zero ,how to read adc value for second channel, Please help here is my code

    #define DEFAULT_CFR                  (15<<12)

    #define WRITE_CFR                       (14<<12)

    #define READ_DATA                      (13<<12)

    #define READ_CFR                         (12<<12)

    #define WAKE_UP                          (11<<12)

    #define READ_CHAN0                    (0<<0)

    #define READ_CHAN1                    (1<<0)

    #define WRITE_RESET                   (0xE000)

    /*CFR*/

    #define NO_RESET                         (1<<0)

    #define TAG                                    (1<<1)

    #define RESUME_DEEP                 (1<<2)

    #define RESUME_NAP                   (1<<3)

    #define ANAP_DISABLE                 (1<<4)

    #define PIN10_OUTPUT                  (1<<5)

    #define PIN10_EOC                        (1<<6)

    #define POL_INT_EOC_LOW          (1<<7)

    #define D8_DNC                            (1<<8)

    #define MAN_TRG                        (1<<9)

    #define CCLK_INT                        (1<<10)

    #define AUTO_CHAN                    (1<<11) 

    WRITE  CFR :  //(one time config)

            ADC_CONFIG =0 ;

            ADC_CONFIG = WRITE_CFR | /*write REQUIRED settings to CFR */

            AUTO_CHAN | CCLK_INT | !MAN_TRG | D8_DNC| /* 1101*/

            !POL_INT_EOC_LOW| PIN10_EOC | PIN10_OUTPUT | ANAP_DISABLE| /*0111*/

            RESUME_NAP | RESUME_DEEP| !TAG | NO_RESET; /* 1101*/

            WRITE_ADC8328(ADC_CONFIG) ;

            SPI1_Buffer_Rx[4]=GET_DATA_INT ;

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ;

    READ  CFR :

            GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 0)  ;

            WRITE_ADC8328(READ_CFR) ;

            SPI1_Buffer_Rx[5]=GET_DATA_INT ;

           GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ;

    //////////////////////////////////////

    Void   GET_ADC_DATA (void)  //this function is called frequently in main

     {

               GPIO_WriteBit(ADC_STRT_PORT,ADC_STRT_PIN,(BitAction) 0)  ; //start 0

               GPIO_WriteBit(ADC_EOC_PORT, ADC_EOC_PIN,(BitAction) 1) ; 

                temp_bit=1 ;

                while(temp_bit==1) 

                temp_bit =GPIO_ReadInputDataBit(ADC_EOC_PORT, ADC_EOC_PIN) ;

                delay(10);

                GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 0)  ; //nss0

               WRITE_ADC8328(READ_DATA) ;                      //READ CHANEL ZERO DATA

                SPI1_Buffer_Rx[0]=GET_DATA_INT ;

                 WRITE_ADC8328(READ_DATA) ;                      //READ CHANEL ONE DATA

                SPI1_Buffer_Rx[1]=GET_DATA_INT ;

                GPIO_WriteBit(SPI_NSS_PORT,SPI_NSS_PIN,(BitAction) 1)  ; //nss1

                delay(10) ;

                GPIO_WriteBit(ADC_STRT_PORT,ADC_STRT_PIN,(BitAction) 1)  ;  //start 1

    }