Author Topic: ATmega 328P decoupling capacitor layout in Eagle  (Read 12532 times)

0 Members and 1 Guest are viewing this topic.

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
ATmega 328P decoupling capacitor layout in Eagle
« on: September 29, 2016, 12:24:12 pm »
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!!!!!
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #1 on: September 29, 2016, 12:37:41 pm »
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.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #2 on: September 29, 2016, 01:06:34 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.
 

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #3 on: September 29, 2016, 01:15:26 pm »
@Zapta & @Wraper

Thank 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
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #4 on: September 29, 2016, 01:39:14 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.

AREF is NEVER connected to VCC.

3db
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #5 on: September 29, 2016, 01:54:00 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.

AREF is NEVER connected to VCC.

3db
Really? And what if you are using external voltage reference?
Quote
If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference
voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied
to the AREF pin, the user may switch between AVCC and 1.1V as reference selection. The first ADC conversion
result after switching reference voltage source may be inaccurate, and the user is advised to discard this result.
 

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #6 on: September 29, 2016, 02:09:14 pm »
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?
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #7 on: September 29, 2016, 02:10:02 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.

AREF is NEVER connected to VCC.

3db
Really? And what if you are using external voltage reference?
Quote
If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference
voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied
to the AREF pin, the user may switch between AVCC and 1.1V as reference selection. The first ADC conversion
result after switching reference voltage source may be inaccurate, and the user is advised to discard this result.

AVCC is NOT to be connected directly to  VCC.  |O


 

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #8 on: September 29, 2016, 02:49:02 pm »
@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 to
VCC, 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
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #9 on: September 29, 2016, 03:04:50 pm »
@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 to
VCC, 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

See document Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_datasheet.pdf page 313
This 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   ;D

 

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #10 on: September 29, 2016, 03:14:30 pm »
THANK YOU!!!!!!!
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #11 on: September 29, 2016, 03:57:06 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.

AREF is NEVER connected to VCC.

3db
Really? And what if you are using external voltage reference?
Quote
If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference
voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied
to the AREF pin, the user may switch between AVCC and 1.1V as reference selection. The first ADC conversion
result after switching reference voltage source may be inaccurate, and the user is advised to discard this result.

AVCC is NOT to be connected directly to  VCC.  |O
:palm: Excuse me, but can you read the text?  :palm:. 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 from http://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.
« Last Edit: September 29, 2016, 04:01:55 pm by wraper »
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #12 on: September 29, 2016, 04:39:21 pm »
IIRC AREF should be connected just to the capacitor, but to VCC.
Only if you are using internal voltage reference.

AREF is NEVER connected to VCC.

3db
Really? And what if you are using external voltage reference?
Quote
If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference
voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied
to the AREF pin, the user may switch between AVCC and 1.1V as reference selection. The first ADC conversion
result after switching reference voltage source may be inaccurate, and the user is advised to discard this result.

AVCC is NOT to be connected directly to  VCC.  |O
:palm: Excuse me, but can you read the text?  :palm:. 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 from http://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.

Did 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   |O |O


 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #13 on: September 29, 2016, 04:48:46 pm »
Did 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   |O |O
WTF, 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?
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #14 on: September 29, 2016, 05:39:49 pm »
Did 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   |O |O
WTF, 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?

OK perhaps I wasn't clear.
Yes AREF can be connected to an external reference.
I posted that  AREF shouldn't really be connected to VCC
The 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  VCC

Like I said I'm just trying to inform the OP.

3DB
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #15 on: September 29, 2016, 05:46:14 pm »
Did 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   |O |O
WTF, 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?

OK perhaps I wasn't clear.
Yes AREF can be connected to an external reference.
I posted that  AREF shouldn't really be connected to VCC
The 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  VCC

Like I said I'm just trying to inform the OP.

3DB

Quote
OK perhaps I wasn't clear.

 You were very clear, just not correct.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #16 on: September 29, 2016, 05:46:40 pm »
Did 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   |O |O
WTF, 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?

OK perhaps I wasn't clear.
Yes AREF can be connected to an external reference.
I posted that  AREF shouldn't really be connected to VCC
The 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  VCC

Like I said I'm just trying to inform the OP.

3DB
If 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.
« Last Edit: September 29, 2016, 06:02:51 pm by wraper »
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #17 on: September 29, 2016, 05:53:31 pm »
@wrapper
Do you mean ratiometric ?

Atmel Manual

5.2.7. AVCC
AVCC is the supply voltage pin for the A/D Converter, PC[3:0], and PE[3:2]. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through
a low-pass filter. Note that PC[6:4] use digital supply voltage, VCC.
« Last Edit: September 29, 2016, 06:02:10 pm by 3db »
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #18 on: September 29, 2016, 06:07:17 pm »
@wrapper
Do you mean ratiometric ?

Atmel Manual

5.2.7. AVCC
AVCC is the supply voltage pin for the A/D Converter, PC[3:0], and PE[3:2]. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through
a low-pass filter. Note that PC[6:4] use digital supply voltage, VCC.
Yes ratiometric, chrome corrected that for me  :blah:. 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.
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #19 on: September 29, 2016, 06:27:25 pm »
@wrapper

Like 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  ;D
 

Offline 3db

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: gb
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #20 on: September 29, 2016, 06:33:09 pm »
@wraper

Sorry for spelling you name incorrectly  :palm:

3db  ;D


 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #21 on: September 30, 2016, 09:53:55 am »
Quote
I first wrote that AREF pin indeed can be connected to external voltages (to use them as voltage reference)
If 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
   [size=0pt]If the user has a fixed voltage source connected to the AREF pin, the user may not use the other reference voltage options in the application, as they will be shorted to the external voltage. If no external voltage is applied to the AREF pin, the user may switch between AV[/size]CC [size=0pt]and 1.1V as ref- erence selection. [/size]   
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16860
  • Country: lv
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #22 on: September 30, 2016, 05:21:46 pm »
Quote
I first wrote that AREF pin indeed can be connected to external voltages (to use them as voltage reference)
If 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:
Which I wrote myself and quoted from the datasheet too.
 

Offline Hack.TrixTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: ATmega 328P decoupling capacitor layout in Eagle
« Reply #23 on: October 05, 2016, 08:37:23 pm »
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). 
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf