I am trying to upload a sketch onto an Arduino Mega using an Arduino Mega as the programmer. I am getting the error "avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x06". I have the following pins connected.
Programmer to Target Mega
ICSP MISO -> ICSP MISO
ICSP SCK -> ICSP SCK
Pin 10 -> ICSP RESET //I think this should be pin 10 here? I have tried pin 53 (SS) also.
ICSP VCC -> ICSP VCC
ICSP MOSI -> ICSP MOSI
ICSP GND -> ICSP GND
The procedure I have been using:
Select Board as MEGA 2560
Upload sketch to programmer MEGA board as normal
Select Programmer as "Arduino as ISP"
Select Board as MEGA 2560
Click "Upload using programmer"
Am I right in saying that if I upload a sketch this way, I won't need to upload the bootloader?
I've been reading up guides on how to do this but I am still getting an error.
My plan is to build a custom PCB with an Atmega 2560 with the ICSP pins so I can program directly onto the chip without the need for a USB interface.
jonnyl888:
Am I right in saying that if I upload a sketch this way, I won't need to upload the bootloader?
To upload code via ICSP you do not need a bootloader.
BUT by burning the bootloader also the fuses (basic configuration, like internal or external clock and so on) are set.
So you have to burn bootloader at the beginning.
But also without this step you should get connection.
Select Board as MEGA 2560 and the serial port it is connected.
Upload sketch "Arduino as ISP" to your "programmer" (=ATMega 2560)
Write code for the target, or use a very basic example (blink).
Ah I see thanks, I thought the ArduinoISP was the bootloader! I’ll give it another go.
Do you mean these caps on the schematic (attached)? So If I were to create my own PCB, I will need these on my circuit for it to be able to upload sketches?
Two 22nF are needed for the crystal but the value could be according used crystal and its capacitance. See the datasheet for ATmega2560 how to select proper value . 100nF capacitors are for MCU decoupling and should be for each VCC pin and as close to pin as possible.
jonnyl888:
Do you mean these caps on the schematic (attached)? So If I were to create my own PCB, I will need these on my circuit for it to be able to upload sketches?
Yes, these caps in the pictures.
They are needed not (only) to upload sketches but to get the ATMega 2560 to run. It is part of the "minimal basic setup" of the micro-controller.
Thanks for the info guys, I managed to upload the sketch through ICSP. For a while I wasn't working, it would upload fine but the program wouldn't run on the Mega. Then I found this thread, of somebody doing the same thing. Had to add a new board to the boards.txt file because of a software bug on the Mega? Somehting about setting fuses.