Registration Notice

Due to increased spam, forum registration must be manually approved by a moderator! Please see this post for instructions.

*

Offline LukeZ

  • 1197
    • View Profile
  • France
Flashing Bootloader to Blank ATmega2560
« on: December 12, 2021, 10:10:05 AM »
For those building a DIY board there is sometimes the need to flash a bootloader to a blank chip. For those who start with an off-the-shelf Arduino Mega this is not necessary, the standard bootloader that comes pre-installed on Arduino boards will work just fine. But for those who are assembling boards from raw components, including blank ATmega2560 chips, then a bootloader needs to placed on the chip before the firmware can be loaded.

I have attached a PDF how-to guide that describes the process, as well as the files that are needed. In addition to these resources, you will also need:
  • An ISP programmer - I have tested the USBasp, the AVR ISP mkII (both available on eBay and elsewhere), as well as the Pololu USB AVR Programmer v2.1
  • If you did not populate the pins for the ISP connector on your board, you will need something like the SparkFun ISP Pogo Adapter: here or here. It is easier if you just solder regular ISP pins to the board.
  • If you are building a large quantity of boards (most are not) then you may find it faster to load the firmware through the alternate Serial 1 port on the TCB (labeled "SER. 1"), instead of using the USB port. I don't think this should apply to any DIY people, but if you want to do it that way you can use the Adafruit FTDI Friend, the SparkFun FTDI Breakout, or the already mentioned Pololu Programmer (which can work both as a serial adapter and ISP programmer).

If anyone needs help with this process feel free to ask your questions here.
*
TCB_BootloaderFirmware_Inst.pdf
(4205.16 kB ~ Downloads: 97)
*
openpanzer_boot.zip
(203.46 kB ~ Downloads: 91)
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline NS-21

  • 48
  • dreamer
    • View Profile
  • Russia
Re: Flashing Bootloader to Blank ATmega2560
« Reply #1 on: February 09, 2022, 04:49:19 PM »
When I assembled my first version of TCB, and showed it to our respected author - he then said:

- Very excellent! I understand that you were able to deal with the bootloader?

- Oh teacher! What bootloader are you talking about?

- Well, how about what? About the same.


And gave me information. And he said - since you removed the chips from the finished boards - that's why everything worked for you!

But if you had a chip from the store, you would have to flash the bootloader yourself.

This is where I fell asleep.

And here I am faced with the problem of lack of knowledge.

Chips 2560 - impossible to buy.

In my scientific research - I use removed chips - from Arduino boards. Yes, I now know they contain a bootloader.

And therefore, when I soldered my mini-TCB projects - everything was flashed for me using Tx + Rx + GND through CP210x

It was the best day of my life. My project, based on the project of the respected LukeZ - works!

I jumped around the apartment - joyful, shaking a nuclear warhead! (Russian version of joy).
Bear - furiously played the balalaika.

I don't have no chips from the store, and here's the question. How to turn a chip removed from the board into an already flashed Arduino bootloader - as if it had just come out of the factory. How to clear the bootloader?

So that I can test my knowledge and check if everything is correct - did I do it on my board?




*

Offline LukeZ

  • 1197
    • View Profile
  • France
Re: Flashing Bootloader to Blank ATmega2560
« Reply #2 on: February 10, 2022, 04:51:49 PM »
I don't have no chips from the store, and here's the question. How to turn a chip removed from the board into an already flashed Arduino bootloader - as if it had just come out of the factory. How to clear the bootloader?

So that I can test my knowledge and check if everything is correct - did I do it on my board?
Hi NS, I always enjoy your humorous posts and Russian proverbs! :)

To answer your question, there is nothing you need to do to delete the bootloader that is already on your chip. If you follow the process in the documentation above, the old bootloader will be deleted automatically before the new one is loaded. In fact whenever we load a bootloader to a chip, it doesn't matter what bootloader, we always must start by erasing everything on the chip first, and then the new bootloader is written onto the blank chip. The erase and write process is taken care of by the "bootloader_batch_script.bat" file that you will find in the downloads above.

Just follow the instructions and let me know if you have any questions! It's kind of complicated the first time you do it, but after a few tries is easy.

NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline NS-21

  • 48
  • dreamer
    • View Profile
  • Russia
Re: Flashing Bootloader to Blank ATmega2560
« Reply #3 on: February 10, 2022, 05:01:03 PM »
Dear LukeZ!

I'm probably not very beautiful, I write correctly in your language.

You see, I'm used to everything - to check at the maximum level of complexity.

I simply have to, before posting my version to the public - check everything so that it is for everyone who wants to repeat my experience - it's understandable for repetition!

I honestly have little understanding of programming through USBasp. And fuzes.

If you can tell me - how to erase the chip, and turn it into a state - "just rolled off the assembly line" - I will be grateful!


*

Offline LukeZ

  • 1197
    • View Profile
  • France
Re: Flashing Bootloader to Blank ATmega2560
« Reply #4 on: February 12, 2022, 08:06:32 AM »
You see, I'm used to everything - to check at the maximum level of complexity.

I simply have to, before posting my version to the public - check everything so that it is for everyone who wants to repeat my experience - it's understandable for repetition!

I honestly have little understanding of programming through USBasp. And fuzes.

If you can tell me - how to erase the chip, and turn it into a state - "just rolled off the assembly line" - I will be grateful!

I understand your desire to have a process that can be shared with anyone so they can repeat it even if they have a blank chip "from the assembly line." That's good!

What I am saying is that the process in the instructions above is the same for everybody and every chip. It doesn't matter if the chip already has a bootloader on it, or if the chip already has a program on it, or if the chip is completely empty. The process to flash a new bootloader is always the same. It always starts by erasing the chip completely, even if the chip doesn't have anything on it to erase.

You don't need to know anything about fuse settings, the files above will take care of that for you!

I suggest you start with the process as described in the instructions above and let me know if you have any problems.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs

*

Offline NS-21

  • 48
  • dreamer
    • View Profile
  • Russia
Re: Flashing Bootloader to Blank ATmega2560
« Reply #5 on: February 12, 2022, 08:30:17 AM »
Quote
The process to flash a new bootloader is always the same. It always starts by erasing the chip completely, even if the chip doesn't have anything on it to erase.

Well, if it works like that, I'll definitely try it.

I just wanted to be sure by taking the chip from the store, flash the bootloader, and be sure that everything was flashed correctly, and be sure that it was not the old bootloader that remained there, but I sewed up a new one.

Still, this is still difficult for me.

*

Offline LukeZ

  • 1197
    • View Profile
  • France
Re: Flashing Bootloader to Blank ATmega2560
« Reply #6 on: February 12, 2022, 08:53:21 AM »
I just wanted to be sure by taking the chip from the store, flash the bootloader, and be sure that everything was flashed correctly, and be sure that it was not the old bootloader that remained there, but I sewed up a new one.

You will be able to see that the new bootloader was successfully installed because it blinks the red LED on pin A3, which the stock Arduino bootloader does not.
NO SUPPORT THROUGH PM - Read why
Need a forum account? Read here
Open Panzer FAQs