avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-chat] Boot loader weirdness


From: Larry Barello
Subject: [avr-chat] Boot loader weirdness
Date: Sat, 18 Jun 2005 21:41:49 -0700

I have a boot loader I derived from Jason Kyle's stk500boot.c.  It works
great.  However in one of my platforms it behaves erratically.  The bizarre
thing is that if I pull the cpu and put it into an STK500 it behaves
normally again.

The platform is a small board with an lM2094 (or something like that) 5v LDO
regulator driven off a 12 v supply (a SEPIC off a 24v battery...).  I have a
bunch of stuff hanging off the SPI bus, but removing all that doesn't seem
to solve the problem.  Also, the problem just goes away...

The symptoms are AvrDude writing some amount of the program and then
hanging. Eventually it times out and exits programming mode which causes the
boot loader to jump to 0x000 which either runs the program (if the changes
were minor) or goes off into never-never land.

So, as best as I can tell the function wait spm (wait for spm, then load the
function code, then do SPM ...) is not returning.

One thing I have noticed (and I asked in the GCC list, but no one responded)
is writing the waitspm routine using in/out (m16) didn't work, but when
re-written using sts/lds (like the m128 version) does work.  There are other
bizarre behavior that can be best described as improperly initialized
variables, but there is only one static variable and that is the code
buffer. Everything else is in registers and either explicitly initialized or
set via STK500 commands before use.  The symptoms come and cause havoc for a
while and then disappear for a while.  Powering down for an extended period
seems to help.

Anyway, I presume it is some sort of hardware difference since the boot
loader works great in a variety of m16 and m128 platforms, but I am getting
really frustrated trying to figure out what is different in this one
particular piece of hardware (swapping CPUs didn't help).

Any clues? Hints? Subtle initializations sequences I missed in the
documentation?  the loader is entered either via hardware reset, or software
call.  The latter just clears interrupts and initializes registers that are
needed.

TIA.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]