This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC1352P: ADC Configuration

Part Number: CC1352P
Other Parts Discussed in Thread: CC1310

Tool/software: TI-RTOS

I'm trying to configure the ADC drivers to read a simple resistor divider ckt that is pulled up to Vdd. I want the counts to remain constant independent of the Vdd battery supply. 

I thought that I could simply configure the adcCC26xxHWAttrs[] setting the .refSource = ADCCC26XX_VDDS_REFERENCE and then the counts returned from ADC_convert() would be the same no matter what the supply is.

I can't seem to find any documentation on how to configure the ADC Driver values, but here's what I have in my board file:

/*

* =============================== ADC ===============================

* The ADC driver operates as a simplified ADC module with only single channel sampling support.

*/

// See *_LAUNCHXL.C for example of configuring this driver

#include <ti/drivers/ADC.h>

#include <ti/drivers/adc/ADCCC26XX.h>

 

ADCCC26XX_Object adcCC26xxObjects[ZFR183x_PWB_ADCCOUNT];

 

const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[ZFR183x_PWB_ADCCOUNT] = {

   {

       .adcDIO             = ZFR183x_PWB_PAN_SW_1s_DIO26,

       .adcCompBInput       = ADC_COMPB_IN_AUXIO4,

       .refSource           = ADCCC26XX_VDDS_REFERENCE,

       .samplingDuration   = ADCCC26XX_SAMPLING_DURATION_2P7_US,

       .inputScalingEnabled = true,

       .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,

       .returnAdjustedVal   = true

   },

   {

       .adcDIO             = ZFR183x_PWB_PAN_SW_10s_DIO27,

       .adcCompBInput       = ADC_COMPB_IN_AUXIO3,

       .refSource           = ADCCC26XX_VDDS_REFERENCE,

       .samplingDuration  = ADCCC26XX_SAMPLING_DURATION_2P7_US,

       .inputScalingEnabled = true,

       .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,

       .returnAdjustedVal   = true

   },

   {

       .adcDIO             = ZFR183x_PWB_PAN_SW_100s_DIO30,

       .adcCompBInput       = ADC_COMPB_IN_AUXIO0,

       .refSource           = ADCCC26XX_VDDS_REFERENCE,

       .samplingDuration   = ADCCC26XX_SAMPLING_DURATION_2P7_US,

       .inputScalingEnabled = true,

       .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,

       .returnAdjustedVal   = false

   },

//   {

//       .adcDIO             = ZFR183x_PWB_BATTERY_V,

//       .adcCompBInput       = ADC_COMPB_IN_AUXIO4,

//       .refSource           = ADCCC26XX_FIXED_REFERENCE,

//       .samplingDuration   = ADCCC26XX_SAMPLING_DURATION_2P7_US,

//       .inputScalingEnabled = true,

//       .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,

//       .returnAdjustedVal   = false

//   },

};

 

const ADC_Config ADC_config[ZFR183x_PWB_ADCCOUNT] = {

   {&ADCCC26XX_fxnTable, &adcCC26xxObjects[ZFR183x_PWB_ADC0], &adcCC26xxHWAttrs[ZFR183x_PWB_ADC0]},

   {&ADCCC26XX_fxnTable, &adcCC26xxObjects[ZFR183x_PWB_ADC1], &adcCC26xxHWAttrs[ZFR183x_PWB_ADC1]},

   {&ADCCC26XX_fxnTable, &adcCC26xxObjects[ZFR183x_PWB_ADC2], &adcCC26xxHWAttrs[ZFR183x_PWB_ADC2]},

//   {&ADCCC26XX_fxnTable, &adcCC26xxObjects[ZFR183x_PWB_ADC3], &adcCC26xxHWAttrs[ZFR183x_PWB_ADC3]},

};

 

const uint_least8_t ADC_count = ZFR183x_PWB_ADCCOUNT;

 

Here's the function call to read the counts.

int8_t adcRead(uint_least8_t adcIndex, uint16_t * pAdcValue)

{

ADC_Handle   adcHandle;

ADC_Params   adcParams;

int8_t       adcStatus = ADC_STATUS_ERROR;

 

if(adcIndex < ZFR183x_PWB_ADCCOUNT)

{

   ADC_Params_init(&adcParams);

   adcHandle = ADC_open(adcIndex, &adcParams);

   adcStatus = ADC_convert(adcHandle, pAdcValue);

   ADC_close(adcHandle);

}

return(adcStatus);

}

I'm getting the raw counts that I expect (+/- 0.5%) when the supply is 3.3vdc.  But when the voltage drops, the counts go up.  

I've tried all combination settings for  .inputScalingEnabled  and .returnAdjustedVal and get the same fluctuation with supply.

What am I doing wrong?

Thanks,

- Bill