High Voltage Fuse Reset on ATMega2560

Hi, for a few months ago I set some fuses wrong and ended up with a ATMega2560 prototype board that was of no use. I knew from the beginning that it could be "saved" through HV programming but put it to the side because I had more boards to work with...It's now time to save this one.

I have had a read through this tutorials of how to do it:
http://www.societyofrobots.com/member_tutorials/node/239

and the original one that the above is based on:

The first questions I have is regarding using a ATMega2560 as a programmer instead of the smaller boards they use in the tutorials, do I use the same ports (PD,PC,PA..etc) as in the tutorial or the same arduino pins? Do I have to change the sketch?

Second question, what pins should I use on the bricked MCU for HV programming? Same ports (PA,PB,PC..etc) or different pins from the smaller MCUs?

Cheers!

This explains a lot, Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer

Are you sure you need HV programming ?
Can you read the fuses with avrdude ?
http://www.engbedded.com/fusecalc

For the MEGA, you need to use the MISO, MOSI, SCK pins.
Only the Reset pin is fixed to pin 10.

Uno:
MOSI = D11
MISO = D12
SCK = D13

Mega:
MOSI = 51
MISO = 50
SCK = 52

Erdin:
...
Are you sure you need HV programming ?
...

I'm pretty sure because I disabled ISP on the Mega, but do you have any suggestions besides HV programming the resets the fuses?

Cheers

No, disabling the ISP disables the fuse access.
Some AVR chips can use the DebugWire interface that is also capable to get to the fuses. But the ATmega2560 doesn't have that.

I read that HV programming is not that hard to do for a standalone chip.
This has some information, Arduino-based AVR High Voltage Programmer | MightyOhm
For a Arduino board, you must make changes to the pcb, to be able to set 12V to the reset pin.

Erdin:
...
I read that HV programming is not that hard to do for a standalone chip.
This has some information, Arduino-based AVR High Voltage Programmer | MightyOhm
For a Arduino board, you must make changes to the pcb, to be able to set 12V to the reset pin.
...

Yes, I've been reading that too as I wrote previously and the main question is how to hook it up on another MCU then the one he uses.

Is it still port B,D and C that is used to HV program my ATMega2560?

Cheers

Erdin:
No, disabling the ISP disables the fuse access.
Some AVR chips can use the DebugWire interface that is also capable to get to the fuses. But the ATmega2560 doesn't have that.

I read that HV programming is not that hard to do for a standalone chip.
This has some information, Arduino-based AVR High Voltage Programmer | MightyOhm
For a Arduino board, you must make changes to the pcb, to be able to set 12V to the reset pin.

Yes, if it's a rev3 board there is a diode installed between the reset pin and +5vdc that would have to be removed before you could safely apply +12vdc to the reset pin.

Lefty

retrolefty:

Erdin:
...
For a Arduino board, you must make changes to the pcb, to be able to set 12V to the reset pin.

Yes, if it's a rev3 board there is a diode installed between the reset pin and +5vdc that would have to be removed before you could safely apply +12vdc to the reset pin.
Lefty

To clarify, I have a custom board that is "bricked". And I have a normal Arduino Mega to use for the HV programming..

I found the answer myself, different MCUs may use different pins for HV programming. The specifics can be found under the chapter "Memory Programming -> Parallel Programming Parameters, Pin Mapping, and Commands" in each MCU documentation.

And to make the setup simpler the HV sketch needs to me modified slightly.

Cheers

Try this first:

If no response, you are going to need a high-voltage programmer. Might be cheaper to just replace the chip. However there are some HV kits around I think for around $40. The AVR Dragon is about $60 from memory.

What about JTAG programming? The ATMega2560 supports that. And buying a JTAG programmer introduces you to the world of JTAG debugging as well.

That is unless you disabled that as well (it is enabled by default.)

Be careful with JTAG - Nick, didn't you run across JTAG being enabled would disable ICSP and prevent bootload installlation, something along those lines?

I don't see how that would be possible when it is enabled from the factory and thousands of people use ICSP to program their brand new fresh chips.

Programming through the JTAG interface requires control of the four JTAG specific pins: TCK,
TMS, TDI, and TDO. Control of the reset and clock pins is not required.
To be able to use the JTAG interface, the JTAGEN Fuse must be programmed. The device is
default shipped with the fuse programmed.

I have never had a problem with it.

I admit I could be a little mixed up in this area.

CrossRoads:
Be careful with JTAG - Nick, didn't you run across JTAG being enabled would disable ICSP and prevent bootload installlation, something along those lines?

Not bootloader installation, however with JTAG enabled certain output ports are overridden.

Actually, that is if OCD is enabled if I read the datasheet correctly. Then the JTAG pins are held exclusive to the debugger. But there is no issue with just enabled JTAG and using it for boundry scan or programming, erasing, etc... As I mentioned, it is set to enabled by the factory.

I know that you guys know what OCD is, but for the sake of the original poster and those that stumble on this thread... OCD is On Chip Debug which some AVRs support. It allows interactively stepping through the program, setting breakpoints, and getting the values of the registers and IO pins while code is running through AVRStudio. A bit tricky to fully understand, but a huge asset when developing and debugging your code/hardware. You need an ICE (In circuit Emulator) to make use of it.

I have an expensive one I purchased way back when, and a cheaper clone of the official JTAGICE from ATMEL that doubles as an AVRISP programmer.

But, as mentioned, enabling OCD in the fuse settings will make the pins associated with JTAG unavailable for GPIO. It will also draw excessive current in sleep modes. So, don't leave it enabled in the final application. Only during debug. The mode can actually be set in software as well as through the fuses.