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.

cc2640 ADC sampling abnormal

Other Parts Discussed in Thread: CC2640, CC2640R2F

chip:cc2640    Pin 4*4
SDK: ble_cc26xx_2_01_01_44627

External hardware structure: ADC sampling by resistor divider

Phenomenon: IO8 is sampled and there is no problem with the sampled value; the code is related to only the IO port is changed to IO9, the sampled value is abnormally small;

Code:

void mmcAdc_doConversion()
{
uint32_t refSource = AUXADC_REF_VDDA_REL;
int32_t gain = 0;
int32_t offset = 0;
int i;
float adcValue30k = 0;

// Enable clock for ADC digital and analog interface (not currently enabled in driver)
AUXWUCClockEnable(AUX_WUC_SOC_CLOCK|AUX_WUC_ADI_CLOCK|AUX_WUC_ADC_CLOCK);
// Disallow STANDBY mode while using the ADC.
Power_setConstraint(Power_SB_DISALLOW);

// Connect AUX IO4 (DIO8) as analog input
AUXADCSelectInput(ADC_COMPB_IN_AUXIO3);
// Set up ADC
AUXADCEnableSync(refSource, AUXADC_SAMPLE_TIME_85P3_US, AUXADC_TRIGGER_MANUAL);

// get adc adjustment gain & offset
gain = AUXADCGetAdjustmentGain(refSource);
offset = AUXADCGetAdjustmentOffset(refSource);


Task_sleep(10);

for ( i = 0; i < CONVERSION_CNT; i ++)
{
AUXADCGenManualTrigger();
while (AUXADCGetFifoStatus() == AUXADC_FIFO_EMPTY_M){}
adcValue30k += AUXADCReadFifo(); 
}
adcValue30k = adcValue30k / CONVERSION_CNT;
adcValue30k = AUXADCAdjustValueForGainAndOffset(adcValue30k, gain, offset);
adc_0715 = adcValue30k;

}

  • Hi,

    Could you elaborate on what the difference is in result for DIO8 and DIO9, I assume the signal connected to both is the same? 

    Also, just to be on the same page, are you working on the CC2640R2F device or CC2640 device (I would expect the *R2F version)?

  • Good afternoon, the external input signal is the same for IO8 and IO9 (3.2V).
    IO8 sampling AD value conversion voltage is the same as the input, use a multimeter to measure the input interface, the voltage value is the same as the input;
    IO9 sampling AD value conversion voltage is about 0.03V, multimeter measurement input interface, the voltage value is 0.03V.

  • So you are measuring the same level externally? In that case, have you verified the configuration of the IO (that it is not used by any other part of the application) and that there is nothing in HW that pulls the signal low?

    Also, assuming you use CC2640R2F, have you tried using the drivers provided by TI and not the register access API (DriverLib)?