Open Panzer

Developer's Forum => TCB Dev => Topic started by: LukeZ on December 12, 2021, 10:10:05 AM

Title: Flashing Bootloader to Blank ATmega2560
Post by: LukeZ 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:

If anyone needs help with this process feel free to ask your questions here.
Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: NS-21 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?



Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: LukeZ 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.

Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: NS-21 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!

Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: LukeZ 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.
Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: NS-21 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.
Title: Re: Flashing Bootloader to Blank ATmega2560
Post by: LukeZ 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.