First day - Mixed progress

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

Hi,

Mixed day, it was going well....

AVR Studio 4 (4.13/528) on XP Pro
WinAVR / GCC - 20070525
ATMeta324P on a bread board, 5V supply
AVRISPmkII USB (upgraded via studio)

Got my LEDs flashing etc using 125kHz ISP update speed, and internal clock - all really good.... (some questions but they can wait)

Then I wanted to move to an external oscolator, went to the fuse page, and unchecked the CKDIV8 and checked "Ext Clock; Start up time 6CK + 65ms (SUT=10)". - Not sure if that was the right option - I think rereading it might an external signal clock feed - not an external osc....

Anyway it applied ok, I added a 4Mhz Osc + two 27pF caps to ground and now I can't get any life / contact / programs to work with the Mega....

From the Studio ISPmkII interface:

Getting revisions.. HW: 0x01, FW Major: 0x01, FW Minor: 0x06 .. OK
Getting VTARGET.. 5.0V .. OK
Getting ISP frequency parameters.. SD=0x06 .. OK

Setting mode and device parameters.. OK!
Entering programming mode.. FAILED!
Leaving programming mode.. OK!

I've tried different Osc (16Mhz, 9Mhz), different ISP rates, including 51kHz for the erase function (which I think is a requirement) - all the same results - Programming mode FAILED

I think the 'solution' is to erase the chip and start again - but the ISP isn't playing that game.

This is my first embedded chip so go a little easy on me..... What should I be doing next / what have I got fundementally wrong?

Thanks,

Carl

--
http://www.rvproject.gen.nz/

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

This is a mistake most people make ONCE.
I assume that you want to use a crystal applied between XTAL1 and XTAL2 with some caps (probably 22p is a good value) to GND on both pins.
External clock is something different than a crystal/oscillator.
To get a working device again you need to apply a clock to XTAL1 and change your fuses.
You can use anything as an "external clock" that will produce a square wave.
Frequency generator, 555 chip or another AVR will work.
The "external clock" needs to be at least 4 times faster than your ISP clock speed and must not exceed Vcc.

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

My guess: You set the clock to accept a TTL external clock, therefore not a crystal clock. Apply some TTL signal to the XTAL1 (or XTAL2 pin, can't remember)with the frequency of some MHz and then you can program. Program it with a different setting.

PS: Nice project! Do you send free samples ;-) ?

[edit] Lennart beat me to it.

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

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

OK - Thanks for the that - I was sorta getting there with my reading... I've got another 324P - I guess I get one more chance.....

Can you confirm I need to use PORTB1 on the 2nd Mega, and connect to XTAL1 on 1st Mega to reprogram. I also guess I need to enable CKOUT fuse on the 2nd Mega.

Yes I'm trying to get the external crytal. I should be using CLSEL=111 (>8Mhz Osc) (and then choosing the suitable SUT) - is that correct?

Thanks

Carl (still on the vertical bit of the curve.....)

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

Quote:
[edit] Lennart beat me to it.

Sorry for that David :wink:
Carl, I didn't look at your project until Dagg asked for free samples, now I realize we had some conversation before. Please send me a free sample too :D

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

Yes Carl. I think you have got a good way to solve this.
XTAL1 is the pin to apply clock to.

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

Thanks guys for the help - I have flashing LEDs again ;-)

Samples - rather difficult - but that 'free ride' tends to be a long / expensive process..... Currently > 3000 man hours into it......

Cheers,

Carl