Programing a new ATmega328p with Arduino

Programing a new ATmega328p with Arduino

This article describes how to program the brand new ATmega328P chip with an Arduino Uno.

This article includes the following:

How to program the Bootloader for the  new ATmega328P through Arduino Uno
How to Program ATmega328P with Bootloader via Arduino Uno

materials needed

  • Arduino Uno
  • ATmega328P chip

    If you bought a brand new ATmega328P, and then you want to program it, a natural idea is to unplug the chip that was originally plugged into the board, and then plug in the new one to start programming?

Program a brand new ATmega328P with Arduino

ATmega328P chip

Program a brand new ATmega328P with Arduino

Arduino Uno

Unfortunately, this idea does not work, because the Arduino Uno programs the ATmega328P chip through the onboard serial port, and to program the ATmega328P chip through the serial port, it needs the support of its internal Bootloader, but the new ATmega328P does not have it. Bootloader.

Therefore, the Bootloader needs to be programmed into the ATmega328P first.

Program Bootloader

The Arduino Uno itself can become a programmer (ISP), which can program the Bootloader for the brand new ATmega328P.

Download the “ArduinoISP” code that comes with the Arduino IDE to the Arduino Uno, and the Arduino Uno becomes a programmer:

Program a brand new ATmega328P with Arduino

Program the Arduino Uno to the programmer

Before programming starts, connect the hardware as shown below:

Program a brand new ATmega328P with Arduino

Hardware connection when programming Bootloader

Note that the RESET pin of the target board is connected to pin 10 of the Arduino Uno as the programmer.

Select Arduino as the programmer in the Arduino IDE:

Program a brand new ATmega328P with Arduino

Programmer choose Arduino as ISP

In the Arduino IDE, select “Arduino Uno” for the development board. Click “Burn Bootloader” in the menu:

Program a brand new ATmega328P with Arduino

After starting to burn, the prompt is as follows:

Program a brand new ATmega328P with Arduino

After the burning is successful, the prompt is as follows:

Program a brand new ATmega328P with Arduino

Downloader

After programming the Bootloader, you can program the ATmega328P with the Bootloader programmed through the serial port of the Arduino Uno board.

Before programming, you need to remove the ATmega328p from the Arduino Uno board as the programmer. It is equivalent to plugging the ATmega328P to be programmed into the Arduino Uno development board. The hardware connection is as follows:

Program a brand new ATmega328P with Arduino

Hardware connection when programming flash program

Write an LED blinking program, select “ArduinoISP” as the programmer in the Arduino IDE:

Program a brand new ATmega328P with Arduino

Select the programmer ArduinoISP

Then, you can download the program normally.

error: Content is protected !!