Need some guidance please.
I have an older faulty Mega2560 that I need to replace.
Seems to be a USB problem, as the PC ( XP sp3 ) only sees an "Unknown Device" and I have spent weeks looking for a solution.
I want to work out how to program the old Mega2560 board using an AVR Programmer and ICSP connection.
However, I can not risk damaging or destroying the existing Mega2560, so here is my plan :
Use a new Mega2560 and AVR Programmer. Once I get these working well and reliably, try to re-program the old board. If this does not work, then I can upload my sketch to the new Mega2560 and replace the board.
Purchased a new Mega2560 R3, and an AVR Programmer http://www.jyetech.com/Products/073/e073.php
and downloaded the latest version of eXtreme Burner 1.3 from http://extremeelectronics.co.in/software/extreme-burner-avr-1-3-beta-test/
I have made a cable to connect pins :
AVR Prog pin 9 - MISO to Mega ICSP pin 1 AVR Prog pin 2 - Vcc to Mega ICSP pin 2 AVR Prog pin 7 - SCK to Mega ICSP pin 3 AVR Prog pin 1 - MOSI to Mega ICSP pin 4 AVR Prog pin 5 - RST to Mega ICSP pin 5 AVR Prog pin 4 - GND to Mega ICSP pin 6
I am a bit confused here, as I don't know if the "Power Target" jumper should be on, and if the Vcc pin should be connected to the Mega2560.
If I leave these off, and I power the Mega using the USB cable, will the fact that it is plugged into the USB somehow prevent the AVR Prog from uploading over ICSP ?
When I connect the new Mega to the PC USB cable, the PC immediately detects the board, installs the driver, and creates Com3.
Next, I connect the AVR Programmer to the Mega2560 with the newly made cable ( tested with m.meter and all connected, no shorts ).
Plug the AVR Prog into USB, and the PC detects and installs the "LibUSB-Win32 Devices" > "USBasp"
Start eXtreme Burner, set the chip to ATmega2560 and open an existing sketch ( Blink ) and "build only" - works fine.
Use the "Read All" option, and retreives data from the Mega2560 board. ( does report errors if either the AVR Prog or Mega is disconnected, so reasonably certain it is communicating with the Mega ).
Here is where the problem started ...
I think, if I understand correctly, using the AVR Prog to upload has erased everything on the chip and uploaded the hex file.
This means that I can no longer use the Arduino IDE to upload to the board with USB ?
Tried to upload Blink, and takes a few minutes and eventually returns :
Binary sketch size: 1,718 bytes (of a 258,048 byte maximum) - 0% used avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer
I think that the IDE can definately see the board, because if I unplug the board from the USB cable, it reports :
Binary sketch size: 1,718 bytes (of a 258,048 byte maximum) - 0% used avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: ser_send(): write error: sorry no info avail processing.app.debug.RunnerException: Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions. at processing.app.debug.BasicUploader.uploadUsingPreferences(BasicUploader.java:126) at processing.app.Sketch.upload(Sketch.java:1649) at processing.app.Sketch.exportApplet(Sketch.java:1608) at processing.app.Sketch.exportApplet(Sketch.java:1580) at processing.app.Editor$DefaultExportHandler.run(Editor.java:2408) at java.lang.Thread.run(Thread.java:619)
Next I ( again ) assume that I would need to reload the bootloader to the Mega2560 board ?
Looked around the net, and I can't seem to find any info that agrees - there seem to be multiple bootloaders for the same board ?
I also saw multiple sites with info about the fuses for the Mega2560
If I use eXtreme Burner to read the fuses, I get :
Low 0xFF High 0xD8 Ext. 0x0F Lock 0xOF
I am not certain that these are correct. Ever since I 'experimented' with some of the fuse values I saw in different related threads, I can upload to the board ( using eXtreme Burner ) but it does not run after I reset the board.
So the problem is 3 part :
- what should the fuses be set to ?
- Jumper and pin connections from the AVR to Mega.
- where is the correct bootloader for the mega2560 R3 board.
- How to re-enable the USB upload option for the board.
- is my understanding of the problem correct ?