cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

thj_2192231
New Contributor II

The HW App Note explains how to use the adc_readVoltage() function to get the voltage seen on a known ADC input channel. This function returns a voltage in mV, and therefore resolution is limited.

In my application I would need the get the ADC output code, so that I can get all 16 bits of resolution. Your API provides the adc_readSampleRaw() function but I don't know what reference is used and how to change it. Ideally I would like to be able to either use Vddio as the voltage reference, or a pin of the module. Is this possible ? In addition, should an ADC calibration be performed before calling adc_readSampleRaw() ? Any information on how to configure the ADC and use this function (reference, output code format, etc.) would be useful.

Thanks in advance.

1 Solution
ArvindS_76
Employee

Though the ADC reads 16 bit samples, the ENOB depends on the sample rate. In the default configuration (sampled at 5.859KHz), you will get 13 ENOB while at 187 KHz, you will get 10 ENOB.

> I don't know what reference is used and how to change it

The default reference is the internal bandgap and voltage range is set to 0-3.6V. You can change the reference the ADC uses to an eternal reference using adc_adcCalibrate(<EXTERNAL_REFERENCE_VOLTAGE_IN_MICRO_VOLTS>, <EXTERNAL_REFERENCE_ADC_CHANNEL>). The reference channel could also be ADC_INPUT_VDDIO or ADC_INPUT_VDD_CORE (in which case reference will be 1.2V - the output of the LDO). You should then be able to use adc_readVoltage() to read any other input channel.

View solution in original post

5 Replies
ArvindS_76
Employee

Though the ADC reads 16 bit samples, the ENOB depends on the sample rate. In the default configuration (sampled at 5.859KHz), you will get 13 ENOB while at 187 KHz, you will get 10 ENOB.

> I don't know what reference is used and how to change it

The default reference is the internal bandgap and voltage range is set to 0-3.6V. You can change the reference the ADC uses to an eternal reference using adc_adcCalibrate(<EXTERNAL_REFERENCE_VOLTAGE_IN_MICRO_VOLTS>, <EXTERNAL_REFERENCE_ADC_CHANNEL>). The reference channel could also be ADC_INPUT_VDDIO or ADC_INPUT_VDD_CORE (in which case reference will be 1.2V - the output of the LDO). You should then be able to use adc_readVoltage() to read any other input channel.

View solution in original post

thj_2192231
New Contributor II

Thanks for the prompt reply.

What is the output code format of adc_readSampleRaw() ? For an input voltage between GND and Vref, I'm getting readings between -1150 and 25570. Should any calibration be performed ? Is there any ground offset ?

0 Likes
ArvindS_76
Employee

Is there any reason you don't want to use adc_readVoltage()? This already does all the conversions that are needed to give you a voltage between GND and Vio.

thj_2192231
New Contributor II

I would like to have the highest resolution (13 effective number of bits according to your response above). According to my tests it looks like when using adc_readVoltage() we have less resolution compared to using adc_readSampleRaw().

0 Likes
ArvindS_76
Employee

ADC_INPUT_VSS is GND. So you should be able to read GND and the known reference to calibrate the raw samples. Also try reading ADC_INPUT_VSS between reading samples of the input signal to see if that helps.