Hi
I am using SensorTag cc2650 hardware and CCS, and I am trying to read values from ADC. But, I get strange values. For testing I am trying to read pin DIO_30, that is tied to VDD. This is illustrated in the clip below.
I am using my own software and have changed the standard Board.c and Board.h file, and initiate the GPIO like this:
// Anlog input
#define Board_Flow_ADC_Pin IOID_30
PIN_Config BoardGpioInitTable[] = {
Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
Board_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
Board_KEY_RIGHT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
Board_BUZZER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Buzzer initially off */
PIN_TERMINATE
};
PIN_Config flowPins[] = {
Board_Flow_ADC_Pin | PIN_INPUT_DIS | PIN_GPIO_OUTPUT_DIS ,
PIN_TERMINATE
};
At start I initiate the pin:
m_flowPinHandle = PIN_open(&m_flowPinState, flowPins);
I am reading the ADC values in the loop by this code:
// Enable clock for ADC digital and analog interface (not currently enabled in driver) // This is for starting the Sensor Controller (AUX) - AL AUXWUCClockEnable(AUX_WUC_MODCLKEN0_SOC_M|AUX_WUC_MODCLKEN0_AUX_ADI4_M); // Connect AUX as analog input. AUXADCSelectInput(Board_Flow_ADC_Pin); // Set up ADC AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL); // Disallow STANDBY mode while using the ADC. Power_setConstraint(Power_SB_DISALLOW); // Trigger ADC sampling AUXADCGenManualTrigger(); // Pop sample from FIFO // Note that the first conversion may be invalid if the sampling period is too short. uint32_t singleSample = AUXADCReadFifo(); // Throw away first ? AUXADCGenManualTrigger(); singleSample = AUXADCReadFifo(); // Disable ADC AUXADCDisable(); // Allow STANDBY mode again Power_releaseConstraint(Power_SB_DISALLOW);
I am expecting singleSample in the range of 3.3V/4.3V * full range (4096) -> 3143. The values I am reading is around 543 (decimal).
Is this correct. Am i doing anything wrong here?
What should I expect?
Is the value signed?
Regards Arne