Unconnected Pins On Custom MEGA2560

Hello guys, I am pretty new in designing and programming, and I am a little confused about my project.

I designed a "DIY Arduino2560" to improve performances of my board and use it as "standalone mode".

On the ATMEGA2560 I am only using those ports (apart from RX/TX and XTAL):

  • SDA (PD1)
  • SCL (PD0)
  • Analog I/O : PE0 / PE1 / PE4 / PE5 / PE6 and PE7.

I read in the datasheet (page 83 to 87) that unconnected pins have to be connected to internal pull-up resistor to reduce power consumption.

I know that for using this "empty µC" I have to program the Arduino bootloader by using the example ArduinoISP from the IDE, but I don't know where and how to set up the pull-up resistor.

Is it in this bootloader program? If anyone can enlighten me :slight_smile:


You can set all unused pins to a pinMode of INPUT_PULLUP.

It may be convenient to use a "for" loop at the start to just set every pin to that, or at least all the higher-numbered pins. You would have to be careful that this is effectively setting pins weakly to HIGH and you do not want this to happen to certain outputs.

Unconnected, un-initialised pins may tend to increase current consumption a little.


Quote from: miguel_03567I read in the datasheet (page 83 to 87) that unconnected pins have to be connected to internal pull-up resistor to reduce power consumption.

This part?

13.2.6 Unconnected Pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. Even though most of the digital inputs are disabled in the deep sleep modes as described above, floating inputs should be avoided to reduce current consumption in all other modes where the digital inputs are enabled (Reset, Active mode and Idle mode).

The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up. In this case, the pull-up will be disabled during reset. If low power consumption during reset is important, it is recommended to use an external pull-up or pull-down. Connecting unused pins directly to VCC or GND is not recommended, since this may cause excessive currents if the pin is accidentally configured as an output.

You can set all 8 pins of port 'x' to INPUT_PULLUP in two lines. For example for PORTB:

  DDRB = 0x00;
  PORTB = 0xFF;

Hello friends,

Thanks for the replies.

I was wondering where those parameters could be setted kwowing that after uploading the bootloader, I will never use Arduino IDE again.

In fact, I aim to drive the board using LabView with an adapted firmware that generates .h and .cpp configuration files (attached).

So I would like to know where can I set up those parameters to be fixed/unchangeable. Is it during the first bootloader uploading or in the new configuration files?

Thanks again for helping me :slight_smile:

LinxArduinoMega2560.cpp (4.79 KB)

LinxArduinoMega2560.h (3.41 KB)