Hi,
do anybody have a working code to read voltage values using ADC? i have reffered Heartrate example, but it didnot give me any idea on how to use ADC
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.
Hi,
do anybody have a working code to read voltage values using ADC? i have reffered Heartrate example, but it didnot give me any idea on how to use ADC
Hello Abhijith S,
You can do this by using the Sensor Controller (Check out Sensor Controller Studio). If possible I would advice you to try the sensor controller option. See the e2e post below for info on how to apply error corrections to the measurements:

There is currently no ADC driver for TI-RTOS, but in this post there is an example for how to use the ADC:

Hi Eirik V,
Thank you for your Reply. I already have the driver files and i have seen the second link also. What i am trying is modifiying code for Thermometer(Example code) to dislay some ADC readings instead of temperature on mobile app. For that i have modifeid my code like this
static void Thermometer_handleKeys(uint8_t shift, uint8_t keys)
{
bStatus_t status;
uint8_t notify_interval;
if (keys & KEY_UP)
{
// Set simulated measurement flag index.
thermometerFlagsIdx+=1;
if (thermometerFlagsIdx == FLAGS_IDX_MAX)
{
thermometerFlagsIdx = 0;
}
}
// Read stored interval value.
Thermometer_GetParameter(THERMOMETER_INTERVAL, ¬ify_interval);
if(notify_interval == 0)
{
thMeasTimerRunning = FALSE;
}
if (keys & KEY_RIGHT)
{
// If device is not in a connection, pressing the right key should toggle
// advertising on and off. If timer is running, then will adv when meas is
// ready.
if((gapProfileState != GAPROLE_CONNECTED) && (thMeasTimerRunning == FALSE))
{
uint8_t current_adv_enabled_status;
uint8_t new_adv_enabled_status;
// Find the current GAP advertisement status.
GAPRole_GetParameter(GAPROLE_ADVERT_ENABLED, ¤t_adv_enabled_status);
if(current_adv_enabled_status == FALSE)
{
new_adv_enabled_status = TRUE;
}
else
{
new_adv_enabled_status = FALSE;
}
// Change the GAP advertisement status to opposite of current status.
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
&new_adv_enabled_status);
pinHandle = PIN_open(&pinState, alsPins);
}
// Timer is running, so allow simulated changes.
else
{
// AUXWUCClockEnable(AUX_WUC_MODCLKEN0_SOC_M|AUX_WUC_MODCLKEN0_AUX_ADI4_M);
// AUXADCSelectInput(ADC_COMPB_IN_AUXIO7);
AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL);
// Power_setConstraint(Power_SB_DISALLOW);
AUXADCGenManualTrigger();
thermometerCelcius = AUXADCReadFifo();
AUXADCDisable();
// Power_releaseConstraint(Power_SB_DISALLOW);
// PIN_close(pinHandle);
}
}
}
But not working
Hello Abhijith S,
I would advice you to use the sensor controller instead. You only implemented bits and pieces of the code posted by svendbt and you need to fully understand the power manager to be able to successfully merge ADC functionality into your BLE application. for more information about this, read section "3.3 Guidelines for Driver Writers" in the Power Management for CC26xx SimpleLink Wireless MCUs (C:\ti\tirtos_simplelink_2_14_03_28\docs).
Check out the analog light sensor example code that comes with sensor controller studio and merge the driver into your application.