laitimes

Burn the new ATmega328P with Arduino

author:Fei Duo Academy

This article describes how to use arduino Uno to program the new ATmega328P chip.

This article includes the following:

How to flash bootloader for the new ATmega328P with Arduino Uno

How to program the ATmega328P with Bootloader via Arduino Uno

Arduino Uno

ATmega328P chip

If you buy a brand new ATmega328P, and you want to program it, one of the natural ways to do this is to unplug the chip that was originally plugged into the board, and plug this new one into it and you can program it?

Burn the new ATmega328P with Arduino
Burn the new ATmega328P with Arduino

Unfortunately, this idea does not work, because the Arduino Uno is programmed for the ATmega328P chip through the on-board serial port, and programming the ATmega328P chip via the serial port requires its internal Bootloader support, but there is no Bootloader in the new ATmega328P.

Therefore, you need to first burn the Bootloader to ATmega328P.

The Arduino Uno itself can be turned into a programmer (ISP) that can be programmed to the new ATmega328P Bootloader.

Download the "ArduinoISP" code that comes with the Arduino IDE into Arduino Uno, and Arduino Uno becomes a programmer:

Burn the new ATmega328P with Arduino

Put the A rduino Uno programming programmer

Before the flashing begins, connect the hardware as shown in the following figure:

Burn the new ATmega328P with Arduino

Hardware wiring when flashing Bootloader

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

In the Arduino IDE, select Arduino as the programmer:

Burn the new ATmega328P with Arduino

The programmer selects Arduino as ISP

Select Arduino Uno for the board in the Arduino IDE. Click "Burn Bootstrapper" in the menu:

Burn the new ATmega328P with Arduino

After starting the flashing, the prompt is as follows:

Burn the new ATmega328P with Arduino

After successful burning, the prompt is as follows:

Burn the new ATmega328P with Arduino

After burning the Bootloader, you can program the ATmega328P that has been burned with the Bootloader through the serial port that comes with the Arduino Uno board.

Before programming, you need to remove the ATmega328p on the Arduino Uno board as a programmer. It's equivalent to plugging the ATmega328P to be programmed on the Arduino Uno board. The hardware wiring is as follows:

Burn the new ATmega328P with Arduino

Hardware wiring when flashing flash programs

Write an LED flashing program and select "ArduinoISP" as the programmer in the Arduino IDE:

Burn the new ATmega328P with Arduino

Select the programmer ArduinoISP

Then, you can download the program normally.