Ive got an Arduino UNO which i have been building a few projects with, one which im wanting to produce at scale.
I have a bunch of ATMEGA328 chips, none which have the bootloader on them, I have bought them in the past with the bootloader already burned onto them, but after trying this myself I get an error in Arduino IDE.
After some research, as far as I can tell this is not possible to do it on the arduino itself, and need either another arduino wired to this, or mess around with a breadboard connected to the arduino.
The other option appears to be the use of a ISCP adapter like this, I happen to have one somewhere, but have never used it, can this plug directly into the UNO board and burn the bootloader that way? I have the 10 to 6 pin adapter for it too.
Im also looking at adding an ISCP header to my board design, would this allow me to burn the bootloader and code all in one go, or do you have to go through both processes individually?
New ATmega chips have the MCU clock set to 1 MHz, using the internal RC clock and divide by 8 fuse set. An ISP programmer can be used to set those fuses correctly for use on an Arduino board. Set the programming clock speed to 250 KHz or less.
I strongly recommend Pololu's AVRISP V2.1 programmer.
Hi @nzoomed.
Yes. That will work fine. It is a nice USBasp clone. I use those all the time.
A bootloader is only required in order to be able to be able to upload to the board via the USB interface. If you are instead using an ISP programmer to flash the program binary to the board, then a bootloader is not required.
This might lead us to the conclusion that the "Burn Bootloader" operation is superfluous in this case. However, it is not completely so. The reason is that Arduino IDE"s "Burn Bootloader" feature actually does two distinct things:
- Sets the configuration fuses on the target chip according to the values in the board definition.
- Flashes the bootloader binary to the chip.
As @anon94801460 explained, the ATmega328P comes from the factory with the configuration fuses set so that it runs at 1 MHz. Generally we will want some different configuration. For this reason, we would always perform one "Burn Bootloader" operation with a fresh chip. However, you only need to do that once (except in the case where you wanted to change the fuses later). After that, you perform "Upload Using Programmer" operations as many times as you like without having to do a "Burn Bootloader" operation each time.
What I wrote above is somewhat specific to Arduino IDE. In the case where you wanted to efficiently provision a large number of devices, you would not use Arduino IDE. You would instead use the AVRDUDE tool directly (Arduino IDE also uses this tool under the hood for "Burn Bootloader" and "Upload Using Programmer"). You can use a single avrdude command to set the fuses and flash your precompiled program binary to the boards very efficiently. You can learn about using AVRDUDE from the documentation here:
Sorry its been a while since ive had a chance to come back to this.
I found my programmer and its a USBasp, now i dont see anywhere in the arduino IDE to set these fuses. From what i understand, the correct defaults should be in boards.txt?
OK, that clears that up a lot thanks.
Ive found the programmer and it is indeed a USBasp unit.
Ive set the programmer to use this in Arduino IDE and if i try and upload via programmer this is the error i get, same message appears if i try and burn the bootloader i get this message:
Error: cannot set sck period; please check for usbasp firmware update
From what i can tell I need a second USBasp programmer to update its firmware?
I also believe the jumper can slow down the clock speed as a work around, just trying to find the specifics for this board before i change it.