2 Replies Latest reply on Oct 17, 2017 1:59 AM by user_279968365

    SAR ADC offset and AMux_FastSelect questions

    user_279968365

      Dear All:

      I am working in a design having a SAR ADC and AMUX. Check the picture attached for the schematic.

      ADC is single ended, internal VREF 1.024, Bypassed, range 0-2.048V.

      I have three small questions regarding this subsystem:

      (1) To calculate ADC offset I have connected the last channel of the AMUX (COL_9) to VSSA (externally, on the PCB) and use the following code

       

      AMux_FastSelect(9);

      CyDelayUs(10);

      ADC_SAR_StartConvert();

      ADC_SAR_IsEndConversion(ADC_SAR_WAIT_FOR_RESULT);

      adcReading = ADC_SAR_GetResult16();

      ADC_SAR_SetOffset(adcReading);

       

      Do you think is this correct?

       

      (2) Should I do anything similar to calculate the ADC_SetScaledGain()? In the ADC datasheet, it says:

      "It should only be used to further calibrate the ADC with a known input or if the ADC is using an external reference."

      In case yes, What do suggest me?

       

      (3) On the AMUX datasheet,  AMUX_FastSelect command seems to take 4 us to set the new channel (Table 1, pag8) for a 48Mhz Clock, so, as I am using a 24Mhz clock, I have added a CyDelayUS(10) on the code above. Is this correct? More or less time?

       

      Thanks in advance,

      Joaquin.

        • 1. Re: SAR ADC offset and AMux_FastSelect questions
          samp

          Hello Joaquin,

           

          There are two situations here. One is that the signals connected to AMux inputs do not have offset or gain error. The other is that they do have offset and gain error.

           

          A1) If the signals you have connected to AMux inputs do not have offset error, then you are fine. The ADC will read offset of the internal signal chain, and the offset will be compensated.

          If the signals do have offset error, you will have to store the offset values of the individual channels separately. So what you are doing will be correct if all the inputs do not have offset error.

           

          A2) If the signals have have gain error, you have to use the ADC_SetScaledGain() for every channel. If the signals do not have gain error, your method would be sufficient.

           

          A3) 10us is OK. You have given enough margin to complete the channel selection @24MHz.

           

          Thanks,

          Sampath

          • 2. Re: SAR ADC offset and AMux_FastSelect questions
            user_279968365

            Hello Sampath,

            Thank you very much for your support.

            Regards,

            Joaquin.