Tool/software: TI-RTOS
Hello,
I need read adc data from DIO8.of CC2650 in RHB package. DIO8 can be set to either digital or analog.
I started with the CC2650 launchpad ADC example project and it works well with both adc channels:
#define Board_ADC0 CC2650_LAUNCHXL_ADCVSS
#define Board_ADC1 CC2650_LAUNCHXL_ADCVDDS
Now I need re- wire ADC1 to DIO8
1: in Board.h, I change the definition:
#define Board_ADC0 CC2650_LAUNCHXL_ADCVDDS
#define Board_ADC1 CC2650_LAUNCHXL_ADC0 // IOID_8
2: in cc2650_launchxl.h
#define Board_DIO8_ANALOG IOID_8
3: cc2650_launchxl.c lookup table, change to IDOI8
const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[] = {
{PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
{PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
{PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
// {Board_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
{Board_DIO8_ANALOG, ADC_COMPB_IN_AUXIO7},
4: in hardware attributes, modify the first config accordingly:
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650_LAUNCHXL_ADCCOUNT] = {
{
.adcDIO = Board_DIO8_ANALOG,
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
.refSource = ADCCC26XX_VDDS_REFERENCE, // ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
5: set pintable:
const PIN_Config BoardGpioInitTable[] = {
Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
Board_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
Board_PwrEnb | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, // Enable regulator
Board_DIO8_ANALOG | PIN_INPUT_DIS|PIN_GPIO_OUTPUT_DIS, // I tried enable, disable, or ignore, no difference
However, I even couldn't get stable reading no matter I tie IDIO8 to Vcc or GND:
Did I miss any steps?
Thanks for help!
PJ