Maker Pro
Maker Pro

ATMega8 loses program, 328 doesn't

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I have a program that requires almost all the 8K that an ATMega8 has. In order to do this, I program it with a USBasp programmer, not with a bootloader.

If I program it with a long (almost 8K) program it works at first, then after a couple of power cycles it doesn't.

If I program it with a shorter program it works without fail.

If I upgrade to an ATMega328 it also works without problems.

I suspect it may have something to do with the configuration of the chip and some sort of weirdness when the bootloader region is overwritten.

Any ideas?
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Is the program writing to flash? It could be going out of bounds and destroying itself.

Bob
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
No, the program does not write to flash.

edit: and I have no reason to believe the libraries do either.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I'm pretty sure the problem is that I have the fuse bits set for a bootloader still. This makes the code start in the wrong place. Why it works once is a bit of an issue though...

I'll see if that's the case later today...
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The bootloader would definitely write to flash, so, if the program is starting in the bootloader, it could be clobbering something right away.

Bob
 

GreenGiant

Feb 9, 2012
842
Joined
Feb 9, 2012
Messages
842
sometimes libraries do weird things...
TimerOne/TimerThree I have used extensively but every once in a while they do weird stuff, Ill set it for say a 1ms clock period, 50% duty cycle and what I get is anywhere from 4-5ms period at 50% duty cycle.

I also had a library hijack a variable I was using, so I was getting ridiculously weird activity until I had the program read out the variables and figured out it redefined one as a float from an integer, and it was dumping crazy weird numbers to what was supposed to be a whole number thing
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Yeah, I expected my problem was to do with fuses. I changed some to what I thought seemed reasonable and there was effectively no change.

On the last try I must have changed one which affects in circuit programming because that was my last try :(

The chip is soldered in to this board, and it's matrix board, so I'm planning to replace it with a socket and use a 328. But since it's point to point wiring to the pins of the chip, I'm putting it off until I can't find something easier to do. :D
 
Top