Author Topic: ATMEGA2560 Not working but bootloader burns.  (Read 3843 times)

0 Members and 1 Guest are viewing this topic.

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
ATMEGA2560 Not working but bootloader burns.
« on: July 27, 2017, 12:18:25 am »
Hi
I have a circuit that has an arduino based section in it.
When I put it together the arduino bootloader burned successfully but nothing would come out of the chip.
No serial or plain high low logic.
So I tried on another board with only the caps, crystal stc for the arduino and the same happened.
I also desoldered a working chip with my code off an arduino twice and the same once more.
Any idea why this is?
will the ardunio run on just the crustal and two caps? is it wort trying?
Thanks in advance.
This is my right hand this is my wrong hand
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3047
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #1 on: July 27, 2017, 01:15:35 am »
Measure the voltage at RESET when it's not working but you think it should be working.

You should have a cap in series between reset and J2.5 in case the serial is pulling reset low all the time.

You should put a switch on reset so you can reset it manually.

R13 should not be necessary, probably doesn't do anything bad though, PIC people sometimes do this I think it was recommended on some PIC datasheet or something.

Aside from that nothing jumps out.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: abdullahseba

Offline hermit

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #2 on: July 27, 2017, 04:42:01 am »
You say you burned the bootloader.  How are you verifying it burned correctly. You don't say were able to upload a program?  Have you tried that?
 
The following users thanked this post: abdullahseba

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #3 on: July 27, 2017, 04:43:04 am »
You say you burned the bootloader.  How are you verifying it burned correctly. You don't say were able to upload a program?  Have you tried that?
yes I burned it via ICSP. And the desoldered ones where pre burned.
This is my right hand this is my wrong hand
 

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #4 on: July 27, 2017, 04:58:15 am »
Measure the voltage at RESET when it's not working but you think it should be working.

You should have a cap in series between reset and J2.5 in case the serial is pulling reset low all the time.

You should put a switch on reset so you can reset it manually.

R13 should not be necessary, probably doesn't do anything bad though, PIC people sometimes do this I think it was recommended on some PIC datasheet or something.

Aside from that nothing jumps out.

It measures around 4.7v.
This is my right hand this is my wrong hand
 

Offline tombi

  • Regular Contributor
  • *
  • Posts: 163
  • Country: au
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #5 on: July 27, 2017, 04:43:02 pm »
Is it an actual crystal or a resonator? I had to set some fuse to increase the drive level to make a resonator work once.

Do you have a scope? If so is it oscillating? You should see a low level signal on the crystal pins.

Tom
 
The following users thanked this post: abdullahseba

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #6 on: July 27, 2017, 05:20:03 pm »
Is it an actual crystal or a resonator? I had to set some fuse to increase the drive level to make a resonator work once.

Do you have a scope? If so is it oscillating? You should see a low level signal on the crystal pins.

Tom

Its an actual crystal with two caps. I tried multiple crystals including 12MHz. And I dont have an Oscilloscope :(
This is my right hand this is my wrong hand
 

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #7 on: July 27, 2017, 05:23:33 pm »
I just tried a serial echo directly in C and thats the only thing that got me some sort of output. but what ever I sent all I got was `w` or `o` and a few other characters.
its sooo puzzling and this is my 5th chip. 
This is my right hand this is my wrong hand
 

Offline alm

  • Super Contributor
  • ***
  • Posts: 2903
  • Country: 00
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #8 on: July 27, 2017, 05:27:40 pm »
Are the clock-related fuses set correctly? Given that you get some sort of output, it is likely not set to external oscillator (a somewhat common mistake). Does the clock rate match the F_CPU setting used while compiling the bootloader? Any clock division fuses set that might mess with this?

Do you have a scope or logic analyzer that you could use to look at the output to see if the baud rate is off? If the bootloader expects an 8 MHz clock, and you have CKDIV8 set, then your actual baud rate might be 1/8th of the expected baud rate. If you use a 12 MHz crystal instead of 8 MHz, then the baud rate might be 50% fast.
 
The following users thanked this post: abdullahseba

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #9 on: July 27, 2017, 05:31:56 pm »
Are the clock-related fuses set correctly? Given that you get some sort of output, it is likely not set to external oscillator (a somewhat common mistake). Does the clock rate match the F_CPU setting used while compiling the bootloader? Any clock division fuses set that might mess with this?

Do you have a scope or logic analyzer that you could use to look at the output to see if the baud rate is off? If the bootloader expects an 8 MHz clock, and you have CKDIV8 set, then your actual baud rate might be 1/8th of the expected baud rate. If you use a 12 MHz crystal instead of 8 MHz, then the baud rate might be 50% fast.

These are my current fuse settings with 16mhz.
And all I have is an Aglient U1252B DMM  :-BROKE
This is my right hand this is my wrong hand
 

Offline JoeO

  • Frequent Contributor
  • **
  • Posts: 527
  • Country: us
  • I admit to being deplorable
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #10 on: July 27, 2017, 08:55:41 pm »
How about a clear picture of your circuit board and all wires going to and from it.
The day Al Gore was born there were 7,000 polar bears on Earth.
Today, only 26,000 remain.
 

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #11 on: July 28, 2017, 12:42:42 am »
How about a clear picture of your circuit board and all wires going to and from it.

four dead boards later I got it working.
I have a feeling it was my USBasp playing up.
So i programmed it on the arduino than desoldered it and tried my best soldering unskills.  ;D





This is my right hand this is my wrong hand
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #12 on: July 28, 2017, 06:12:03 am »
I had a similar odd experience ecently with MEGA-1284P chips.

Using an OEM JTAG-ICE3 to program the bootloader - they failed, but when I pulled the ISP/SPI clock back down, they worked fine - then I could re-set the fuses to my preference, and push back up to high-speed programming and no more issues.
Don't ask a question if you aren't willing to listen to the answer.
 
The following users thanked this post: abdullahseba

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #13 on: July 28, 2017, 10:47:54 am »
I had a similar odd experience ecently with MEGA-1284P chips.

Using an OEM JTAG-ICE3 to program the bootloader - they failed, but when I pulled the ISP/SPI clock back down, they worked fine - then I could re-set the fuses to my preference, and push back up to high-speed programming and no more issues.
Ahh I kept getting `avrdude : warning : Can not Set sck period . usbasp please check for firmware update .` but as it was a warning I assumed it was not important.  :palm:
Should have mentioned it here.
This is my right hand this is my wrong hand
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #14 on: July 28, 2017, 11:23:39 am »
Nice looking project  what does it do ?
Don't ask a question if you aren't willing to listen to the answer.
 

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #15 on: July 28, 2017, 11:25:36 am »
Nice looking project  what does it do ?
Thanks :) Its a Digital voice announcement system (DVA) for a London underground train.
This is my right hand this is my wrong hand
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #16 on: July 28, 2017, 11:28:41 am »
If you're running the CPU on the crystal... I hope there are ~18pF caps on the other side of the board...!
Same as above for 10nF / 100nF decoupling capacitors.
ALL close to their intended purposes -  the xtal seems a long way from the CPU chip.
Cheers
Don't ask a question if you aren't willing to listen to the answer.
 

Offline abdullahsebaTopic starter

  • Frequent Contributor
  • **
  • Posts: 335
  • Country: gb
Re: ATMEGA2560 Not working but bootloader burns.
« Reply #17 on: July 28, 2017, 01:01:54 pm »
If you're running the CPU on the crystal... I hope there are ~18pF caps on the other side of the board...!
Same as above for 10nF / 100nF decoupling capacitors.
ALL close to their intended purposes -  the xtal seems a long way from the CPU chip.
Cheers
Yep I have 15pF on the other side. The crystal is about the same distance as my arduino. That second crystal is for the USB - audio chip.
This is my right hand this is my wrong hand
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf