Arduino bootloader burning

Today I'm going to describe how to download arduino bootloader to a fresh ATMEGA328P (in DIP28 package). Here is what we'll need:
  1. USBasp programmer
  2. ATMEGA328P microcontroller in DIP28 package
  3. USB-RS232 module (with FT232R or CH340)
  4. 16Mhz crystal
  5. 27pF capacitor
  6. 100nF capacitor
  7. 10k resistor
  8. Prototype board
  9. 5V Supply module for prototype board
  10. Connection wires
  11. 9V power supply
Beside those things we'll also need software:
  1. Zadig (software for driver manipulation)
  2. USBasp module drivers
  3. Drivers for our USB-RS232 module
  4. Arduino IDE
First of all we need to connect USBasp module to computer and install correct driver that' will work with Arduino IDE to download bootloader. For that purpose we going to use Zidag. Open Zidag and go to Options-> List All Devices.




Then let's choose out programmer (USBasp):




Next let's choose correct driver for that device (libusbK):




After that next step is to connect programmer to our new ATMEGA328P like on a picture below:


 

Remember that jumpers J2 and J3 on USBasp need to be closed (J2 - slow communication speed, J3 - power supply from programmer). With programmer connected to ATMEGA328P like on a picture above now we can burn bootloader using Arduino IDE. Of course first we need to select USBasp as our programmer and processor as ATMEGA328P in Arduino IDE. Then click "Burn bootloader".






After successful bootloader burning now we can program our ATMEGA328P using USB-RS232 communication. To do that we need do connect USB-RS232 module (based on FT232R or CH340) like on a picture below (we won't need USBasp anymore).


Remember that USB-RS232 module needs its own driver according to the used chip (FT232R or CH3400). After device is connected now we can upload sketch from Arduino IDE (e.g. BlinkWithourDelay). First select proper COM port of USB-RS232 module and processor name (e.g. COM3, ATMEGA328P) in Tools of Arduino IDE. After that click Sketch->Upload.




Now we can test if our program works correctly by connecting LED through the resistor to ATMEGA328P pin 19:



As a result of that connection and assuming that the program upload was successful now we should see blinking LED every 1 second.

Brak komentarzy:

Prześlij komentarz