Debricking mega1284p

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

Wanting to test run code at a slower speed, I meant to change the fuses to internal RC oscillator and I rushed and clicked external low frequency oscillator instead.

This is the one that takes a 32KHz xtal on different pins. Oops. Board layout and connections meant adding a 32k xtal didn't work (no surprise).

Just to let all you know the secret to unlocking it was two-fold:

1) apply an external clock no more than about 40 KHz.
2) Apply it to the xtal2 pin NOT one of the TOSC pins where you would connect the low frequency crystal.

Don't ask me why this worked, but it did, and the low frequency was essential to success (having tried various higher ones first).

... and how I know what the problem was? the first thing I did after read signature succeeded was to read back the fuses to see check what I had done.

Cheers,

Joey

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

But HOW did you read the fuses after setting them wrong?
I have several times managed to click on the disable jtag fuse on an xmega USING THE JTAG to do it. If you do this the verify cycle on the fuse write FAILS (REALLY!). Recovery here was to wire up to the PDI pins.....

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

Quote:

But HOW did you read the fuses after setting them wrong?

I used read signature to test it, and when I got it working with an external clock, I read the fuses then changed them to use the internal oscillator, as originally planned.

Quote:

If you do this the verify cycle on the fuse write FAILS

That's what happened to me - merrily buzzing along at 16 MHz, clicked program expecting it to slow down a bit, but - 'failed to verify'. At first I thought I had the ISP frequency too high. Took a long while to fix, as I wasted much time putting various sensible frequency clocks into the XTAL1/2 pins.

Cheers,

Joey

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

joeyAVR wrote:
2) Apply it to the xtal2 pin NOT one of the TOSC pins where you would connect the low frequency crystal

That's according to the datasheet.

The TOSC-pins are only used for using T2 as RTC.
For the CPU clock always the XTAL-pins are used.

Peter

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

Quote:

That's according to the datasheet.

The TOSC-pins are only used for using T2 as RTC.
For the CPU clock always the XTAL-pins are used.

Not reading the datasheet I'm looking at (doc8059.pdf). The M1284 allows you to use the rtc oscillator as a main clock source and the xtal goes on the TOSC1/2 pins, not xtal/2 pins.

The normal oscillator pins only support crystals down to about 400MHz.

Cheers,

Joey

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

Quote:
support crystals down to about 400MHz.
!!!

:shock:

Where can I get one of these super fast chips?

:)

--greg
Still learning, don't shout at me, educate me.
Starting the fire is easy; the hardest part is learning how to keep the flame!

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

Xtal1 is the correct pin to inject a clock, not Xtal2.

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

There is a new Tutorial on this.

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

joeyAVR wrote:
Not reading the datasheet I'm looking at (doc8059.pdf). The M1284 allows you to use the rtc oscillator as a main clock source and the xtal goes on the TOSC1/2 pins, not xtal/2 pins.

Sorry, the datasheet seems not really clear in this point.

Table 8-8 (doc8272.pdf) show different pins and different capacitance for System Osc. and Timer Osc. usage.

Also Figure 8-1 show no connection from the Timer/Counter
Oscillator to the Clock Multiplexer.

So as System Osc. the 32kHz crystal must be connected to XTAL1/2.

Peter

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

Joey's solution is quite interesting.

IME, with the Low-Freq-Crystal Oscillator fuse, the STK500 cannot ever get the AVR going with any clock signal to XTAL1. The only way to recover is to put a real 32kHz crystal across XTAL1, XTAL2.

So driving the XTAL2 pin is not so stupid an idea. It may be an o/p but it is not a heavy driven o/p.

The 1284P has both XTAL1,2 pins and TOSC1,2 pins.
The mega..8 family have both functions on the same pins. After all, there is only sense in using TOSC if you are using the Internal RC for the System clock.

David.

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

David, Xtal2 is the *output* of the oscillator circuit. IMO, Xtal1 is the pin to insert a recoveryclock. Or am I missing something ?

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

I know that it is the 'output'.

You try any frequency from the STK500 into XTAL1. It just does not work.
OTOH, any other 'External' clock fuse can accept a clock signal into XTAL1 and 'win'.

If you think about it, the o/p from XTAL2 is what drives the System clock. (in any oscillator mode)

It will be low impedance, but I doubt that you will do much harm with a signal into XTAL2 for a short time. It is considerably simpler than unsoldering a chip for HVPP. However simply putting a watch crystal between XTAL1,2 is also fairly painless.

David.

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

Nard questions what I did... All I can repeat is:

Quote:

Don't ask me why this worked, but it did, and the low frequency was essential to success (having tried various higher ones first).

But I'm willing to go with David's explanation - my Tosc pins were too heavily loaded to accept a crystal across them, but I 'overloaded' xtal2 into accepting a clock - (this may be why the low frequency was needed?)

I'm in no hurry to repeat the experiment, but someone with a spare chip and the time may wish to!

Cheers,

Joey