0

I'm designing a board based on ATmega328p in TQFP package. I'm not using all the ports, so, for example, ports from PC0->PC5, ADC6 and ADC7 won't be connected to anything.

Can I left them unconnected or is it better to connect them to ground (or VCC)? I do not have to read from these ports, so even if there will be some noise, it will be not a problem for me.

What is the best practice in this case?

Thank you!

Marcus Barnet
  • 171
  • 2
  • 12
  • Similar question: [How should unused I/O pins be configured on ATMega328P for lowest power consumption?](https://electronics.stackexchange.com/q/43460/56807) – maxschlepzig Jan 10 '22 at 21:01

3 Answers3

2

If your software is not looking at those pins for any reason you can set them as outputs in the configuration bits and leave them disconnected from the circuit. They will act as anchors after the part is soldered to help keep it in place.

1

I normally leave them unconnected and program them as output.

I would never connect them to ground or VCC if only to prevent a short circuit when the program is developed/changed. If you want to do that, use a resistor. But that increases the price of the product and may make routing the PCB more difficult. The resistor pads can also be used to connect a wire to if you suddenly find you do need an extra input/output. (Murphy's law!)

In fact I just finished a prototype PCB where I added some contact pads to unused pins, just in case....

Oldfart
  • 14,212
  • 2
  • 15
  • 41
  • So, do you suggest to connect them to ground by using a resistor? In this way, i can remove the resistor and solder a wire if I'll need it in future. Is it correct? – Marcus Barnet May 31 '18 at 18:20
  • 1
    I suggest you leave them open and program them as output. Then it also does not matter if the are output high or low as no power is consumed. With resistors to ground you have to program them as output *and* set them low. PCB routing is also easier which might benefit the connected part of the design (Shorter tracks). By the way you **always** make pads for all pins connected or not. – Oldfart May 31 '18 at 18:57
  • Thank you!So, I think I will let them unconnected and I will set them as output by software. I will add the pads also for the unconnected pins for the microcontroller. – Marcus Barnet May 31 '18 at 21:10
1

Option 1.) Set as input, and use an external resistor to pull it to VCC or GND.

Option 2.) Leave them unconnected on the PCB, and through software make them all inputs and enable the input pullups. This is less expensive than 1.) in terms of board area and cost, but depending on your application can pose problems on startup if you're in a noisy environment as some pins default to hi-z.

Option 3.) Leave unconnected on the PCB, and drive as an output to VCC or GND. Disadvantage is that it can lead to a short if something touches it.

Don't tie a pin directly to VCC or GND because that leaves the possibility of shorts during development if you accidentally set that pin to an output.

Leaving an input pin floating is typically not a good idea; noise can cause it to flip states a lot and that can burn power in the cpu circuitry connected to it.