Is there a solution for the timeout problem after a successful bootload of a atmega2560?

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am currently uploading bootloader to a custom-made marlin board that uses atmega2560. This board is being used for a 3d - printer. I use Arduino UNO as the ISP to the board and I followed all the initial steps which are:

 - Give Board connections between UNO and the marlin board (The connections are the same as that of a Mega board)
I followed the steps according to this website: https://arduino-er.blogspot.com/...

 - Selected port, set the board as UNO, and selected programmer as AVRISP mkll.

 - Selected the Arduino ISP from the example programs and uploaded it to the UNO and selected programmer to Arduino as ISP

 - Changed the board to Arduino Mega or Mega 2560 and started the burn bootloader option

The bootloader is successfully burnt and when I try to dump a blink code, it starts the timeout error
At first, I figured out from other forums that the timeout was due to a small error in the boards.txt where the stk500v2 must be changed to wiring. 
But the error didn't stop and I am not able to figure out what's wrong here. Please help me out with this!

This topic has a solution.

JJSuriyaPrakash

Last Edited: Wed. Jan 12, 2022 - 05:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicFlea69 wrote:
I am currently uploading bootloader to a custom-made marlin board that uses atmega2560

Can you provide a link to this custom board, so we can see what it is? 

Does it have a 16MHz xtal for the mega2560, otherwise the Arduino Bootloader will not work, or may need to be modified for what the clock source is, and frequency!

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


This is the schematic of our board

It has the 16MHz xtal for the mega2560.

JJSuriyaPrakash

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the schematic, so it's similar to an Arduino Mega, the M16 acts like a usb to serial bridge, note there are two external programming connectors, one for each AVR.

So not knowing which AVR you connected too when you uploaded your code, you could have wiped out the USB bridge s/w on the M16, thinking you were attempting to write to the M2560....

You need to verify the M16 is still functioning as a bridge, you do that by holding the M2560 in reset by jumpering the its reset to gnd, pin 4 to pin 6 on J1.

Then tack a jumper to the M16 end of R9 to R10 to form a loop back connection.

Now connect the USB cable to the board, using the Arduino IDE's monitor function, type typing something in its send box and see if you see what you type returned to the monitor window, if so all is good with the M16.

If not, you will need to re-program the m16 with its driver hex file via J3. You can find tutorials on how to do that on the net. 

Once the M16 is working as the bridge, remove the two jumpers to restore normal operation.

burn the bootloader into the M2560, via J1, and now you should be able to upload your sketches into the M2560!

Good luck.

 

Jim

 

 

FF = PI > S.E.T

 

Last Edited: Tue. Dec 28, 2021 - 02:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess the hex is not loaded into the 16u2. Are there any ways to upload the hex via the isp pins. If so, can provide me any tutorials?

 

JJSuriyaPrakash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

did you set the fuses correctly? You do not mention them, but on a virgin Mega2560 they will not have the right settings.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The fuses for the board(as per the boards.txt file):
mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD9
mega.menu.cpu.atmega2560.bootloader.extended_fuses=0xF4
Are these the right fuse?

JJSuriyaPrakash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You schematic has very serious problems

 

Why is your comparator lacking a resistor from pin7 to 5??? This is needed to prevent output chatter.  Also, why are you not using a comparator in the first place?  (LM358 is not a comparator).

NEVER EVER leave opamp inputs floating, unless they have some sort of internal pull up/down.

Your schematic is chock full of mistake-prone 4 way connections.  Be sure to get rid of them in the next rev.

Where is the +24V coming from, it appears only in one place, at R5 (maybe on another sheet?)

Usually Aref is just a cap to gnd...double check whether you should be tying it to +

There is always a path from Q1 drain to source, regardless of the gate condition.   Is that your intention (which are you trying to switch on/off)? 

For reliability JP1 should be a zero ohm resistor, unless you really intend to be opening the gnd often.   Nothing like mysteriously losing a gnd connection when a jumper falls off. 

Your opamp appears to be missing a local power supply cap

For diodes use a SOT-23 (or similar) then you never worry about them being installed backwards (especially if hand-built)

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Dec 29, 2021 - 10:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AtomicFlea69 wrote:

The fuses for the board(as per the boards.txt file):
mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD9
mega.menu.cpu.atmega2560.bootloader.extended_fuses=0xF4
Are these the right fuse?

I miss the low fuse byte which might be the most important at this moment.

you need to set up for external 8MH+ crystal ( not oscillator !!!)

You need to enable the bootloader by enabling the reset vector and set the correct boatloader size

also you need to make sure you are not running at clk/8 so that fuse needs clearing.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The schematic is just for our reference and no op-amps or any other parts or not floating around. I guess it's some problem with the upload of the hex file to the 16u2!

 

JJSuriyaPrakash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried as you told and as you guessed is the missing 16u2's hex file. Can you suggest me any method to upload to the 16u2? I am newbie to this things so, please tolerate me!

JJSuriyaPrakash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

The schematic is just for our reference and no op-amps or any other parts or not floating around. 

What are you talking about...are you writing nonsense? 

 

This is the schematic of our board

What board is this????  Where is the schematic of your board?

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Wed. Dec 29, 2021 - 04:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I DID IT!! I burned the fuses, uploaded the bootloader and tried uploading the blink code and it got successfully uploaded. I thank @ki0bk and @meslomp for guiding me through. Cheers🥂

 

JJSuriyaPrakash

Last Edited: Thu. Dec 30, 2021 - 10:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have not addressed your floating opamps, this will cause a lot of noise in the system & may render the other opamp in the package non-functional.

Fixing only the software is only half the battel.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I said earlier, the op-amps are not floating and I don't have the permission to upload the custom board. I can guarantee you that all the components in the board are perfectly intact!

JJSuriyaPrakash

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I said earlier, the op-amps are not floating and I don't have the permission to upload the custom board

More accurately,  you said (#3):

This is the schematic of our board

If it were not, don't say this is the schematic of your board!!   

 I can guarantee you that all the components in the board are perfectly intact!  

That's a very pleasant observation....when you get a chance, check whether they left the inputs floating. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!