Barebones ATMEGA328 Circuit and the Conflict Between Pins warning

EEschem is right.
ARef should not be connected to AVcc.

1 Like

I seem to remember a table of error / no error / warning for interconnections between various pins. Unfortunately I don’t recall the location . I think if you peruse the documentation.

In addition, paulvdh is correct, Vref should not be directly connected to Vcc. Although I don’t believe Kicad knows this.

???
The reported error is:

In human language: Warning: Vref is connected to Vcc.

You’re absolutely right. In checking another few schematics of the “barebones Arduino” setup I was trying to produce, some had connected AREF to +5V, but that doesn’t seem to be correct. The SparkFun RedBoard definitely just connects AREF to ground via a capacitor, as can be seen in their schematic.. Thanks for setting me straight. DRC is clear now.

1 Like

Perhaps I worded it poorly. My point was that Kicad does not understand the Atmega328 function of Vref. It only knows the pin type. Unless there is a whole Kicad functionality I am not aware of.

Update:
I found the table I was referring to. In V5 when you press ERC then click “options” the table appears.

1 Like

This FAQ post might be a good read for @metroch: Electrical type of schematic symbol pins (KiCad 4 and KiCad 5)

The ultimate reference in this case would be the datasheet:

The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB. Optionally, AVCC or an internal 1.1V reference voltage may be connected to the AREF pin by writing to the REFSn bits in the ADMUX Register. The internal voltage reference must be decoupled by an external capacitor at the AREF pin to improve noise immunity.

Edit:
Additionally,

If no external voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as reference selection.

After reading those sections again, and looking at the chips block diagram, AVcc or 1.1V are selected internally. There is no need to connect this pin to AVcc. So, unless you are using a voltage other than AVcc or 1.1V the ARef pin should only ever have a capacitor connected.

1 Like

To put that another way, AREF can be either an voltage input or an output. It is fine to connect a voltage input to it. provided the MCU is configured correctly in software.

We have discussed before how to handle pins that are bidirectional, ERC does not and can not know how the software will work, so there is no simple answer. In this case, setting the pin type to bidirectional flags to the user to use caution.

Personally I put a note on the schematic to tell the programmer what the expected software config should be. However, there is also the case that rogue software could accidentally set pins to output, in which case the schematic designer should consider whether to make the circuit robust to that condition or not.

1 Like

While that is true. I think “Bidirectional” is the wrong type for this pin. It is only useful as a voltage input or as a passive connection for a capacitor. And “Power Input” would be even more problematic, so this pin should probably be a “Passive” type. This would still allow it to be used as a voltage input but would be more indicative of it’s common usage.

You can use AREF as a reference voltage when configured as an output, for ADC inputs.

Regardless, dual or multiple use pins are a dynamic feature which is impossible to handle in all cases in ERC, which is a static check.

ARef is a single purpose pin, it provides a reference voltage to the internal ADC. A capacitor is connected to this pin to decouple the internal reference or the internal reference can be turned off so that an external reference can be applied. It is not intended as a reference output. Could you use it as an output? Sure, if you provided adequate buffering without introducing noise into the ADC. Would that be it’s typical usage? Not likely. Would that be a problem if it were of “passive” electrical type? No.

Fact : AREF can be configured as an output, which is reflected in the pin type. Whether it is a good idea or not to use it like that is really irrelevant. I believe there are engineers smart enough to use the pin correctly, despite your misgivings.

Perhaps there should be a new pin type “consult 1.21Gigawatts for advice before using this pin”. :slight_smile:

Please provide the source of the fact you quoted. And refrain from the personal attacks although I know that’s just your nature.

Although @bobc will argue otherwise without really providing you with a solution, this is, in my opinion, the correct approach. Set the pin to “passive” and connect it to a capacitor only.

Yea it says:

Note that VREF is a high impedance source, and only a capacitive load should be connected in a system.

So i personally would choose passive for this pin.

I seem to remember that similar pins have also been assigned passive in the official lib.
To be honest pin type selection is always a bit of a hard topic. Especially for pins like this where it is not really clear. There is not really a pin type fully describing the pin.

My reasoning:

  • Bidirectional (and input/output) would be wrong because there is no information flow.
  • Power output is wrong because it is not intended to supply power
  • Power input is not correct as nothing is powered through this pin

So the only sensible remaining pin types would be Passive or Unspecified. If the selection comes down to these two i favor passive.

1 Like

I would say for a switchable Aref pin, bidirectional would be a valid choice,

The pin has 3 functions, Tied to Aref internally, Tied to a 1.1V bandgap reference, or external input, In the first 2 cases it can be used to supply a small current.

To me it flagging an error on externally tying is valid

Let us suppose for a moment that the pin can be considered an output as well as an input, you honestly think that is in accordance with the intent of the KiCad type “bidirectional”?

And just how much current can it supply without adversely affecting the ADC?

How much clearer does the datasheet need to be?

I would say the intent is for DRC purposes, that this pin can either output something, or act as a passive / input, meaning it should not be directly connected to a power rail or output without throwing a warning,

The amount of current is can supply is uA, but for DRC purposes you do not want to connect it to another output / supply

If your using ratiometric sensors, using the aref pin as an output (generally buffered) it greatly simplifies your designs.

The DRC is meant to reflect what the pin can safely be connected to, in this case it throws a warning as bidirectional, not an error. To me this is the correct behaviour,

If you know what your doing you overlook the warning, acknoledging it, rather than setting every pin of every symbol you make to inputs and trusting yourself to catch those now unflagged issues.

And your source for this? The datasheet specifies the pin as a high impedance pin, as an input it has 50K of impedance. Even 10ua with a 50K impedance would mean the voltage at the reference pin would be 0.5V less than it should be. Now we don’t know if the “high impedance source” means 50K because the datasheet does not give any specifications for this pin as an output. Hmmm … why might that be? :thinking:

But there is nothing wrong with connecting a bidirectional pin to another output. It is, in fact, very common.