ATmega 328P decoupling capacitor layout in Eagle - Page 1
Forum section: electronics / general

author: Hack.Trix
author_rank: Newbie
timestamp: September 29, 2016, 12:24:12 pm
content: Hello fellow techs!!!!!!!I was hoping for some guidance specific to the ATmega 328P chip. I am designing in Eagle a LAN cable tester, ultimately able to test cable continuity, impedance and possibly TDR (Time Domain Reflectrometry). As you can see in the attached image, I have started (not finished) a schematic in Eagle CADsoft. The question I have is about the decoupling capacitors, based on the image attached can anybody see anything I have done wrong or could improve upon??? The datasheet for the IC suggests the values of the capacitors and that AREF & AVcc pins are decoupled separately to Vcc. This is my first completely designed board from scratch so any advice is appreciated.Thank you!!!!!

author: zapta
author_rank: Super Contributor
timestamp: September 29, 2016, 12:37:41 pm
content: IIRC AREF should be connected just to the capacitor, but to VCC.I would have a bypass capacitor to each of the VCC pins and as close as possible in the layout.The LED in series with the reset doesn't seem right. Remove it.You can use the eagle files of Arduino Mini Pro as an example, it's open source.

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 01:06:34 pm
content: Quote from: zapta on September 29, 2016, 12:37:41 pmOnly if you are using internal voltage reference.

author: Hack.Trix
author_rank: Newbie
timestamp: September 29, 2016, 01:15:26 pm
content: @Zapta & @WraperThank you for your advice, I will go away and find the Arduino Pro Mini schematics you speak of and do some more research on the subject. The link to the open source EagleCADsoft file for the Arduino Pro Mini is below for those who want it.https://www.arduino.cc/en/uploads/Main/Arduino-Pro-Mini-schematic.pdf

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 01:39:14 pm
content: Quote from: wraper on September 29, 2016, 01:06:34 pmAREF is NEVER connected to VCC.3db

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 01:54:00 pm
content: Quote from: 3db on September 29, 2016, 01:39:14 pmReally? And what if you are using external voltage reference?Quote

author: Hack.Trix
author_rank: Newbie
timestamp: September 29, 2016, 02:09:14 pm
content: What is the difference between using an external voltage source versus the internal voltage source for the voltage reference? My understanding is AREF needs to be as stable as possible as this is the reference voltage............therefore, would it not be best to use an external voltage source to negate parasitic load fluctuations which cause the voltage to sag on the AREF pin?

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 02:10:02 pm
content: Quote from: wraper on September 29, 2016, 01:54:00 pmAVCC is NOT to be connected directly to VCC.

author: Hack.Trix
author_rank: Newbie
timestamp: September 29, 2016, 02:49:02 pm
content: @3db regarding this............."AVCC is NOT to be connected directly to VCC"Please see attached cropped picture from the Arduino website. Maybe I am misinterpreting the schematic but it appears that AVCC on pin 18, VCC on pin 4 & 6 are all tied to the voltage source.This is where I get confused because the ATmel data sheet (link below) says the following;"AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected toVCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter."In my application (LAN cable tester), I would need to use the ADC to measure the resistance/impedance and thus the continuity of the LAN cable.The attached pic from the Arduino website doesn't seem to have decoupling capacitors.............why is this when the Atmel datasheet stipulates the requirement for them?http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 03:04:50 pm
content: Quote from: Hack.Trix on September 29, 2016, 02:49:02 pmSee document Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_datasheet.pdf page 313This gives the recommended analog power arrangements.This is why the chip has separate digital and analog VCC and ground pins.I know Arduino don't do this but I just wanted you to be aware of Atmels take on this matter.3db

author: Hack.Trix
author_rank: Newbie
timestamp: September 29, 2016, 03:14:30 pm
content: THANK YOU!!!!!!!

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 03:57:06 pm
content: Quote from: 3db on September 29, 2016, 02:10:02 pmExcuse me, but can youreadthe text?. WHERE it says connecting VCC to AVCC which BTW is not an issue if you don't care about analog performance too much. Or even better - read the datasheet that text is quoted fromhttp://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf. AREF pin is always connected to ADC input. It also can be internally connected (by MCU register) to AVCC or internal VREF or can be externally connected to any voltage source which does not exceed AVCC.

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 04:39:21 pm
content: Quote from: wraper on September 29, 2016, 03:57:06 pmDid you read the Manual for the 328 ?.The OP is asking about decoupling I'm just trying to inform him of best practice according to ATMEL

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 04:48:46 pm
content: Quote from: 3db on September 29, 2016, 04:39:21 pmWTF, I first wrote that AREF pin indeed can be connected to external voltages (to use them as voltage reference), not just a filtering cap for internal voltage reference. This is explicitly written in the datasheet. You made a counter claim which was false. Now you are writing about some mystical best practices not actually related to AREF pin itself, but about VCC/AVCC. Are the best practices to not use anything other than internal VREF, please explain why? Is this it really recommendation by atmel?

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 05:39:49 pm
content: Quote from: wraper on September 29, 2016, 04:48:46 pmOK perhaps I wasn't clear.Yes AREF can be connected to an external reference.I posted that AREF shouldn't really be connected to VCCThe point I was trying to make was that AVCC is the analog supply pin.So if you must connect it directly to AVCC NOT VCC.I'm trying to point out that there are separate supply and ground pins for the digital and analog circuits i.e. THE ADC in the MCU.I've quoted out the page in that manual so it's not a dream.It really is no different to telling the OP that the decoupling caps should be as close to the pins as possible.Atmel also state that AVCC can be within I think it was 300mV of VCCLike I said I'm just trying to inform the OP.3DB

author: retrolefty
author_rank: Super Contributor
timestamp: September 29, 2016, 05:46:14 pm
content: Quote from: 3db on September 29, 2016, 05:39:49 pmQuoteYou were very clear, just not correct.

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 05:46:40 pm
content: Quote from: 3db on September 29, 2016, 05:39:49 pmIf you want to use VCC as reference, because, say, your analog signal(s) are ratiometric to VCC, there is no reason why you would need to connect AREF to AVCC and introducing additional error. If you want filtered VCC as a reference, do exactly that, filter VCC before connecting to AREF.

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 05:53:31 pm
content: @wrapperDo you mean ratiometric ?Atmel Manual5.2.7. AVCCAVCC is the supply voltage pin for the A/D Converter, PC[3:0], and PE[3:2]. It should be externallyconnected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC througha low-pass filter. Note that PC[6:4] use digital supply voltage, VCC.

author: wraper
author_rank: Unknown
timestamp: September 29, 2016, 06:07:17 pm
content: Quote from: 3db on September 29, 2016, 05:53:31 pmYes ratiometric, chrome corrected that for me. The thing is, ADC has it's own power consumption which will produce voltage instabilities on AVCC by itself, especially considering that low pass filter will cause some voltage drop. Therefore if you want to measure against VCC, then measure against VCC and not something else with it's own instabilities/flaws.

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 06:27:25 pm
content: @wrapperLike I said I was just trying to respond to the OP's question.My intention was just to inform him about what's possible.I wasn't setting out to have a big debate

author: 3db
author_rank: Frequent Contributor
timestamp: September 29, 2016, 06:33:09 pm
content: @wraperSorry for spelling you name incorrectly3db

author: westfw
author_rank: Super Contributor
timestamp: September 30, 2016, 09:53:55 am
content: QuoteIf you connect AREF to an external reference, you lose the ability to change the reference setting internally (to Vcc or the bandgap), because it will actually CONNECT AREF to the internal reference; if you connect AREF to a supply voltage, this sounds particularly bad (so you'd want some sort of current-limited voltage reference?) The datasheet says:Quote

author: wraper
author_rank: Unknown
timestamp: September 30, 2016, 05:21:46 pm
content: Quote from: westfw on September 30, 2016, 09:53:55 amWhich I wrote myself and quoted from the datasheet too.

author: Hack.Trix
author_rank: Newbie
timestamp: October 05, 2016, 08:37:23 pm
content: Thank you all so much for your input. I seem to be stuck on laying out the board in Eagle and was hoping for advice again. I have read conflicting info regarding how to deal with AVCC, VCC, AREF and GND/AGND planes for these.My understanding is that since I intend using the AVCC function, I need to connect VCC to AVCC and could do directly without too many noise issues. However, if you read the datasheet on the Atmega 328 it mentions that you should use a low pass filter in this instance.It also mentions something about keeping the AGND plane seperate from the GND and connect only at one point (ideally close to the source of ground). This makes senses but I am having issues actually understanding how this is practically implemented and how to do this in Eagle CADsoft. I have access to a milling machine and use this to mill simple PCB designs, so everything I usually do is single layer/single sided, so please keep this in mind when making suggestions.I have attached a screen shot of the layout as it is at the moment (incomplete).

author: sleemanj
author_rank: Super Contributor
timestamp: October 06, 2016, 12:00:49 am
content: Readhttp://www.atmel.com/Images/Atmel-2521-AVR-Hardware-Design-Considerations_ApplicationNote_AVR042.pdf

author: wraper
author_rank: Unknown
timestamp: October 10, 2016, 12:07:08 am
content: Quote from: Hack.Trix on October 05, 2016, 08:37:23 pmDon't bother with separating ground planes. More likely you'll do worse rather than better, unless really understanding what you are doing. What are your ADC performance requirements? If not high, you may not bother with filtering AVCC. If you don't use ADC, then don't bother with additional AVCC filtering at all.

author: westfw
author_rank: Super Contributor
timestamp: October 10, 2016, 04:08:57 am
content: QuoteThe separate analog ground plane is something you don't particularly need to worry about until you have additional analog components in your design. If the analog inputs of your AVR were attached to some analog amplifiers and external analog muxes and stuff like that, you'd want those components and the analog pins of the AVR to share a ground plane that was isolated from your digital circuitry. Since the average Arduino analog connection is some sort of questionable jumper wired plugged into a flakey socket leading to a surplus component on a breadboard, getting too paranoid is unlikely to be needed. You have to keep in mind the overall accuracy and goodness of your design; I laugh inside when people whine about needing more than a 10bit A2D, but are using 1% resistors... (there are times when this is NOT silly, but still...)