1

I have an arduino code which is working fine. Now I am planning to make a PCB out of it. But I do not want to use the complete Arduino board. I just want to use the Atmega328p microcontroller. So my plan is to connect the USBasp programmer to the new Atmega328p and upload the code. So before this code, do I need to upload the bootloader or uploading the code first will run fine.

1
  • You just need to set the fuses. You can do that using the command line, and the avrdude application. avrdude is somewhere inside the Arduino application folder. You'd run something like avrdude -v -patmega328 -cusbasp -B10 -Pusb -U lfuse:w:0xA4:m -U hfuse:w:0xD1:m (those fuse values are most likely not the correct ones). Note the -B 10, is to slow down the USBasp programmer, as by default the ATMega328 runs at 1Mhz.
    – Gerben
    Commented Dec 12, 2016 at 16:29

2 Answers 2

3

Tools > Burn Bootloader in the Arduino IDE does two things:

  • Set fuses according to the settings in boards.txt for the Tools > Board selection
  • Install the bootloader.

The latter is pointless since when you do an Upload Using Programmer the bootloader will be overwritten but the former is very important to do the first time you use a new chip(or anytime you want to change the fuses) to be sure that the correct fuses are set, which likely will be different from the default settings of the chip when you get it. Upload Using Programmer does not set fuses, the only way to do this via the Arduino IDE is Tools > Burn Bootloader.

So yes, you should Burn Bootloader.

1
  • 1
    The act of burning the bootloader doesn't burn the fuses. They are actually a completely separate command that is executed in sequence with burning the bootloader. You do not need to burn the bootloader to set the fuses, you can do them separately. Burning the bootloader is an "easy" way of doing it, however you should really learn how to control the fuses properly if you are going to work with bare chips.
    – Majenko
    Commented Dec 12, 2016 at 15:06
0

The only thing the bootloader for the ATmega328P does is to enable UART programming. If you are only using ISP then there is no need to have the bootloader.

1
  • Okay. I will try it and will let you know.
    – S Andrew
    Commented Dec 12, 2016 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.