Hi, everyone,
Now I can get the adc value in CC1310 , but the value is not accurate, and it is always less than the right value. In TRM, I find that
"The ADC is production-trimmed and it is possible to compensate for ADC gain and offset errors in software by reading the factory configuration page(see Section 9.2, Factory Configuration(FCFG))."
I use "SmartRF Flash Programmer2 ver.1.7.2" to get that SOC_ADC_REF_GAIN_TEMP1 I= 0x840C and SOC_ADC_REF_OFFSET = 0xFB. Could anyone tell me how to use these to compensate for ADC gain and offset errors in software?
The following is my code of ADC:
----------------------------------------------------------------------------------------------------------------------------------------------------------------
int8_t LMT70_AdcSample(uint16_t adcSamples[], uint16_t countSample, uint16_t interval_ms) { if (using == false) { return -1; } // Let TAO pin be connected to the temperature output voltage. PIN_setOutputValue(pinHandle, lmt70_params.T_ON, LMT70_T_ON_ACTIVE); // Enable clock for ADC digital and analog interface (not currently enabled in driver) AUXWUCClockEnable(AUX_WUC_MODCLKEN0_ANAIF_M | AUX_WUC_MODCLKEN0_AUX_ADI4_M); // Connect AUX IOX as analog input. AUXADCSelectInput(lmt70_params.AUX_IO); // Set up ADC: sampling mode, sampling time for continuous mode, reference source AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_21P3_US, AUXADC_TRIGGER_MANUAL); // Disallow STANDBY mode while using the ADC. Power_setConstraint(PowerCC26XX_SB_DISALLOW); uint8_t currentSample = 0; while (currentSample < countSample) { //Sleep 100ms in IDLE mode Task_sleep((uint32_t) (interval_ms * 1000 / Clock_tickPeriod)); // Trigger ADC sampling AUXADCGenManualTrigger(); // Wait in IDLE until done Semaphore_pend(hSem, BIOS_WAIT_FOREVER); adcSamples[currentSample++] = singleSample; } // Disable ADC AUXADCDisable(); // Allow STANDBY mode again Power_releaseConstraint(PowerCC26XX_SB_DISALLOW); // Let TAO output be open PIN_setOutputValue(pinHandle, lmt70_params.T_ON, LMT70_T_ON_INACTIVE); return 0; }
---------------------------------------------------------------------------------------------------------------------------------------------
Best Regards,
Gilbert