Part Number: CC1352R
Hy,
I am not able to read any analog voltages over ADC with TI driver ADC.h. I started from scratch with project adcsinglechannel_CC1352R1_LAUNCHXL_tirtos_ccs from C:\ti\simplelink_cc13x2_26x2_sdk_3_10_01_11\examples\rtos\CC1352R1_LAUNCHXL\drivers\adcsinglechannel.
I have the following code now:
CC1352R1_LAUNCHXL.h
/* Analog Capable DIOs */ #define CC1352R1_LAUNCHXL_DIO23_ANALOG IOID_24
CC1352R1_LAUNCHXL.c
/*
* =============================== ADC ===============================
*/
#include <ti/drivers/ADC.h>
#include <ti/drivers/adc/ADCCC26XX.h>
ADCCC26XX_Object adcCC26xxObjects[CC1352R1_LAUNCHXL_ADCCOUNT];
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352R1_LAUNCHXL_ADCCOUNT] = {
{
.adcDIO = CC1352R1_LAUNCHXL_DIO23_ANALOG,
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL,
.returnAdjustedVal = false
},
adcsinglechannel.c
void *threadFxn1(void *arg0)
{
uint16_t i;
ADC_Handle adc;
ADC_Params params;
int_fast16_t res;
ADC_Params_init(¶ms);
adc = ADC_open(Board_ADC0, ¶ms);
for (i = 0; i < ADC_SAMPLE_COUNT; i++) {
res = ADC_convert(adc, &adcValue1[i]);
if (res == ADC_STATUS_SUCCESS) {
adcValue1MicroVolt[i] = ADC_convertRawToMicroVolts(adc, adcValue1[i]);
}
}
ADC_close(adc);
return (NULL);
}
When I run the program I set a break poin at res = AD_convert and set different voltages to the pin DIO_24 (1.75V 1.62V 1.52V 1.43V 1.27V)
But the AD converter reads 184 on the very first measurement, then 152-154, independent on the actual input voltage.
Whats happening here? Might it be a hardware defect? Do I Initialize the AD converter incorrect?
Whats the maximum voltage, the pin can survive? I understand, when I set .inputScalingEnabled it can measure up to 1.4785V. What if input is higher? Would it damage the pin?
Any help appreciated
Harald

