5 Replies Latest reply on Mar 16, 2020 3:31 AM by MiTo_4443801

    value of ADC channels Not expected

    MiTo_4443801

      Hi, I'm using a PSoC6 and i have a problem:

       

      I'm using 4 ADC differential channel in order to obtain a measure of two resistance with a voltage divider. But even if the hardware configuration and the value of the two resistance is the same the result of the ADC is different. I have measured the voltage value with an oscilloscope and the value is the same so the hardware is ok. To read the ADC value I've used:

       

      res = ADC_GetResult16(number of channel)

      v= ADC_CountsTo_mVolts(number of channel, res)

       

      The result of channel 0 and channel 2 is the same and it is correct, but the result of channel 1 and 3 are different and it is wrong but I don't know why!

       

      Thanks!

       

      Immagine.jpg

        • 1. Re: value of ADC channels Not expected
          VasanthR_91

          Hi,

           

          Will you be able share your project so that we can have a look into it. You don't have to share the complete project, just the adc,its schematic with the code is sufficient. We can try to recreate the issue at our end. Once you have made the project you can get an archive of the project by following the steps specfied. In PSoC Creator ,  go to File -> Create Workspace Bundle -> Select minimal. Please attach the generated file.

           

          Best Regards,
          Vasanth

          • 2. Re: value of ADC channels Not expected
            MiTo_4443801

            Thanks for the answer, I can't share my project but the part of the adc is : 

             

            Cy_GPIO_Set(V_0_PORT, V_0_NUM);

              

                /* Wake up the ADC and start conversion */

                ADC_Wakeup();

                ADC_StartConvert();

                if(ADC_IsEndConversion(CY_SAR_WAIT_FOR_RESULT))

                {

                    countReference  = ADC_GetResult16(0);

                    countResistor = ADC_GetResult16(1);

             

                    countReference1 = ADC_GetResult16(2);

                    countResistor1 = ADC_GetResult16(3);

              

                    v1= ADC_CountsTo_mVolts(1u, countResistor);

                    v2=ADC_CountsTo_mVolts(3u, countResistor1);

             

                }

             

             

                /* Put the ADC to sleep so that entering low power modes won't affect

                   the ADC configuration */

                ADC_Sleep();

             

             

            adc1.jpgadc2.jpg

            • 3. Re: value of ADC channels Not expected
              VasanthR_91

              Hey Milena,

               

              Could you please let me know what are exact pins used in for each of the inputs too ?

               

              Best Regards,
              Vasanth

              1 of 1 people found this helpful
              • 4. Re: value of ADC channels Not expected
                VasanthR_91

                Hi Milena,

                 

                We have been waiting to hear from you. We would have liked to know how much variation was there between channels 1 and 3. If it is small, it can be due to internal routing. You can see the internal routing used by checking the CYDWR-> Analog tab. So depending on your pin selection, the routes may differ and additional switches on the path can cause additional resistance on the signal path. If the difference is significant, we may have to check further.

                 

                You can always go to debug mode and check the count returned on each of the input and see whether they are proper. Also make sure that the acquisition time is sufficient for both channels.

                 

                Best Regards,
                Vasanth

                1 of 1 people found this helpful
                • 5. Re: value of ADC channels Not expected
                  MiTo_4443801

                  Thanks for the answer, I'll use the debug mode.

                   

                  Best regards.