To elaborate my question more - I have an atmega2560 and I'm trying to burn the bootloader of the Original Arduino MEGA2560 onto my atmega 2560, how do I do this? I have connected the 16MHZ crystal with two 22nF capacitors to XTAL1,XTAL2 of atmega2560 accordingly. I've soldered pin headers for MISO,MISO,SCK,GND,VCC for the atmega 2560. The hardware part is done, how do I add the Mega's boot loader onto this using an existing arduino board? To be more specific do I need to have an arduino mega board to boatload it with the Mega's boot loader or can it be done using arduino uno as well?
two 22nF
22pF - big difference.
I've soldered pin headers for MISO,MISO,SCK,GND,VCC for the atmega 2560.
You need Reset - the Programmer will take & hold Reset let, then use SCK/MOSI/MISO to access the memory to install the bootloader.
Then look at Nick Gammon's bootload installer sketch:
Yes sorry it is 22pF not 22nF capacitors, and I also forgot to mention about reset, even reset pin header is soldered. The link you referred me to shows how to burn a Lilypad or Uno's bootloader, my question is do I need an Arduino Mega to burn the Mega's bootloader or can that be done with UNO itself? Is the bootloader board dependant ?
Bypass caps - 0.1uF - also needed on each Vcc pin. Annoying that so many tutorials ignore that.
VCC (all pins) ,GND ( all pins) have been connected correctly i.e using the bypass capacitors. What else should be done?
rakshithgb:
Yes sorry it is 22pF not 22nF capacitors, and I also forgot to mention about reset, even reset pin header is soldered. The link you referred me to shows how to burn a Lilypad or Uno's bootloader, my question is do I need an Arduino Mega to burn the Mega's bootloader or can that be done with UNO itself? Is the bootloader board dependant ?
You can burn the bootloader with whatever arduino compatible chip you want.
According to the github repo, those tools by Nick will bootload the mega2560.
rakshithgb:
VCC (all pins) ,GND ( all pins) have been connected correctly i.e using the bypass capacitors. What else should be done?
Sounds like bootloading time.
Oh, if you didn't already, a pullup resistor on Reset is a good idea.
Yeah I did not add a pull up resistor, I'd like to know why it should be added and of what value? Can you post schematic of that?
rakshithgb:
Can you post schematic of that?
Schematic is on this web site.
Scroll down to "Documentation" and click on "Schematics" link.
A 10k resistor between RESET and Vcc is recommended (it may not be strictly necessary in all cases, as the pin has a weak internal pullup, but it increases noise immunity of reset pin, and may be necessary for the DTR reset trick if you're using that).
Yes I will be using software reset (DTR reset trick) for uploading sketches. I managed to burn the bootloader without the pull up resistor, I'm having trouble uploading sketches to it using FTDI since I don't have the 10k resistor connected, the schematic in the arduino website doesn't have any resistor connected to reset pin of ATMEGA2560 but this is done on the ATMEGA16, since I will be using FTDI to upload sketches can I just connect the pull up resistor to reset pin of ATMEGA2560 to vcc? And then connect my FTDI pins accordingly to upload sketches?
rakshithgb:
the schematic in the arduino website doesn't have any resistor connected to reset pin of ATMEGA2560
Yes it does, it's just hidden. Check next to the ICSP header in the schematic on the product page. You also need a 0.1uF cap in series with the reset pin for the DTR auto-reset to work (see bottom-right of the schematic). Yes, that schematic is a mess with the 4-5 different reset stubs.
Since you are using an FTDI adapter, put a 10k pullup to Vcc on reset, and put a 0.1uF cap between the DTR pin your adapter will connect to and the reset pin. See the Arduino Pro Mini schematic for a simple view of what this looks like.
Thank you! This schematic makes more sense than that one. I just have one more question, in that ATMEGA2560 schematic , the circuit diagram next to the ICSP header, there is a diode in parallel with the 10k resistor is this necessary? What does it even do? They've also used 22pF rather 0.1uF capacitor.
rakshithgb:
Thank you! This schematic makes more sense than that one. I just have one more question, in that ATMEGA2560 schematic , the circuit diagram next to the ICSP header, there is a diode in parallel with the 10k resistor is this necessary? What does it even do? They've also used 22pF rather 0.1uF capacitor.
I'm actually not sure what that 22pF cap on the Arduino Mega is for, but it is not the auto-reset cap, note that the 22pF is between reset and ground, not in-line with DTR. I know it isn't required, whatever it does.
I made a few boards using an ATMega640 (basically the same as the 2560, just less memory) and only did the 0.1uF cap, the 10K pullup, and the diode, no issues thus far.
The Sparkfun "Pro" boards are usually pretty solid close-to-bare-bones boards, I use them as a reference for minimal circuits. In this case, the Mega Pro schematic would have been a more appropriate one for me to link you to. However, I would still add the diode across the 10K resistor if you can. If I recall the explanation I heard correctly, it helps prevent a voltage spike on the reset pin from putting the chip into high-voltage programming mode, which requires a special programmer to get out of. Required? Apparently not, but better safe than sorry I guess. Just make sure you orient it correctly
The reset diode is recommended especially when a button is used for reset, the higher voltage spikes are more likely to occur then. The cap and diode are both referenced in AVR042, Design Considerations.
Connection of RESET pin on AVRs
The RESET pin on the AVR is active LOW, and setting the pin LOW externally will thus result in a reset of the AVR. The RESET has two purposes:
- To release all lines by tri-stating all pins (except XTAL pins), initialize all I/O registers and set program counter to zero.
- To enter programming mode (for some parts also the PEN line is used to enter programming mode).
Furthermore it is possible to enter high-voltage/parallel programming mode by drawing the RESET pin “very” high, where very high means 11.5V – 12.5V (refer to the datasheet of the device for more information).
The reset line has an internal pull-up resistor, but if the environment is noisy it can be insufficient and reset can therefore occur sporadically. Refer to datasheet for value of pull-up resistor on specific devices.
Connecting the RESET so that it is possible to enter both high-voltage programming and ordinary low level reset can be achieved by applying a pull-up resistor to the RESET line. This pull-up resistor makes sure that reset does not go low unintended. The pull-up resistor can in theory be of any size, but if the Atmel AVR should be programmed from e.g.
STK®500/AVRISP the pull-up should not be so strong that the programmer cannot activate RESET by draw the RESET line low. The recommended pull-up resistor is 4.7kΩ or larger when using STK500 for programming. For DebugWIRE to function properly, the pull-up must not be smaller than 10kΩ.
To protect the RESET line further from noise, it is an advantage to connect a capacitor from the RESET pin to ground.
This is not directly required since the AVR internally have a low-pass filter to eliminate spikes and noise that could cause reset. Applying an extra capacitor is thus an additional protection. However, note that this capacitor cannot be present if DebugWIRE or PDI is used.
If not using High Voltage Programming it is recommended to add an ESD protecting diode from RESET to Vcc, since this is not internally provided due to High Voltage Programming. Alternatively, or in addition, a Zener diode can be used to limit the RESET voltage relative to GND. The Zener diode is highly recommended in noisy environments. The components should be located physically close to the RESET pin of the AVR. Figure 2-2 shows the recommended circuit on the RESET line.
Interesting, good info re: the cap, and reinforcement of my foggy memory for the diode. I wonder why Arduino used the cap on the Mega, but not on the Uno and several other boards.
The reset circuitry on Mega and Uno are a bit strange, but I suppose certain features were retained through the history of the various boards. If somebody were to take a fresh approach, the 16U2 should just send an appropriate length reset pulse from PD7 to the main processor, instead of simulating a DTR which goes low and stays low, and then doctoring that signal with extra circuitry. The capacitors and diode and all that junk should not be needed. All you would need is a 1K or so resistor between 16U2 PD7 and the main processor RST to prevent contention in the event an external reset is used.
The cap between RST and GND probably helps shape the pulse. It would not need shaping at all if they just designed the firmware on the 16U2 to send a reset pulse instead of DTR.
When you look at the schematic and firmware all together, you should end up scratching your head and saying "hmmm"...
Hi, i am not able to burn Bootloader in my custom board which has Atmega2560...actually,in my custom board,i am using Atmega16u2 chip as usb to serial programmer..
I followed below procedure
- I connected my board to pc(windows 8.1,64 bit os) with the help of usb cable.
- Then i checked device manager in pc..my board was displaying in other devices like Atmega16u2(DFU)
- I installed atmel studio 6.0 and FLIP3.4.7 also( i follwed below link "How to Flash Arduino Bootloader without a Programmer – Welldone Blog" )
- Next,on my custom board,icsp of usb controller-->i linked 5-6 pins(reset and ground pins)then i gave power to my board means conneted usb cable to pc..
- In Device Manager board displaying under other devices like Atmega16u2(DFU) with yellow color exclamatory symbol.
- Then i right clicked that Atmega16u2 DFU and updated driver software(choosen path from my pc...
path: "OS(C)/programfiles(X86)/Atmel/Flip3.4.7/usb" - Finally Installed...then it showing Atmega16u2 under libusb devices in Device Manager..
- After this,i uploaded avrisp mkII hex file from flip software... i removed usb cable connection ..again i connected that usb cable to my pc...
main problems i found:
- avrisp mkII device displaying under libusb devices folder...instead of jungo connectivity..
2)in atmel studio 6.0,i found avrisp mkII as tool,then i selected device i.e Atmega2560 next i clicked apply button...but im getting error popup like
"unable to connect to tool AVRISP mkII(000200312345)"
details: Timestamp: 2017-07-26 16:15:56.862
Severity: ERROR
ComponentId: 20000
StatusCode: 0
ModuleName: TCF (TCF command: Tool:connect failed.)
can u please tell me,which version of atmel studio will support windows 8.1,64bit and why jungo connectivity is not getting avrisp mkII instead of libusb devices
how can i approach burning bootloader in atmega2560 ...plz tell me exact procedure