Burn bootloader on ATmega2560 using USBasp

HI Sir. I have seen the thread topics. I have planned my own board with Atmega2560 with ICSP Programming without the USB controller Atmega16U2. I have planned to Program through ICSP Connector(.hex file) only using the Arduino IDE with the following Programmer:

Can i able to download the bootloader into the new chip(Atmega2560) using this Programmer.? Will the new chip Atmega2560 runs with External crystal 16Mhz timing. Kindly let us know.

As per the data sheet, it will work in atmega2560, because this is similar to atmega328p, atmega328-au, and atmega8. For more details please read the datasheet.
ATmega640-1280-1281-2560-2561-Datasheet-DS40002211A.pdf (4.7 MB)

1 Like

Arduino usually preprograms their products.
Your processor is still in factory settings.

1 Like

@prakashvenugopal

Don't hihack other threads, start a new one instead. This post is flagged.

1 Like

I have split your post out to its own topic @prakashvenugopal.

Hijacking is against the Arduino forum rules. The reason is that it may sidetrack the discussion, even preventing the creator of the topic from getting the assistance they need.

This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

Ok sir. I understood. Thanks for creating a seperate topic on this.

2 Likes

I’m sorry.
I read the thread again, I should have said : Your processor was still in factory settings.

1 Like

No. I have planned to design a custom board with atmega2560 chip(TQFP Package). I have not used the USB controller Atmega16U2 to program my atmega2560 chip in my board. Instead i have used the ICSP port connector to program my atmega2560 chip. In that case, for my new chip, i have to download the bootloader to work for external crystal 16mhz.?

See:

6v6gt

7 dpost #7

If you use a factory new ATMEGA328P, you have to "Arduinoize" it by burning a bootloader on to it. As a side effect, this sets the fuses which make it compatible with the Arduino environment.
If, however, you are not using a bootloader, and use an Arduino core which supports this, then you have to use AVRDUDE to set the fuses which have an impact on the timing.
Beware of using an ICSP programmer to load a sketch if there has been a bootloader previously on the chip without previously cleaning the fuses.

1 Like

If you’re not using the bootloader trick, you should read
https://www.nongnu.org/avr-libc/user-manual/group__avr__fuse.html

1 Like

Beware of using an ICSP programmer to load a sketch if there has been a bootloader previously on the chip without previously cleaning the fuses

How to identify the bootloader previously on the new chip?

Run ‘Blink’ from examples with a LED at PB5. If it blinks with 1 second you’r good.
If not, put in a piece of that <avr/fuse.h> at the top. (I haven’t tried it myself, so I’m not completely sure. From the previous thread I assumed you did try the bootloader trick).)

1 Like

Hi @prakashvenugopal

Yes. Use the following procedure:

  1. Connect the USBasp programmer to your ATmega2560.
  2. Plug the USBasp programmer into the USB socket on your computer.
  3. Select Tools > Board > Arduino Mega or Mega 2560 from the Arduino IDE menus.
  4. Select Tools > Programmer > USBasp from the Arduino IDE menus.
  5. Select Tools > Burn Bootloader from the Arduino IDE menus.
  6. Wait for the "Burn Bootloader" operation to finish successfully.

If the "Burn Bootloader" operation errors for some reason, just let us know in a reply here and we'll help you out.

Yes. Arduino IDE's "Burn Bootloader" feature actually does two things:

  • Set configuration fuses on the microcontroller according to the configuration of the selected board.
  • Flash the bootloader binary to the target.

The Arduino Mega or Mega 2560 board definition is configured for an external 16 MHz clock source so doing a "Burn Bootloader" with that board selected from the Tools > Board menu in Arduino IDE will cause the fuses on your ATmega2560 to be set accordingly.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Hi @ptillisch Sir,

As my thread on Burning Bootloader on the Atmega2560 chip using Usbasp Programmer is closed. I am opening this new thread.

Yes. Use the following procedure:

  1. Connect the USBasp programmer to your ATmega2560.
  2. Plug the USBasp programmer into the USB socket on your computer.
  3. Select Tools > Board > Arduino Mega or Mega 2560 from the Arduino IDE menus.
  4. Select Tools > Programmer > USBasp from the Arduino IDE menus.
  5. Select Tools > Burn Bootloader from the Arduino IDE menus.
  6. Wait for the "Burn Bootloader" operation to finish successfully.

If the "Burn Bootloader" operation errors for some reason, just let us know in a reply here and we'll help you out.

Yes. Arduino IDE's "Burn Bootloader" feature actually does two things:

  • Set configuration fuses on the microcontroller according to the configuration of the selected board.
  • Flash the bootloader binary to the target.

The Arduino Mega or Mega 2560 board definition is configured for an external 16 MHz clock source so doing a "Burn Bootloader" with that board selected from the Tools > Board menu in Arduino IDE will cause the fuses on your ATmega2560 to be set accordingly.

Kindly refer the attachment and try to burn the Bootloader using the usbasp Programmer into my new chip atmega2560. It is showing the warning as attached. How to resolve this Problem. Kindly let us know.

Burn Bootloader Option used:


Warning shown while burning the Bootloader:

Programmer used:

Adapter used:

I always get that message with my USBasp. But it works ok.

1 Like

In order to consolidate all the discussion on this subject to a single topic, I have reopened the original topic and merged the new one with the original.

Carry on.

1 Like

I concur with @PaulRB. The warning is normal. Just ignore it. As long as you see a "Done burning bootloader." notification at the bottom right corner of the Arduino IDE menu at the end of the process, you will know the bootloader was burned successfully. That notification is hidden automatically after a few seconds, but you can click the bell icon at the right side of the status bar to reveal it again if you missed it:

image

In case you are interested in the boring details about why you see this message, and why you should ignore it, I'll provide an explanation below. If you aren't curious about this, you are welcome to skip reading the rest of this post:

The Chinese USBasp clones typically ship with a proprietary firmware. This firmware is different from the official USBasp firmware in that it automatically adjusts the SPI clock as appropriate for the target (in the official firmware the clock is configured by the AVRDUDE tool the IDE uses to perform the "Burn Bootloader" process). In this way, the Chinese firmware is actually superior to the official firmware and so those who are prompted by this warning to "update" their firmware find that, if they manage to complete the complex update process, their programmer is actually less capable than it was before.

1 Like

The warning, while typical, I would not call it normal and it shouldn't be blindly ignored because in some situations it means you will not be able to burn a bootloader.

From a high level perspective, if a bootloader gets successfully burned, then you can ignore the warning.
If not, you either likely need to install a jumper on the USBASP device, or need some newer/different firmware.

Having worked extensively on a fork of the USBASP f/w to add auto clock adjustment and fixing several ISP pin control and timing issues/bugs (some of these issues also affected Arduino as an ISP sketch code), adding better led status output, and porting to a new version of the low level USB code, I am quite familiar with the USBASP code.

The warning is due to a combination of older firmware along with some boneheaded things that were done in the avrdude code when the code was added that attempts to set a clock speed for the ISP.
Due to the way this avrdude USBASP set clock code was added (it is ugly, and poorly done, IMO), it creates an incompatibility with some versions of the USBASP firmware and generates the warning that is presented.

If we are calling the "official" firmware the one by Fischle himself, then no, the official firmware does not have auto clock adjustment.
There are several different versions of the code floating around out there
and while there are some firmware versions that do auto clocking, many do not.
In fact on many if not most of the ones that do not do auto clock adjustment,
a jumper must be installed to slow down the clock to support a virgin AVR chip that is running on the internal oscillator.

I tried for years to get Joerg (main avrdude developer) to accept a small tweak into avrdude to support better manual and clock adjustment, but he refused to accept my PR to do it. (He seems to not be open to code changes from others)

Anyway, in terms of if this is an issue or not, it depends.
There are essentially 3 ways the clock is altered.

  • a jumper (to slow it down)
  • support for avrdude setting the clock.
    (Some versions can do this, some can't and some respond that they can, but can't)
  • Autclocking
    firmware doing some special probing to attempt to pick
    a reasonable clock rate that works.

Autoclocking can be problematic in that some implementations don't work that well.
The forked code I worked on supported auto clock detection and worked with the newer avrdude which attempts to set the clock so it won't generate the warning.

If you would like to reburn your USBASP device with the firmware that I worked on, it can be found here:

The repository contains makefiles for building and burning the images,
pre-built firmware images for a few of the more common devices and some GUI drag and drop burning tools that work on Windows and Linux.

See the firmware directory for the pre-built images and the Readme.txt for information on the supplied scripts that aid in burning and provide the drag and drop burning form the OS file manager or the command line on both Windows and Linux.

--- bill

1 Like