9 Replies Latest reply on Aug 17, 2018 5:40 PM by user_119654

    ADC_SAR_Seq measurement on 9 pins

    therese_2030211

      Hi.

      I want to use the adc to measure 9 different inputs. I configured the ADC_SAR_Seq to be single ended with

      input range: vssa to vdda

      Reference: internal Vref

      voltage reference: 2.5 volts (vdda/2)

      Free running and internal clock source.

       

      The code is simple, I start the adc and start the conversion and then create a for-loop and read the results in 16 bit, then I convert those results to voltages:

       

      int16 ch1, ch2, ch3, ch4, ch5,......,ch9;

      float32 volt1, volt2, volt3, volt4, volt5,...,volt9;

       

      int main(){

       

      ADC_SAR_Seq_Start();

      ADC_SAR_Seq_StartConvert();

       

           for(;;){

       

                if(ADC_SAR_Seq_IsEndConversion(ADC_SAR_Seq_WAIT_FOR_RESULT){

                     ch1 = ADC_SAR_Seq_GetResult16(0);

                     ch2 = ADC_SAR_Seq_GetResult16(1);

                     etc..

       

                     volt1 = ADC_SAR_Seq_CountsTo_Volts(ch1);

                     volt2 = ADC_SAR_Seq_CountsTo_Volts(ch2);

                     etc...

                }

          

           }

       

      }

       

       

      I am able to measure the pins manually to check if the adc measurements are correct, and I am able to put 5V on one of the pins.

      What I would expect is for one of the adc measured pins to return a value of 5 volts and the rest to return the value 0,

      but I get results where all of my measurements are approximately the same value (about 5 when I put the 5V on one pin and 0.1 when there is nothing on the pins).

      I know that the correct voltages of the pins are 0 for the ones who are not connected to the 5 volt for the connected one. Therefore I am very confused by these results, does anyone know why this happens and how to fix it?

        • 1. Re: ADC_SAR_Seq measurement on 9 pins
          user_1377889

          Can it be that you leave the pins floating? There is no expected value in this case.

           

          Bob

          • 2. Re: ADC_SAR_Seq measurement on 9 pins
            user_119654

            Bob and Therese,

             

            I am basically getting the same effect.  I am using a PSoC 5LP and an ADC_SAR_SEQ with 4 GPIO inputs configured as High-impedance Analog.

             

            When I place only one voltage (~3V) on any pin of the 4 inputs, I see this voltage (from 2V to 3V) appear on ALL ADC results AND all the non-voltage driven inputs.

            It would appear there is Hardware mux leakage since I can see these values in the ADC results as well as the inputs themselves.

             

            Is there a way to get true HW isolation between the muxed inputs?  This is very important to the application I am running.

            Len

            • 3. Re: ADC_SAR_Seq measurement on 9 pins
              user_1377889

              Can you please post your complete project (or a shortened version that shows the error) so that we all can have a look at all of your settings. To do so, use

              Creator->File->Create Workspace Bundle (minimal)

              and attach the resulting file.

               

              Bob

              • 4. Re: ADC_SAR_Seq measurement on 9 pins
                user_119654

                Bob,

                 

                I've got the compressed bundle you wanted.

                 

                If I can venture a guess ... I think the underlying amux used in ADC_SAR_SEQ is not set to "Maximum" isolation and the AtMostOneActive is not set.

                Len

                • 5. Re: ADC_SAR_Seq measurement on 9 pins
                  rajiv.vasanth.badiger

                  Len,

                   

                  There is a cap array at the input which forms the sampling and DAC network. The cap array is not discharged when the channel is switched. I am still confirming with the design team. 

                   

                  From the usage point of view, it is not a good idea to leave the ADC input floating. You can add a pull down resistor if there is such a case in your application. Make sure the output impedance of the input signal source doesn't cause much error while adding a pull down resistor or add a calibration mechanism to nullify the error.

                   

                  -Rajiv

                  • 6. Re: ADC_SAR_Seq measurement on 9 pins
                    user_342122993

                    For interleaved ADC inputs, it is normal to observe a cross-talk between sampled channels. It comes from sampling capacitor and input resistance, and gets worse with increasing frequency of channel switching. Typical solutions

                    (1). add terminating resistor to the GND on each input pin (100 - 1000 oHm). The drawback is that input impedance becomes low, and some crosstalk will remain anyway. It is typically assumed that ADC inputs are connected to multiple sensors with buffered outputs, or a battery source with low impedance (<1k). Then this impedance serves as input terminating resistor.

                     

                    (2). Double number of inputs, and ground each second one. This way each second ADC sample is wasted, but sampling capacitor is always discharged to zero before sampling real data from unterminated pins. Now input impedance is high (~20k), but sampling rate is twice lower.

                    /odissey1

                    1 of 1 people found this helpful
                    • 7. Re: ADC_SAR_Seq measurement on 9 pins
                      rajiv.vasanth.badiger

                      Ok. Got a confirmation that the sampled voltage is retained as the channel is switched. This helps to lower the current intake from the source, if there was only one channel being read continuously; thereby improving input impedance.

                      1 of 1 people found this helpful
                      • 8. Re: ADC_SAR_Seq measurement on 9 pins
                        user_119654

                        /odissey1,

                         

                        Thanks.  You're probably right.  (1) is not workable for me since the input I need to measure I also need to measure the current load.  Therefore a parallel input resistor will load the input (which has internal source resistance) and give a wanky current readings as well.

                         

                        I may implement your (2) suggestion.  Sadly, the ADC_SAR_Seq device assumes a front-end mux.  You'd think they would incorporate your (2) idea in the object behind the scenes.

                         

                        Len

                        • 9. Re: ADC_SAR_Seq measurement on 9 pins
                          user_119654

                          Rajiv,

                           

                          Thanks for your research in this issue.  Suggeston:  Look into /odissey1's (2) idea. 

                           

                          Len