First I need to say, I'm a complete electrics newbie, so I need your help.
I have got a standalone Atmega 2560, which I want to program. I connected MISO, MOSI, SCK, RESET, 5V and GND to an Arduino Uno. In addition a 16MHZ oscillator is connected to XTAL1 and XTAL2 plus I pull all VINs of the Atmega with a 100nF to GND. Plus I connected a separate VIN and GND to the 2560.
I programmed the Arduino Uno as an "Arduino as ISP". Afterwards I connected the 2560 as mentioned above, changed the board to "Mega 2560" and tried to upload a sketch through the Arduino and I get the error message: avrdude: stk500v2_getsync(): timeout communicating with programmer
Is there something I missed?
Cheers jb
1 Answer 1
I have a sketch that programs bootloaders. A side-effect of that sketch is it fixes up the "divide clock by 8" fuse.
It looks like the wiring will be the same, but cross-check on that page (scroll down to the part about programming the Mega2560).
Once a bootloader is installed you could use it, if you get an FTDI cable, or simply go back to using the ArduinoISP now that the fuse is fixed.
-
Thanks @Nick I was able to burn the bootloader to my 2560 with "Atmega_Board_Programmer": Erasing chip . Writing bootloader . ... Written. Verifying. No errors found. Writing fuses. LFuse = 0xFF HFuse = 0xD8 EFuse = 0xFD Lock byte = 0xEF Clock calibration = 0x89 Done. Signature = 0x1E 0x98 0x01 Processor=ATmega2560 Flash memory size = 262144 bytes. LFuse = 0xFF HFuse = 0xD8 EFuse = 0xFD Lock byte = 0xEF Clock calibration = 0x89 Bootloader address = 0x3E000 Bootloader length = 7474 bytes. Look good so far, but still I got "timeout" when uploading my own sketch. Did I miss something?jblaze– jblaze2015年07月11日 12:04:19 +00:00Commented Jul 11, 2015 at 12:04
-
So far, so good. The chip is alive. :) Please describe your wiring for uploading your own sketch. I'm not totally sure that ArduinoISP supports the Mega2560 - it may do. Alternatives are cheap ISP programmers from eBay and other suppliers (like Adafruit or Sparkfun), get an FTDI cable and use that for serial programming using the bootloader, or use my sketch "Hex uploader" that uploads from an SD card. You need an SD card adapter for that, but they are around 15ドル.2015年07月11日 21:43:43 +00:00Commented Jul 11, 2015 at 21:43
-
Yes I think so. My wires are: MISO-MISO, SCK-SCK, MOSI-MOSI, 5V, GND, and Pin10 Uno to Reset in Mega. // Tthe fuses should be OK with your sketch "Atmega_Board_Programmer"? I have this crystal (3 leg) with a 1MOhm resistor between both legs connected to XTAL1 and XTAL2: CSTCE16M0V53-R0. The middle leg is connected to GND. // Thanks for the hint with the programmer. I will search for one.jblaze– jblaze2015年07月12日 08:08:57 +00:00Commented Jul 12, 2015 at 8:08
-
I was able to write my sketch to the Atmega2560 with a USBasp. But somehow the program does not work. Simple example: I have a small LED connected to Pin D2 (thats PE4 on Atmega2560). But when I do "digitalWrite(2, HIGH);" it is not working (it has been initialized before with "pinMode(2, OUTPUT);"). Anything I need to change in my sketch? Or do I need to change fuses?jblaze– jblaze2015年07月13日 06:06:36 +00:00Commented Jul 13, 2015 at 6:06
-
I think you should start a new question now. You can upload sketches so this particular one is dealt with. As to why it doesn't "work" please make a post describing your setup, post the sketch, show your wiring, etc.2015年07月13日 07:31:44 +00:00Commented Jul 13, 2015 at 7:31
-B10
) to program the new fuses