Erased Bootloader

I studied programming avr microprocessors for a while and I was using eclipse ide, then I started tinkering around with arduino but I seriously hate the arduino ide, so I searched around and found out that I can buy a usbasp avr programmer and connect it directly to the arduino ICSP and upload a code to my arduino without using the arduino ide.I have an arduino mega 2560 and I tried the method mentioned before but all that did was completely overwrite the arduino bootloader and I wasn't able to upload any sketches to my arduino rendering it useless, luckily I had an arduino UNO lying around and I was able to burn the bootloader and fix my arduino again. So I am asking for a correct way to upload my avr code directly to arduino without using the arduino ide and without ruining my arduino.

Any tips?

Install a new bootloader, and then upload a sketch. I don't think you can upload using the bootloader, without the IDE. So what is the purpose of having it installed if you don't use it? You said you hate the IDE, so why does it matter that you can't use it to upload, after using the USBASP? If you want to restore the bootloader for IDE users, you certainly can.

Yeah I knew I couldn't upload from eclipse through the bootloader but the thing is the code I uploaded through the avr programmer didn't even work, and it was a simple code I am not sure what im doing wrong

An obvious question but, did you test the same code via a bootloader upload? Also we can't diagnose code we can't see... if it's actually Atmel Studio code or something like that, you are asking in the wrong forum.

I did upload the same code through the bootloader and it worked like a charm.

Using what IDE? The bootloader contains no core code.

Arduino ide, after I tried uploading it using eclipse and failed I burned the bootloader and tried the same code using Arduino IDE and it worked, and do you think it has something to do with the avr programmer itself?

If you choose the USBASP upload method in the IDE, it should upload and run normally, just with no bootloader. There may actually be options to include one, but I'm not sure. I'll step back and see what other people think...

I can tell you this much... I have seen Windows wreak havoc with the USBASP... driver problems.

Yeah I had a ton of issues with installing the usbasp driver but I dealt with them. I have read in many forums that the usbasp avr programmer isn't really compatible with the arduino mega due to some detailed stuff about upload size and memory and stuff but all these forums were from years ago and I figured the usbasp firmware would have been updated enough over the years to make it work, not sure if it could be the issue though.

I can't recall exactly whether I ever used it with the Mega, but the answer is probably no. Mostly used for DIY stand alone boards, and 16U2's.

In theory at least, it's always possible to include a bootloader in any firmware update, since the source is open. The two codes could be integrated and compiled together.

My main question is why you need a bootloader if you want to upload via USBasp?

If USBasp can't handle the Mega, get rid of it. I don't know anything about USBasp but there might be many clones around and the manufacturers might never update its firmware.

In the opinion of many, Pololu USB AVR Programmer v2.1 is one of the best programmers that you can buy for the AVR family.

When you upload using a programmer, the complete flash memory of the microcontroller is erased; hence the bootloader is also wiped and only your sketch exists in the flash memory.

You can export to hex/binary, it's one of the options in the IDE menu. This will give you two hex files in a subdirectory called build in the sketch directory; one is just the sketch, the other one contains the sketch and the bootloader. You can upload either of them from the command line using avrdude.

I have no knowledge of Eclipse, check if it has a similar option if you are still in need of the bootloader.

There shouldn't be any problem uploading to an Arduino board using the bootloader (without needing an AVR ISP) using any other IDE. It's just a slightly different avrdude command.

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