[Solved] Unable to program code in ATmega2560 using MKII

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

Hello, i am having a strange problem and need some help on solving it.

I am using AVRISP MKII to program my ATmega2560, however the MKII cannot even get Device signature. I am attaching a screenshot... The LED on MKII keeps blinking in RED. I have confirmed the pins config and even tried connecting the ISP connector oppositely still no luck.

I have confirmed that MKII is working properly by programming an ATmega32.
I have checked the connectivity to MISO, MOSI, and SCK pins and everything seems to be OK.
I have confirmed that ATmega2560 is working by running the already burnt code (it contains some UART stuff and its working)

I think there might be a fuses problem ( a wild guess) but when i cant even read Device ID how can i read fuses...

I have tried narrowing down everything i knew still i cant get to the root of the problem and/or solution.

Edit: i am also using SDcard on same pins but i removed the card before programming still no luck

Edit2: i have tried different frequencies to program it still nothing works

Attachment(s): 

Last Edited: Thu. Sep 26, 2013 - 07:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clawson wrote a tutorial on recovering from fuse issues.

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

Kartman wrote:
Clawson wrote a tutorial on recovering from fuse issues.

Thanks i am reading though it now, i was wondering if the CKSEL fuse was the culprit then how uC is working normally with the external 16MHz crystal?
The program already inside the uC is working, its just that i can burn a new program...

p.s there are no capacitors with crystal. The board (built by a colleague) does not have caps which is weird. and he says it used to work even without caps

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

Quote:

p.s there are no capacitors with crystal. The board (built by a colleague) does not have caps which is weird. and he says it used to work even without caps

Sounds unlikely. The caps are part of the resonant circuit - it seems unlikely the crystal would resonate without them.

Just out of interest what was he thinking by including a crystal without caps?!?

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

clawson wrote:
Quote:

p.s there are no capacitors with crystal. The board (built by a colleague) does not have caps which is weird. and he says it used to work even without caps

Sounds unlikely. The caps are part of the resonant circuit - it seems unlikely the crystal would resonate without them.

Just out of interest what was he thinking by including a crystal without caps?!?

I too wonder that, when he is having by-pass caps then why not the capacitors for crystal? its specifically mentioned in datasheet..

I will modify the circuit but do you think this is why i am not able to program it? The existing code is working by the way (may be because uC is using internal clock but am not sure since i cant read fuses).

If CKSEL is set the external clock then the uC should not work at all right?

Edit: I just found out he is using 5v to run the SD card :o i have not tested the card right now but shouldn't it be fried already? There are no level shifters, no resistor dividers and i checked with DMM the SD card is getting more then 4.5v.

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

HellsGuardian wrote:
Edit: I just found out he is using 5v to run the SD card :o i have not tested the card right now but shouldn't it be fried already? There are no level shifters, no resistor dividers and i checked with DMM the SD card is getting more then 4.5v.
It is a bad idea, for sure. No, I don't recommend it, but...

I have found SD cards to be really quite robust. I made a little singing tree ornament for the holidays last year that I gave to family. Had a 328P, a microSD card for some WAV files, a tiny speaker, some caps, a button, and some LEDs. Ran off of 3 'AAA' batteries (gross, I know). Nominally 4.5V, but fresh cells actually push 1.6V, so Vcc was over 4.8V. Been almost a year, and my 3yr-old nephew still carries the thing around to hear my wife singing "Winter Wonderland". Hasn't fried yet.

Mind you, I didn't care if it did. Got a box of 4GB SD cards for $5 each (a good deal at the time). Also, I don't write to the card, so I have no data on how it would handle the high Vcc under those conditions.

Definitely a very bad idea for a 'product'.

JJ

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

The programmer is only reading 4.2V instead of 5V on VCC, something is wrong with your supply or ISP wiring.

Quote:
even tried connecting the ISP connector oppositely still no luck.
Good way to destroy the programmer. :(

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
The programmer is only reading 4.2V instead of 5V on VCC, something is wrong with your supply or ISP wiring.
Quote:
even tried connecting the ISP connector oppositely still no luck.
Good way to destroy the programmer. :(

Shouldn't 4.2v be considered a high? well the the rest of the PCB is getting exactly 5.00v (i am using 29150 to convert from 9v to 5) only the SPI pins are getting this voltage...

So what do you suggest? should i start tinkering with fuses (using alternate methods) or first work out why uC is not giving 5v?

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

Quote:
Shouldn't 4.2v be considered a high?
Whatever it is considered the programmer is NOT reading VCC on pin2 which should be the same as the VCC pins if wired up correctly.

What do you read on both the VCC pins (all of them) and AVCC? Do you have ALL gnd and VCC pins conected on the chip?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I have got the PCB design and schemtics and there is something even weird. In the schematic and layout, the pin2 of ISP header is connected to output of 3.3v regulator. Whereas the Controller is running at 5v :s

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

js wrote:
Quote:
Shouldn't 4.2v be considered a high?
Whatever it is considered the programmer is NOT reading VCC on pin2 which should be the same as the VCC pins if wired up correctly.

What do you read on both the VCC pins (all of them) and AVCC? Do you have ALL gnd and VCC pins conected on the chip?

Yes all are connected and Vcc is 5.00v

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

So now you may have to carry out some surgery and make sure that pin 2 of the ISP connector is also going to the 5V VCC line. :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Problem solved, still don't know the reason behind it. Anyway i manually pulled the reset to GND and then tried reading device ID and it worked.

Could it be programmer not pull the reset low? but it worked perfectly on ATmega32 and ATmega64A board.

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

But have you measured the voltage at pin 2 of the ISP connector? Is it 4.2V like the above window shows or 3.3V as you say that the pin is wired up to the 3.3V regulator?

The programmer adjusts it's output buffers in relation to what it reads on that pin, if that pin is wrong the programmer will not output the correct levels to the ISP connector.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
But have you measured the voltage at pin 2 of the ISP connector? Is it 4.2V like the above window shows or 3.3V as you say that the pin is wired up to the 3.3V regulator?

The programmer adjusts it's output buffers in relation to what it reads on that pin, if that pin is wrong the programmer will not output the correct levels to the ISP connector.

It is mostly 3.3v but i have to admit it and my DMM too) read 4.2v couple of times. Perhaps the regulator is going bad?

Right now its 3.3v still programmer does not work unless i manually short the Reset with GND. These has to be a fault in PCB because MKII works perfectly with other boards (mega32 and 64a)

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

I'm sorry but which part of pin2 MUST BE 5V if VCC is 5V don't you understand?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
I'm sorry but which part of pin2 MUST BE 5V if VCC is 5V don't you understand?

Right, ill connect it with 5v. In fact even without knowing i had suspected that how can levels be different. But you see its the senior colleague who keeps saying that this board used to work perfectly :/

by the way if microcontroller is running at 3.3v then ISP can also run fine with 3.3v right?

Thanks

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

Update: i cut the 3.3v trace and wired a 5v to pin2 and it works now! Thanks.

I guess who made the PCB forgot that this controller is running at 5v whereas rest of the boards (mega32,64A) are running at 3.3v

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

You can tape a cmos 4050 upside down with his legs in the air and use him as a 5V to 3.3V level shifter

Imagecraft compiler user

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

Quote:

You can tape a cmos 4050 upside down with his legs in the air and use him as a 5V to 3.3V level shifter


Or, tape it right-side-up and use as a 3.3V to 5V level shifter?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

bobgardner wrote:
You can tape a cmos 4050 upside down with his legs in the air and use him as a 5V to 3.3V level shifter

In PCD schematic there is a level shifter but for some reason he did not used it in acutal PCB. Instead he is giving 3.3v to SD card Vcc and 3.3v to ISP pin2 however the SPI pins are still at 5v.