I want to measure current and voltage of switching power supply that is on board together with ATMEL AT32UC3L microcontroller.
I think I understand how to measure - using resistor divider to lower voltage so it does not exceed ADVREF, and to use current monitor IC that will convert current across shunt resistor into proportional voltage.
What I don't understand is how to connect resistor divider and current monitor grounds. Should they be connected to analog or digital ground?
If I connect them to analog ground, will I not introduce noise to it?
If I connect them to digital ground, will I have correct values as AD[x] inputs measure against AGND?
Or there might be other solutions?
Thanx for advice.
Analog ground is just a way to subdivide grounding planes into isolated sections where you avoid having noisy digital return currents flowing through the current return for sensitive measurement stages.
To illustrate the purpose of two grounds here is a conceptual schematic
NO seperate Grounds
Now in this simplified diagram V_MEAS is the voltage source that represents your analog measurement components, where V_DIGITAL represents the digital signalling. VM1 is the ADC on your microcontroller and VM2 is the digital communications section of the microcontroller. In this scenario since both V_MEAS and V_DIGITAL are referenced to the same "ground", but due to intrinsic resistances in the return path, the voltage measurement taken at VM1 and VM2 depends on the current through R1 at the time. If you have low current analog sources sharing a current return with noisy and relatively high current signals then noise becomes and issue
With seperate grounds
By separating grounds you are "decoupling" the analog and digital sections to avoid this effect, however both parts of the circuit should generally still be referenced to the same "0" voltage level so the grounds are usually tied together, the most convenient place to tie them together is directly at the ADC, but for more complex measurements set ups there are other options.
Generally you want to separate grounds to separate current return paths, but those grounds still will need to be referenced together in order to have circuits that function across different grounds. In order to avoid ground loops (more noise!) it is generally best to tie those grounds together at a single point and the ADC (microcontroller) is a good place to do so.
For more information a good place to start is This Analog Devices White Sheet. An example figure from this document illustrating the same issue is shown below.