problem programming MEGA324

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

OK some info:

I use a STK500 (a real one), and I can read and program a dip 324 no problem.

But now I have a new board I want to program, (and I did 3 or 4 times Friday), but now I can't! (I do know that the chip are running it has a 2.4" LCD and it get's the correct picture).

I have checked that my cable is correct (by putting the 6pin programming wire to the dip324, AND the 10pin to the remote AVR, and then PB5,PB6,PB7 and reset all are connected on the two chips. The cable is only about 50 cm long, so it should not be the problem,(often use a 3meter one!)).

Have tried different programming speeds etc.

I have tryed to disconnect the LCD, without it there should not be any real power use.

 

I use studio4 and program from inside it , if it matter. And I use 5V and run at 16MHz.

 

I assume that I and read chip ID even if the chip is locked is that correct ? (I get the normal error that it can't communicate and the speed max can be 1/4 of the chip speed etc ) 

 

Any ideas? 

 

Add:

I can see that it chip get a reset when I try something (and it rerun the LCD init), so it's not there the problem are.

This topic has a solution.
Last Edited: Mon. Nov 3, 2014 - 10:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't understand why you say 6-pin and 10-pin at the same time.

 

I presume that your mega324 and LCD are all on an external pcb.

In which case,   you either use 6-way ribbon or 10-way ribbon.    It just depends on which style of ISP header is on your pcb.

 

If you are using 10-way to your external pcb,   make sure that the 6-way ribbon is removed (if you have an AVR in the STK500).

 

Most 2.4" LCDs are designed for 3.3V (or 2.5V).

If you have level-shifter chips for your 5V,   make sure that they are 3-state during ISP.

 

David.

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

I assume that I and read chip ID even if the chip is locked is that correct ?

yes the 3 byte signature should still be readable even when lock bits are set.

 

I'd try three things:

 

1) use the STK500 as a clock generator and feed a clock to the chip's XTAL1 just in case there's been some kind of fuse damage

2) put a scope (better probably: a logic analyser) on the ISP lines and see if the lines are doing what you expect when you try to read ID or whatever

3) replace Studio with avrdude.exe to drive the STK500 simply because it can be a lot more verbose (-vvvv) to say what is/isn't happening.

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

@david

6 pin and 10 pin at the same time is just to check that the wire connections are ok in programming cable.

 

c@lawson

1) I can try but since the LCD works, something are oscillating.

 

I will do 2) now but only have a old scope here. 

 

Thanks

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

The cable is only about 50 cm long, so it should not be the problem,(often use a 3meter one!)).

WOW!!!! I use 5-6cm max.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

update 

an external clk did'n help

 

@david

The LCD run on 3.3V, but my chip run on 5V, PB5,PB6 and PB7 is not used in the app. so it should not matter.

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

Double check the individual lines.   Especially /RESET.    i.e. test directly between AVR pin and STK500 ribbon.

 

You can always use JTAG if your ISP wiring is wrong.

 

Yes,    the LCD or shifters will not affect ISP if it does not use /RESET, PB5, PB6, PB7 pins.

The STK500 will not mind moderate capacitance on the /RESET line.   e.g. 100nF

 

David.

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

new update (and the out for lunch).

If I give it 16 MHz external (from the 324 on the stk) on Xtal1 there is a signal on xtal2 (so the chip get the clk :) I had a scope on).

But then the LCD don't work ! (perhaps a hint I don't know).

 

@david

I have 100 nF on reset (the normal RC for when the programmer isn't on and that normally works fine (I have tryed to take if off but no change) )

add

And the first thing I do is to disable JTAG I use those IO's

 

update, I guess I just made a RF transmitter, that wasn't terminated. Now I have 1.2MHz from the stk500 and now the display work (but slow so I believe it use that clk ), but I still can't read any out of the chip. 

Last Edited: Mon. Nov 3, 2014 - 11:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is always wise to use JTD in software rather than clear JTAGEN.

 

You can get several clocks from the STK500.    e.g. crystal oscillator,  software clock, ...

But it your board is running an existing app,   you obviously have a clock.

 

I still reckon that you have connectivity problems.    It will be something VERY simple.

 

David.

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

ok problem found and solved (but need a new pcb layout).

My ISP port, a 1/20" SMD header, has via's under it, and they can touch the connector pins :(

Last Edited: Mon. Nov 3, 2014 - 12:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here so others don't make the same mistake:

 

It's the via's under J3 that's the problem.

 

And here it is when working:

 

Last Edited: Mon. Nov 3, 2014 - 12:50 PM