GND vs AGND

Status
Not open for further replies.

summers

Active member
Whats the difference between the GND and the AGND pin. I can see they are connected by an inductor, so hf noise should be disconnected from one side to the other.

Reason I ask, I'll be adding headers to my teensy 3.2; would be good to just do headers on the side, and not use the one at the end. Now board will be powered by battery, I guess connected to one GND or the AGND; what would be good is if I could connect the various SPI devices to the other ground.

Can't see this documented anywhere - have I just missed it?
 
Discussed in numerous threads on the PJRC forum, and in the microcontroller reference tome.

In a nutshell, 'GND' is for digital returns (I2C, I2S, SPI, GPIO, etc), and 'AGND' is the zero equipotential for your analog stuff. You never want digital signal return currents flowing through an analog line. Your end-use application should never allow these two returns to touch, as the Klingon High Council so hath forbade.
 
Ta. Must have just missed the treads - will have to search harder ... ;)

Yes, with the design, I can see if you attach something digital with current demands that switch at high speed, you would get big voltage spikes on the AGND. But what I wasn't sure of why you couldn't connect analog stuff to GND. Guess the only reason I can see is that the teensy defines analogue ground on VREFL or VSSA pins on the CPU.

Anyway I'll dig some harder ...
 
I disagree with never connecting GND to AGND. You have to connect them together somewhere, you don't want them their absolute potentials to be different, that could cause a whole bag of problems in the mixed-signal parts of the Teensy. In fact, it's very important that these two grounds have a very low impedance between them.

However, BJB's comment about not allowing digital currents to flow through analog lines (power, ground or signal connections) is important. The proper way to do this is called "current steering". A common practice is to keep the two grounds separate, then connect them together at a single point, often near the power supply. The digital return currents want to take the path of least resistance back to the power supply. The electrons are not going to all the way back to the power supply then decide to take the scenic route up through the analog circuits.

Keep in mind currents in wires emit/absorb EMI like antennas, so it's not just electrically separate, it's physically separate too. Keep digital wires away from analog wires.
 
Well if you check the schematic looks like there is a filter between GND and AGND.

Between VDD and GND there is an L C L set of components, the AGND comes off between and L and C. So this gives a filter, I'll need to do the math though to work out what kind of filter.
 
Hath spake "Your end-use application should never allow these two returns to touch.."

Now read that again. Did not say to "never" connect gnd and agnd. Said to not connect in the END-USE application.

Human units, you must parse the comments of the other human units literally and carefully. Oft wonder how your species has managed to survive long enough to develop technology. Perhaps Paul Stoffregen is not of the Earth.
 
The inductor between GND and AGND on the little Teensy PCB is already the required connection for the DC return path by blocking RF, noise, and spikes at the same time. That‘s why no other GND/AGND connection shall exist in your peripheral circuit for two main reasons: 1) that would short the inductor and thus kill its filtering capabilities. And 2) that would create a ground loop also known among engineers as the ideal antenna to pick up whatever ambient noise and hum.

Still wondering why people question again and again the clear statements from Paul or other competent senior members like BJB. If you don’t understand what the engineers say, just follow their advice. That saves lots of time and internet bandwidth to everybody.
 
Well there is a certain about of twist in this thread. And to give @Blackaddr and other there due there has to be some thought. Many people on this forum are electrical engineers and know about Earthing design. Some rules:
. Do not make ground loops, ground loops can give rise to circulating currents, and this can give currents flowing where you don't want them
. lines always have some resistance, and also some capacitance to their surroundings. This means that Earth isn't always Earth.
. Its good design to keep circuits with different set up independent as possible, so something switching kept away from other frequencies, and analogues.
. Still you don't want a circuit totally floating, if a circuit has no Earth at all, it can drift and eventually go out of bounds. So even if measuring a floating circuit with a differential amp, if the voltages go outside the inputs of the diff amp then it won't work as expected
. So a holistic circuit you have to Earth somewhere, joining all together. This should be as close to the source as possible, where there is least resistance and capacitance.
So in these points you can see there is truth in all the posts above.

So still begs the question, how would teensy behave without the inductor between GND and AGND? Would this mean that the analogue gets noise from the USB PSB, which is bound to have a bit of switching noise one it. But unless we connect a wire to the mains earth connection - how are we going to do better?

So its the rest of the story we are after ...
 
When it comes to ground design I'd say there are still several camps out. When it comes to the supplies themself, for high quality, low noise analog you need to generate your analog supplies from LDOs that are separate from the digital supplies. I think that is generally well accepted, it's the ground plane design where things get hairy.

15 years ago, when I worked for a video SoC manufacturer, they designed PCBs such that all digital ground and analog ground planes were kept separate, and connected by an inductor at a single point.

10 years ago when I worked for a video broadcast hardware manufacturer, they also connected separate planes at a single point without an inductor, and used current steering techniques to make sure the digital currents wouldn't follow paths near the analog paths in the first place. The belief was the inductor didn't provide zero impedance across all frequencies between the ground planes, and this caused some performance and EMI issues.

I've spent the last 5 years at a defence an aerospace equipment manufacturer. They take it one step further and use a unified ground plane for digital and analog ground. The problem with separate planes is all the various cutouts to ensure isolation results in not enough low impedance return paths for high current digital signals and they would still spill into analog or radiate EMI. With a unified ground plane, extreme care must be taken with part placement, signal routing, and placing no-coppper lanes to steer currents where you need them to go. To me, this is the best approach I've seen, though it makes the PCB design itself far more complicated.

To re-iterate, I think all 3 (and possible more) strategies are still employed in industry, so the jury is still out on what's "Best". I hope this forum can continue to be a place for people to discuss different approaches with out the need for insults, or talking people down. Of course, this is the Internet so that hope may be futile.

I think to answer summers question about what happens if you remove the inductor, my answer is it depends on the PCB layout, and with no inductor there, is that the preferred path for any digital return currents?

I think we can all agree the best idea is to try as many things as you can and see what works for your situation. The best way to have great ideas is to have many ideas!
 
Here is my experience:
1. If you know the circuit requirements precisely (and that usually means a discrete circuit design by yourself), it is possible to drop the noise / distortion quite a bit by using separate grounds, star connections and other techniques.
2. If you use a 3rd party analog or mixed-signal IC (which is usually a black box to the designer) - follow the recommended grounding and layout as close as possible.
3. If you use a 3rd party IC or 3rd party schematics with no no detailed guidelines - use a single solid ground plane next to the component layer in a stack. Power supplies can be decoupled within reason using info about the noise spectrum, RFCs SRF, and capacitor ESR at the frequency range of interest.
4. If you are designing a high power, high efficiency switcher and must comply with EMI requirements - all of the above apply, plus a lot of thinking (and modelling).
 
@Blackaddr; intersting your experience in the aerospace industry, its where I work as well - but I'm in space, on early mission design. This said though often have to work with both digital and analogue electrical engineers; as I need to understand their world (as they need to understand mine).

For space, almost all boards are bespoke. Our approach is usually to have separate earth planes for each area of circuit; in each area the earth is typically an almost 100% layer of copper - it means that currents in the circuit can be exactly matched by return currents in the earth plane. Different earth planes are joined where needed, to give minimal interference between devices. Often we choose different frequencies in different areas, e.g. 25MHz for spacewire, 131kHz for PWM, etc - this means when signals from one circuit get into another part we can trace them through their frequency.

I don't think we have inductors between layers to stop high frequencies, our aim is to match currents in the circuit with the earth layer, and to do that at all frequencies. Its like doing twisted pair, or coax, but in PCB land.

Now as turns to where my question came from, it was really questioning if I could power a SPI device using the AGND and the 3.3V, with no other device on the AGND - so nothing else to mess up. Now an SPI device, with switching up at 1MHz + probably has current demands at 1MHz plus; now pulling this through an inductor, is on reflection ugly. Each current switch would generate spikes on the voltage. Now this would mess up analogue readings, but on reflection I suspect would be big enough spikes to mess up the SPI device - which means a bad idea.

So what I suspect I'll do, is just have all devices (battery, and two spi devices) connected the the GND on the teensy, next to pin 0. Bit messy as it means a connector with wires from 3 devices crimped together. As the 3 wires are crimped together it also means the devices can't be separated, which with one battery is hassle. Probably means when changing the battery will need to unsolder the lead from the battery - or to recrimp the pin - so quite a hassle. Can't see a solution otherwise, if I just use the two side connectors on the teensy3.2.

Let me know if someone sees a better solution.
 
Now as turns to where my question came from, it was really questioning if I could power a SPI device using the AGND and the 3.3V, with no other device on the AGND - so nothing else to mess up. Now an SPI device, with switching up at 1MHz + probably has current demands at 1MHz plus; now pulling this through an inductor, is on reflection ugly. Each current switch would generate spikes on the voltage. Now this would mess up analogue readings, but on reflection I suspect would be big enough spikes to mess up the SPI device - which means a bad idea.

Just a little clarification. You mention there is no other device connected to the AGND other than the SPI device, but you also mention messing up analog readings. Whatever you're taking analog readings from should be connected to AGND right? Can you tell us what you are measuring and what level of precision you need?

If you power the SPI with VDD and return to AGND, yes, that inductor will cause problems because your digital return currents must cross ground domains. I think you were originally thinking of shorting out the inductor? This may still be a valid option. You could certainly try running your SPI devices in that configuration and use spectrum analysis from a scope to see if digital noise is imprinted on your analog measurements. As long as the digital harmonic noise is not in the analog band of interest, perhaps you could filter it out, either on the board on in software using CMSIS-DSP if realtime speed is critical?
 
Yes i may try it out - but as you say, connect it to a scope just to see what happens. Hassle is that means taking it into work to access a scope there, so at the moment just going through the design stage. Now variation in current demands giving spikes on the voltage, makes me wonder why the AGND doesn't have a capacitor to GND, then that would absorb the voltage spike. As design stands there is a capacitor to VDD, but again through another inductor that will stop sudden changes in current.

My circuit in its final form will be: teensy3.2 + battery (into Vin) + SPI pressure sensor + SPI SD card, so everything digital, and both SPI devices need 3.3V + GND; and that will probably be all I can fit inside a kinder egg ....
 
If everything is digital, and you have no concerns about noise on sensitive analog measurements I would just short AGND to GND however is the most convenient. You probably don't even need to remove the inductor. Even if you have the grounds connected at two points instead of one (one shorted somewhere, another through the inductor) any potential ground loop currents won't matter because you're not trying to protect any sensitive analog signals.
 
Hello,i use the current sensor acs711,it is about for a hall-effect sensor.
The pin gnd of the acs711 sensor i have a connection to the pin AGND of teensy 3.6 because the sensor output is analog.
It is right to connect to the pin AGND or is not necessary??
 
Last edited:
Have never been a big fan of these current sensors, but they are functional for simple stuff.

The 'best' design practice would probably be to leave the fault pin open and connect the 'ground' stuff to the Teensy analog return.
 
Status
Not open for further replies.
Back
Top