Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC2640: Understanding ADC voltage reference and setting it

$
0
0

Part Number:CC2640

Could someone confirm (and help with coding) that I have selected the best path to obtain readings of the highest resolution on the analog voltages which I need to read (without having to input an external reference voltage)?

Here is my situation:

1. I power my CC2640 with 2.8 volts from a MIC5205-2.8YM5-TR 

2. The maximum input voltage that will be seen on my ADC pin will be 0.5 volts.

My thought path:

Option 1. In the TRM, I see that I could use VTRIM to get a reference voltage as low as 1.3 volts but that is still quite a bit above the voltage I will be reading:

Option 2. Then I see that in SWRS176B –FEBRUARY 2015–REVISED JULY 2016, I can use a VDDS relative reference as follows and I would be able to get a reference of 2.8/2.82 = 0.992 volts:

It appears to me that Option 2 is my best bet BUT I will still only be using ~1/2 of the 12 bit ADC range.  

AND, if I am correct, could someone help with the coding to accomplish this?

I started with the ProjectZero example code.

What code would set the reference to VDDS RELATIVE with no scaling.

I know I have to set bit 3 of ADCREF0 but I am such a newbie that I don't see how to set this bit?

AND how do I make sure that voltage scaling is disabled, can't even find a register for that?

So far I have been reading ADC with the 4.3 volt reference using adc.h functions as described in adc.h shown below:

* ## Opening the driver #
*
* @code
* ADC_Handle adc;
* ADC_Params params;
*
* ADC_Params_init(&params);
* adc = ADC_open(Board_ADCCHANNEL_A0, &params);
* if (adc != NULL) {
* ADC_close(adc);
* }
* @endcode
*
* ## Converting #
* A ADC conversion with a ADC peripheral is started by calling ADC_convert().
* The result value is returned by ADC_convert() once the conversion is finished.
*
* @code
* int_fast16_t res;
* uint_fast16_t adcValue;
*
* res = ADC_convert(adc, &adcValue);
* if (res == ADC_STATUS_SUCCESS) {
* //use adcValue
* }
* @endcode


Viewing all articles
Browse latest Browse all 262198

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>