ADC SAR Seq change to External VRef dynamically

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaPe_1936286
Level 3
Level 3
First like received First like given Welcome!

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 ?

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

View solution in original post

4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

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.

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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.

pastedImage_0.png

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

0 Likes

Hi,

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

Thank you and Best Regards.

Maurizio

0 Likes