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.

CC2650DK: How to use 3 analog sensor thru ADC device using SmartRF06B

Part Number: CC2650DK

Hi All,

for my project I'm using C:\ti\simplelink\zstack_home_1_02_02a_44539\Projects\zstack\HomeAutomation\SampleTemperatureSensor

and for ADC part I'm taking it from adcsinglechannel_CC2650DK_7ID_TI from the Code Composer example

currently I already success to connect 1 analog sensor to CC2650. I connect it to  P407, RF2.5.

but my project require me to connect 3 sensor. on which port i should connect it ? 

for current configuration I use 

adc = ADC_open(Board_ADC1, &params);

/* Get handle for this driver instance */
handle = (ADC_Handle)&(ADC_config[index/*Board_ADC1*/]);

#define     Board_ADC1              CC2650DK_7ID_ADCALS

typedef enum CC2650DK_7ID_ADCName {
CC2650DK_7ID_ADCALS = 0,
CC2650DK_7ID_ADCDCOUPL,
CC2650DK_7ID_ADCVSS,
CC2650DK_7ID_ADCVDDS,
CC2650DK_7ID_ADCCOUNT
} CC2650DK_7ID_ADCName;

const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650DK_7ID_ADCCOUNT] = {
{
.adcDIO = Board_DIO23_ANALOG,
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_DCOUPL,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_VSS,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_VDDS,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
}
};

const ADC_Config ADC_config[] = {
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[0], &adcCC26xxHWAttrs[0]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[1], &adcCC26xxHWAttrs[1]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[2], &adcCC26xxHWAttrs[2]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[3], &adcCC26xxHWAttrs[3]},
{NULL, NULL, NULL},
};

thx for your help

regards 

Tonny S

  • If you intend to find another two ADC input, you can use DIO_24~DIO_30.

  • Hi YK,

    I just define like this :
    #define Board_ADC1 CC2650DK_7ID_ADCALS
    #define Board_ADC2 CC2650DK_7ID_ADCDCOUPL
    #define Board_ADC3 CC2650DK_7ID_ADCVSS

    const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650DK_7ID_ADCCOUNT] = {
    {
    .adcDIO = Board_DIO23_ANALOG,
    .adcCompBInput = ADC_COMPB_IN_AUXIO7,
    .refSource = ADCCC26XX_FIXED_REFERENCE,
    .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
    .inputScalingEnabled = true,
    .triggerSource = ADCCC26XX_TRIGGER_MANUAL
    },
    {
    .adcDIO = Board_DIO24_ANALOG,
    .adcCompBInput = ADC_COMPB_IN_DCOUPL,
    .refSource = ADCCC26XX_FIXED_REFERENCE,
    .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
    .inputScalingEnabled = true,
    .triggerSource = ADCCC26XX_TRIGGER_MANUAL
    },
    {
    .adcDIO = Board_DIO25_ANALOG,
    .adcCompBInput = ADC_COMPB_IN_VSS,
    .refSource = ADCCC26XX_FIXED_REFERENCE,
    .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
    .inputScalingEnabled = true,
    .triggerSource = ADCCC26XX_TRIGGER_MANUAL
    },

    and call it like this ?
    adc1 = ADC_open(Board_ADC1, &params);
    adc2 = ADC_open(Board_ADC2, &params);
    adc3 = ADC_open(Board_ADC3, &params);

    on the smartRF06 which PIN i can use for other sensor ?

    thx for your help
    regards
    Tonny S
  • Hi YK,

    sorry I haven't understand the system yet,
    I already try to use DIO24 and DIO25 as an ADC input but when I run ADC_Open function, it always return NULL
    Could you help me, what is the parameter that i miss

    /*
    * ======== ADC_open ========
    */
    ADC_Handle ADC_open(uint_fast16_t index, ADC_Params *params)
    {
    ADC_Handle handle;

    if ((int_fast16_t)index >= ADC_count) {
    return (NULL);
    }

    /* Get handle for this driver instance */
    handle = (ADC_Handle)&(ADC_config[index]);

    return (handle->fxnTablePtr->openFxn(handle, params));
    }

    I add this on the config for DIO24 and DIO25

    /* Temp Sensor */
    #define Board_TEMP_OUT IOID_24 /* P2.5 */
    /* TDS Sensor */
    #define Board_TDS_OUT IOID_25 /* P2.5 */

    PIN_Config BoardGpioInitTable[] = {
    Board_TEMP_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    Board_TDS_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    }

    PIN_Config AlsPinTable[] =
    {
    Board_ALS_PWR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* Turn on ALS power */
    Board_TEMP_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    Board_TDS_OUT | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    PIN_TERMINATE /* Terminate list */
    };

    PIN_open(&pinState, AlsPinTable);

    Thx for your help
    regards
    Tonny S
  • Different ADC channel cannot work at the same time. You should use ADC_open right before you do read to specific channel.
  • HI YK,

    I just change the implementation using AUXADCGenManualTrigger with AUXADCReadFifo, and it is working, i can tap up to 7 pin, and already testing for 2 simultaneous sensor attach to different pin.

    thx for your help
    Regards
    Tonny S
  • You are welcome and it's good to know it works now.