Standalone ATMega2560 Sketch Upload Problem

I have standalone ATMega Chip with bootloader uploaded following Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer

I have attached the terminal output I got by atmega board detector sketch

Compiled on Aug 25 2014 at 14:11:26
Entered programming mode OK.
Signature = 1E 98 01 
Processor = ATmega2560
Flash memory size = 262144 bytes.
LFuse = FF 
HFuse = D8 
EFuse = FD 
Lock byte = EF 
Clock calibration = 48 
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 8192 bytes starting at 3E000

Bootloader:

3E000: 0D 94 89 F1 0D 94 B2 F1 0D 94 B2 F1 0D 94 B2 F1 
3E010: 0D 94 B2 F1 0D 94 B2 F1 0D 94 B2 F1 0D 94 B2 F1 
*Snipped*
3FFF0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 

MD5 sum of bootloader = 8A F4 7A 29 43 A0 D8 7C DB ED 09 A3 8F 40 24 1E 

First 256 bytes of program memory:

0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
*snipped*
F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

I get the following error when i try to upload sketch via FTDI

Binary sketch size: 4,126 bytes (of a 258,048 byte maximum)
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

Can someone figure out the mistake I am doing?
Thanks

board_detector_output.txt (29.9 KB)

(deleted)

spycatcher2k: Do you have a cap on the reset line? what happens when you tap reset when your sketch is ready to upload.

Yes I tried that too, but nothing really happen. how much micro farad capacitor is recommended? and on which pin of FTDI should the reset (Pin 30) of Atmega2560 be connected? Hope I got u right spycatcher2k?

I read somewhere online, that reset could be attached to ground via push button, and when Arduino IDE shows Binary sketch size: xxxx bytes (of a 258,048 byte maximum), press the reset button, but that also didnt help.

How is your standalone 2560 board wired up?

ATMega2560 FTDI RX0 (Pin2) Tx TX0 (Pin3) Rx Reset (Pin30) DTR Via 0.1uF Cap

Vcc +5v Gnd Gnd

and also Xtal on 33 n 34 pin, 18pF cap to ground

I was thinking more the board itself, how is that wired up? crystal, caps, etc.

Only crystal is connected on 33 and 34, and that crystal is connected to 18pF cap each and other terminals of cap grounded

nothing else is connected to board

i have attached a pic, though not to clear, but just for reference.

You probably want some decoupling capacitors on the +5V pins.

Since you got the bootloader on there, things must be reasonably OK. Try putting a logic analyzer, scope, or even an LED with a resistor on the Tx/Rx pins to see if anything at all is happening there.

somin_soni:
I have a standalone ATMega2560, connected with 16Hz Crystal,

So this is a 16 MHz crystal, right?

Yes, it is a 16MHz crystal, i did typo…

I’ll try to see that happen on Rx/Tx with a scope tomorrow and post results here.

Thanks for your reply Nick

I can't believe it works with the crystal 6" away like that.

You will need a 10K pull up resistor on the reset pin.

CrossRoads:
I can’t believe it works with the crystal 6" away like that.

Sir CrossRoads I have got a new board with Atmega2560 pin out in which crystal is placed just beneath the pins

hiduino:
You will need a 10K pull up resistor on the reset pin.

Hiduino, I have put a 10k Pul up resistor to the reset pin and connected this junction to DTR via 0.1uF capacitor

I have attached pics of all the connections just for reference

But Still I am unable to upload sketch via RX0 TX0 :(, getting the same timeout error

And does the length of wire from Rx to Tx and Vice Versa from FTDI to ATMEGA Chip matters? I am using jumper wires of approx length 20cms

The Rx/Tx wire lengths is okay. How is power applied? I don't see that.

5v supply from arduino mega(Nothing else connected to this Arduino, using it just for power supply) to Vcc and Gnd of ATMega2560 chip. Have made the ground common of FTDI and Power supply of board.

The bootloader & fuses were programmed without issue on the new board?

CrossRoads: The bootloader & fuses were programmed without issue on the new board?

Yes :|, using ISP pins and mega2560, using nick's bootloader sketch.

That new board you are using from Nex-Robotics is using a 14.7456 MHz crystal. The bootloader will need to be rebuilt to have proper serial baud rates, otherwise your upload baud rates will be off.

Can boards.txt be changed to reflect that?

##############################################################

mega2560.name=Arduino Mega 2560 or Mega ADK

mega2560.upload.protocol=wiring
mega2560.upload.maximum_size=258048
mega2560.upload.speed=115200

mega2560.bootloader.low_fuses=0xFF
mega2560.bootloader.high_fuses=0xD8
mega2560.bootloader.extended_fuses=0xFD
mega2560.bootloader.path=stk500v2
mega2560.bootloader.file=stk500boot_v2_mega2560.hex
mega2560.bootloader.unlock_bits=0x3F
mega2560.bootloader.lock_bits=0x0F

mega2560.build.mcu=atmega2560
mega2560.build.f_cpu=16000000L <<< change to 14745600L ??
mega2560.build.core=arduino
mega2560.build.variant=mega

##############################################################

millis( ) and micros( ) might be off, Serial could still work ok.

You can upload sketches using the hex uploader sketch as documented here:

http://www.gammon.com.au/forum/?id=11638

That doesn’t use the serial port for programming. You will need an SD card breakout board ($15):

After all, if you can program the bootloader using SPI you can program anything.

Hey I am new here so first off all let me say hello!

I am trying to burn a bootloader on my NEX FireBird V robotic platform. So for I figure out that there is uncopability with the external oscillator.

I get this error after sucessfull bootloader burn:

avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer

How may I rewrite a bootloader to change external oscillator from 16000000L to 14745600L?