CE195275 SAR ADC and Die Temperature Sensor with CY8CKIT149

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

cross mob
YoIs_1298666
Level 5
Level 5
250 sign-ins 100 replies posted 100 sign-ins

Hello,

I configured like below.

1.VDDA is the input voltage of theVDDA pin as set in the Design Wide Resources (*.cydwr) System editor.

   VDDA is set to 4.60V.

pastedImage_3.png

   And the vref of ADC_SAR_Seq is selected to VDDA.

pastedImage_24.png

2.ADCCountsCorrected is determined the below equation.

   ADCCountsCorrected = (Refact /1.024) * ADCCounts

    But I think that the vref of Die Temp is 1.20 in case of CY8CKIT-149.

    So, the temperature equal below.

     both DIETEMP_VREF_MV_VALUE and  ADC_SAR_Seq_DEFAULT_VREF_MV_VALUE are

        #define DIETEMP_VREF_MV_VALUE   (1200)

        #define ADC_SAR_Seq_DEFAULT_VREF_MV_VALUE  (4600).

pastedImage_28.png

Is this correct?

Best regards,

Yocchi

0 Likes
1 Solution

Ishii-san,

Perhaps you can try the following code to get the correct die temperature. The u32DieTempGet(void) function will return the correct die temperature. The function can be called in the main while loop.

    int32 u32DieTempGet(void)

    {

      int16 adc_count;

      uint32 u32_regTemp;

      int32 Celsius;

u32_regTemp = CY_GET_REG32(0x403A0000u);

CY_SET_REG32(0x403A0000u, ((u32_regTemp & 0xFFFFFF00u) | 0x00000040u)); /* Before DieTemp measurement, change ADC Vref connection to internal Vref(1.2-V) */

   

ADC_EnableInjection(); /* INJ Channel Enable */

ADC_StartConvert();    /* ADC Convert start */

while(0u == ADC_IsEndConversion(ADC_RETURN_STATUS_INJ)){}

adc_count = ADC_GetResult16((uint32)INJ_CHN);

/* DO NOT need adc count adjusted/calibrated, because Vref has been changed to internal vref (1.2-V) */

           

Celsius = DieTemp_CountsTo_Celsius(adc_count); /* get temp celsius Degree */

             

CY_SET_REG32(0x403A0000u, u32_regTemp); /* after measurement, restore original ADC vref connection register */

      return Celsius;

    }

0x403A0000u is the address of the SAR_CTRL register of PSoC 4100S / 4100S Plus. Bits [6:4] of SAR_CTRL is used for ADC Vref connection control. Before DieTemp measurement, change the Vref connection to internal 1.2 V. After the measurement, restore its connection for normal measurement. The register description is documented in PSoC 4100S and PSoC 4100S Plus register TRM.

View solution in original post

0 Likes
3 Replies
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Ishii-san,

Yes. the vref of Die Temp is 1.20 in case of CY8CKIT-149. DIETEMP_VREF_MV_VALUE should be (4600).

And

If VDDA set as 4.6V in *.cydwr, VDDA, ADC_SAR_Seq_DEFAULT_VREF_MV_VALUE should be 4600.

But please check if the die temp result is correct or not after the modification.

Thanks,

Ryan

0 Likes

Hello Ryan-san,

Unfortunately, in case of VDD vref of ADC_SAR_Seq the variation in the caliculated temperature is large.

If I select Internal Vref, bypassed, there is no variation.

In case of VDD/2, bypassed there is a litte variation.

What do you think?

Best regards,

Yocchi

0 Likes

Ishii-san,

Perhaps you can try the following code to get the correct die temperature. The u32DieTempGet(void) function will return the correct die temperature. The function can be called in the main while loop.

    int32 u32DieTempGet(void)

    {

      int16 adc_count;

      uint32 u32_regTemp;

      int32 Celsius;

u32_regTemp = CY_GET_REG32(0x403A0000u);

CY_SET_REG32(0x403A0000u, ((u32_regTemp & 0xFFFFFF00u) | 0x00000040u)); /* Before DieTemp measurement, change ADC Vref connection to internal Vref(1.2-V) */

   

ADC_EnableInjection(); /* INJ Channel Enable */

ADC_StartConvert();    /* ADC Convert start */

while(0u == ADC_IsEndConversion(ADC_RETURN_STATUS_INJ)){}

adc_count = ADC_GetResult16((uint32)INJ_CHN);

/* DO NOT need adc count adjusted/calibrated, because Vref has been changed to internal vref (1.2-V) */

           

Celsius = DieTemp_CountsTo_Celsius(adc_count); /* get temp celsius Degree */

             

CY_SET_REG32(0x403A0000u, u32_regTemp); /* after measurement, restore original ADC vref connection register */

      return Celsius;

    }

0x403A0000u is the address of the SAR_CTRL register of PSoC 4100S / 4100S Plus. Bits [6:4] of SAR_CTRL is used for ADC Vref connection control. Before DieTemp measurement, change the Vref connection to internal 1.2 V. After the measurement, restore its connection for normal measurement. The register description is documented in PSoC 4100S and PSoC 4100S Plus register TRM.

0 Likes