[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] HELP! mega128 USART receive restarts execution (SOLVED)
From: |
Rick Mann |
Subject: |
Re: [avr-chat] HELP! mega128 USART receive restarts execution (SOLVED) |
Date: |
Sun, 12 Feb 2006 10:14:53 -0800 |
On Feb 12, 2006, at 8:57 AM, Ned Konz wrote:
Have you tried commenting out just the LED setting part (just to
rule out electrical glitches)?
Yes.
Also, have you made sure that your link is happening using the
right crtm128 file and linker script?
No. I'll look into that. How do I verify this?
And have you tried running your program without the JTAGICE
connected (just in case)?
Yes.
And, have you made sure that you're not in Mega103 compatibility mode?
Remember that 128s are shipped in Mega103 compatibility mode by
default.
I know you were changing the fuses.
Make sure that bit 1 of the extended fuse byte is set (i.e.
unprogrammed).
You win the prize!!!! I have never used a '128 part before. I vaguely
recall reading this once upon a time, and it makes some sense, but
did *not* remember it.
So, fixing the fuse bit for that fixed the problem. Bit 0 was
unprogrammed. Bit 1 (103 compatibility mode) was programmed. Setting
it to 1 fixed all the problems.
My friend, I owe you a beer, if not a whole lunch. Thank you!
Also make sure that the watchdog isn't biting you. If you set the
extended fuse byte to 0xff the watchdog timer should be off, and
you should be in 128 mode.
It's not this; if I never send a byte to the '128, the main loop code
runs fine without resetting.
Also make sure that your clock frequency is at least 4x your JTAG
bitrate (can be set in avarice with the -B or --jtag-bitrate flag;
it's 1 MHz by default).
It is.
So, now that it's figured out (thank you again!), I'm puzzled by the
differences I've noticed:
1) My delay loops take longer to execute (simple while(d--) loops,
where d is a long). Is this possible, or is it just my imagination
(it seems like they take quite a bit more time).
2) When a character is sent across the serial to my terminal program,
in '103 compat mode my terminal displayed the character but did not
advance to the next character space. In '128 mode, it does. Why?
3) What do you supposed caused the reset? I suppose I could go back
to '103 mode and check the status reg.
--
Rick
smime.p7s
Description: S/MIME cryptographic signature