Jump to content

Measuring external voltage

Recommended Posts

I am using the adc_soc example to convert an analog voltage signal to a digital one. The pins that the example uses are ADCINA (J1.6) and ADCINA2 (J1.8). I first connected


J1.6 : 3.3 V pin

J1.8 : GND pin


and received very nice digital values of ~4096 and 0, respectively. What is important is that each of these functions individually. In other words, if I disconnect pin J1.8, for example, I still have a reading of 4096 V from J1.6.


However, what I really want to do is measure the voltage signal from a battery pack (which is also divided by a voltage divider) which is equal to ~2.88 V. So, I connected


J1.6 : 2.88 V

J1.8 : analog GND


and received digital values of ~3200 and ~250, respectively. Moreover, when I measure these pins individually these values change to ~1900 and ~1800.


I realize that I need a good reference value (or I need to incorporate this into my code), but I am uncertain how I should proceed. I read that I need to do something with VREFLO and VREFHI, but that there are no pins designated for VREFLO and VREFHI. How should I set these reference values?


Link to post
Share on other sites

I found the document:


TMS320x2802x, 2803x Piccolo Analog-to-Digital
Converter (ADC) and Comparator Reference guide


To be helpful, if you dont have it.


Search for SPRUGE5F on TI's site.


I think in your ADC_init code you want:


ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Int);   // sets adc to internal reference

According to the chips data sheet pin 12 on the Tms320F28027 is VREFLO.

Datasheet also says it always tied to ground.


or for external source:


ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Ext);  // for external reference source

In this case you would have your VREFHI connected to pin 10 on the micro(J5.6 on C2000 launchpad)


I looked at the example you are using and its in there as an internal source.


Hope this helps




Link to post
Share on other sites

The error you're seeing could also be caused by the first sample errata on these parts.  Basically when you fire off a SOC, the first conversion it does has some error to it.  In the examples you should see that two SOC are configured for the same trigger source.  The result from the first sample is throw away and the second is used.  Make sure you are doing this in your code.


Another thing to consider is that for really high quality A to D conversion you want to buffer the signal you're trying to read.  This is more of an issue for dynamic signals, but do be mindful of the impedance you are driving the ADC with.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...