2 Replies Latest reply on Mar 19, 2018 2:12 PM by RodolfoG_11

    Issues while reading multiple analog values on single channel ADC


      Hello everyone,


      I am using "ADC SAR Seq" component (only 1 channel) and using it to read 8 analog inputs with help of mux. I am setting select lines on Mux and based on selected lines on Mux I am reading values for 8 different ADC values. Here is code snippet


      static uint8 L1_ReadAnalogInput(_sAdcHandle *pAdcHandle)


          static uint8 FlagL1 = L_1_STATE_1;

          static uint8 u8Index = 0; // Start reading ADC from Index 0




              case L_1_STATE_1:


                // Custom function for setting select lines



                  /*Start Conversation here*/

                  ADC_StartConvert();     // Cypress API


                  FlagL1 = L_1_STATE_2;




              case L_1_STATE_2:




                      u16Analog = ADC_GetResult16(ADC_CHANNEL)>>1;     // Cypress API

                      if(u16Analog > 0x7FF)

                          u16Analog = 0;


                     // copying ADC value in global var using jump table

                      pAdcHandle->AnalogValue[AnalogIndex[u8Index]] = u16Analog;


                      ADC_StopConvert();     // Cypress API


                      // Code for changing select lines

                     u8Index = ( u8Index < 7) ? u8Index + 1 : 0;


                     FlagL1 = L_1_STATE_1;

                     return L_1_SUCCESS;






          return FlagL1;



      With help of this function I am reading data on each input and select lines are checked for accuracy. My problem is once in a while data is getting corrupted on ADC.


      I am not sure what the issue is, but to me it seems either averaging is causing this or maybe there is some issue with ADC settings (images attached).


      Problem: If Analog input 1 is changing and suppose it has high analog value around 700 then sometimes it's affecting analog input 2's value. Similarly if analog input 1 is stable or zero then analog input 2 is never getting affected. Again if analog input 2 has high analog value it's affecting analog input 3.


      My testing so far:

      1. Issue is not with select lines. I tried adding delays after setting select lines but there is no change in behavior.


      If anyone has experience in ADC or faced similar issues please let me know.


      PS - I want to create a case on this as I am unable to see that option in the page where it used to be.