4 Replies Latest reply on Jul 31, 2018 8:13 AM by tecnico_1936286

    ADC SAR Seq change to External VRef dynamically

    tecnico_1936286

      I’m using Bit 6:4 of CYREG_SAR_CTRL register to change the Vref values dynamically and I can change between different internal VRefs:

      CY_SET_REG32(CYREG_SAR_CTRL, (CY_GET_REG32(CYREG_SAR_CTRL) & 0xFFFFFF0F) | 0x000000C0); //1.024 reference with Vref Bypass cap

      CY_SET_REG32(CYREG_SAR_CTRL, (CY_GET_REG32(CYREG_SAR_CTRL) & 0xFFFFFF0F) | 0x000000E0); //VDDA/2 reference with Vref Bypass cap

      CY_SET_REG32(CYREG_SAR_CTRL, (CY_GET_REG32(CYREG_SAR_CTRL) & 0xFFFFFF0F) | 0x000000F0); // VDDA reference with Vref Bypass cap

       

      Now I need to set registers to change from Internal Vref to External Vref. How can I do this ?

        • 1. Re: ADC SAR Seq change to External VRef dynamically
          vsrs

          Hi,

          Please try,

          CY_SET_REG32(CYREG_SAR_CTRL, (CY_GET_REG32(CYREG_SAR_CTRL) & 0xFFFFFF0F) | 0x00000050);

           

          You can check the 15.1.1 SAR CTRL register section in the register TRM http://www.cypress.com/file/136296/download

           

          Best Regards,

          VRS

          1 of 1 people found this helpful
          • 2. Re: ADC SAR Seq change to External VRef dynamically
            tecnico_1936286

            Thank you VRS for your answer.

            I applied your solution and it works but I can use it only if I don't have the ByPass Cap, and the TopDesign is configured with External Vref so than I can place the External VRef pin.

             

            Now my problem is to use both "VDDA/2 with Bypass Cap" and "External VRef".

            The problem is to configure on the TopDesign both the pins for ByPass Cap and the Externa VRef.

            If I set the TopDesign with "VDDA/2 bypassed" I can place only the BypassCap pin

            If I set the TopDesign with "External VRef" I can place only the External VRef pin

            I don't know how to do this.

            • 3. Re: ADC SAR Seq change to External VRef dynamically
              vsrs

              Hi,

               

              Unfortunately as per design the same pins is used for external vref and and bypass capacitor. Now if you have not used your amux bus for any purpose( as an amux component / due to routing constrains  or for components like capsense) you may be able to use two different pins for this purpose. You can connect two pins in firmware in using the amux bus.

               

              Please see the attached image. In CYDWR -> Analog , you can see the switches and their respective register address. You can make use of SET_REG32 API.

               

              There are draw backs to this step as there are switch resistances of 150ohm per each switch. Could you please try this method and see if it works.

               

              Best Regards,
              VRS

              • 4. Re: ADC SAR Seq change to External VRef dynamically
                tecnico_1936286

                Hi,

                at the moment I think to keep the configuration without the ByPass Cap.

                Thank you and Best Regards.

                Maurizio