The usual external clock lockout accident...

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

Hello everyone!
Sorry to open yet another AVR lockout recovery thread, but I have not been able to solve the problem on my own.
First of all, I have an Atmega 1284 for which I built a devboard myself (using this scheme: http://avrprogrammers.com/atmega1284bd.php).
I used the board fine (MCU set to use internal clock source at 8mhz, xboot++ boot loader, 5v supply and an Olimex ISP500 for initial programming) until yesterday, when I found an 16Mhz crystal oscillator (rectangular, 4pin, I'm not talking about a simple crystal) and decided to try it.
The oscillator is a recovery from some 20y old board and I couldn't test it (my oscilloscope can do 5mhz max) and couldn't find a datasheet either (the model is Motorola K1148B, with 16.00Mhz written on top of it), so maybe it's malfunctioning. Yep, after all it was not a very good idea to rely on it...

Anyway, now the damage is done: I flashed my MCU with the following fuse settings

    LOW 0xE0 (which should set the clock source to Ext. Clock, Startup time 6CK + 65ms) HIGH 0x96
    EXT 0xFF
The oscillator is powered by the same PSU that powers the Atmega, and the OUTPUT pin is connected to XTAL1 (as the pinout for these oscillators seems to always be the same, i used the datasheet from another one to find which pin is which).

Sadly, now the 1284 does not startup anymore, either without (which is expected) or with the oscillator connected. My ISP programmer (Olimex ISP500, used with avrdude) doesn't want to program the device either.

So, supposing that the oscillator IS working:
1) Anything bad in my fuse configuration that i might have overlooked?
2) Can a slow startup time of the oscillator cause my ISP programmer to timeout when trying to program? (the ISP500 starts powering the circuit when the programming begins, i think...)

Supposing the oscillator is NOT working:
1) I'm trying to obtain a few newer oscillators at various frequencies (1Mhz, 8Mhz and 16Mhz). Should the old oscillator be the problem, is sufficient for me to plug the new and working one in the board and to get my atmega working again?
2) I tried supplying the clock to XTAL1 using the ISP500 (it has a fixed 62.5Khz clock source on pin 3) but i was still unable to connect to the device. Do i need to slow down the programming to get this working? (tried -B 200 in avrdude, but nothing came out of it... got some more flags to try?).

The bottom line is that i want to get my Atmega1284 working again, and learn something in the process. Advice is appreciated ;-)

Thanks for taking time to read this and sorry for my English. I'm not a native speaker. :)

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

ISP500 does not provide power to the target, you'll have to power up the '1284.

As an aside, you seem to have JTAG enabled. You might as well disable it, unless you have another programmer beside the ISP500.

Also, operating without BOD is generally a bad idea, unless you have a specific reason to have it off.

Last Edited: Wed. Mar 6, 2013 - 10:36 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Recovering a locked out AVR

may be easiest just to use a second micro to generate a clock (and your scope should be able to check it).

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

mikericetga wrote:
ISP500 does not provide power to the target, you'll have to power up the '1284.

I probably did not specify my programmer model correctly: what i'm using is this
https://www.olimex.com/Products/AVR/Programmers/AVR-ISP500/, and it does power the target, at least while programming (i already used it multiple times, always with the avr disconnected from the power supply!).

Quote:
As an aside, you seem to have JTAG enabled. You might as well disable it, unless you have another programmer beside the ISP500.

Also, operating without BOD is generally a bad idea, unless you have a specific reason to have it off.

Both good ideas, I'll do as soon as i get the mcu working again!

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

clawson wrote:

may be easiest just to use a second micro to generate a clock (and your scope should be able to check it).

Indeed, Probably the fastest way would be using my Arduino UNO and do exactly that.
Do you think that i can power the 1284 using the 5v from the Arduino?

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

Quote:

Do you think that i can power the 1284 using the 5v from the Arduino?

I would think so. USb can provide 100mA (without negotiation) so as long as the Arduino+1284 don't load it too much then that should be fine.

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

From the Olimex AVR-ISP500 Manual, page 10 (trouble shooting)...

Quote:
 Target power might not be stable enough or supply voltage might be
too low. Check your target board circuit. Ensure that the used AVR
chip specifications match your supply voltage.
 Target power supply VCC might not be connected to pin 2 of ICSP6/10. Check your target board circuit.

It is some times possible for enough current to 'leak' from the programmer, via the Vcc clamping diodes, to power the avr. Some times.

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

mikericetga wrote:

It is some times possible for enough current to 'leak' from the programmer, via the Vcc clamping diodes, to power the avr. Some times.

This is interesting... I've been programming MCUs for a month using that and only now i find that the thing worked by chance (and as it always worked i imagined it was the correct way of doing it!).

Well, thanks a lot! As soon as i get back home this evening I'll have to re-run all my tests with correct power applied. And if that doesn't work I'll try to generate the clock using my Arduino board :)

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

Yeah, the first ISP500 I bought leaked a lot... and failed after about a dozen uses.
The second one doesn't seem to leak much at all, and has burned a bundle of AVR's.

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

I've just been able to test and... success!
Correctly powering the board proved decisive (ehm...), so thanks a lot mikericetga and clawson!
I also found another oscillator (1mhz this time). This one works great, and the 16mhz one still does not work: i guess it's dead.

Atmega resurrected and all is well :-)

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

Glad to hear it ( the '1284', not the oscillator ! )

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

I guess you can't expect too much from 20 years old scavenged hardware :-)
I'll come by a working one sooner or later, in the meantime i can go on experimenting.

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

Back in the day, I used to scrounge components anywhere I could find em. Ride my bicycle down the streets on trash pickup day, looking for tossed out TV sets, radios, record players.

Lots of fun, and I often made myself some extra spending money when I found some thing that just needed a little fixing up.

I still scavenge somewhat, but thanks to my wife, the habit is not as bad as it used to be. :roll:

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

hkzlab wrote:
This one works great, and the 16mhz one still does not work: i guess it's dead.
If you have a shortwave radio, or know somebody that has one, you can see if the 16 MHz oscillator is doing anything at all. :)

I have seen this kind of oscillator in catalogs with the option for the "enable" pin to be active high or active low. You might try it both ways.

(I know you fixed the original problem - just some ideas on how to test salvage parts.)

I hope this helps!

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

Quote:
Back in the day, I used to scrounge components anywhere I could find em. Ride my bicycle down the streets on trash pickup day, looking for tossed out TV sets, radios, record players.

I did that for old computers :-)

Quote:

I have seen this kind of oscillator in catalogs with the option for the "enable" pin to be active high or active low. You might try it both ways.

Yup, tried with disconnected pin, and with pin tied to either GND or Vcc, but neither worked :-/

Anyway, just today i found an old 10Mhz oscillator which works fine: I can upload code through my serial adapter at 115200bps with that!