[Icc-avr] Spontanious RAM problems
Jason Geiger
jgeiger at intuitivecontrols.com
Mon Apr 16 09:58:49 PDT 2007
Greetings,
I am having a problem with an ATMEGA128 which I am a little unsure how
to debug and I was hoping to get some basic ideas as to where to start.
Any and all suggestions are welcome and appreciated!
I have a few timing/counting variables that are spontaneously changing
from their value of 0 to something that is non-zero. I have a
TimeKeeper (ISR) routine counting those variables back down to zero. In
Main() I act on them, usually when their value is equal to 1 - then I
set them to zero until I need to get to them. I believe this is pretty
standard fare for keeping track of timing.
What could be causing these variables to spontaneously change from zero?
Perhaps I am abusing ICC somehow.
Some notes and considerations.
- I do boundary checking with any arrays - especially noting that some
of these are RX and TX data packets.
- I use a LOT of structures. Some people seem to think this is great
for organization. Others argue that it's awful for code efficiency.
- My Software and Hardware stack seem to be much bigger than I need,
based on some quick calculations and verified by that handy stack
checker that I got from one of you on here. (Sylvain?)
- Related; I do not have nested interrupts.
- 5 volt circuit - Brown out fuse is enabled and set at 4 volts. Could
this be hardware? Power supply issues?
How do I know these are happening spontaneously? Most of the timer
variables that I am noticing this problem are set exclusively by from
incoming data packets and they are being set when I have the circuit
detached from anything else. They are also variables that are more
recently. I could be happening to others, but I have not noticed that
yet.
Void Main()
{
If (Time2.DoSomething == 1)
{
DoSomething(); // like set and LED pin high
PORTB = 0x01; //Uh oh, this LED is on now, nothing else
can cause that!
Time2.DoSomething = 0;
}
}
Void TimeKeeperISR()
{
if (Time2.DoSomething > 1) Time2.DoSomething--;
}
Thoughts? Ideas? Thank you ahead of time,
Jason Geiger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070416/739859e6/attachment-0001.html
More information about the Icc-avr
mailing list