AVR ATMega16

Greetings all,

In trying to assist an associate with problems developing code for an RF comb filter board designed around a Mega16, things are, well, actting really weird, to say the least. It almost seems to be a development tool problem, but I am really baffled. I am using ICCAVR (6.28C), AVR Studio (4.11, build 10, SP3), and a JTAGICE mk II emulator.

This is a fairly small program, consisting of main, a couple of small (inline assembly) routines, and a Timer1 OC interrupt (in C). I will try to make my description as concise as possible. We got around the original problem (i.e. the filtering itself) by making _every_ variable in main (about 100 bytes or so, total) static, thus taking them off of the software stack. This suggested one of a couple of things: a bad sector or two in upper RAM, or a memory setup problem. Well, I raped a very simple memory test routine (write, read, complement, repeat) from another project that apparently runs fine on a Mega16, made it a single function program, i.e. main( ), compiled it in the ICC IDE, then tried to load it an run it.

It is a stand-alone, non bootloader, type program. To start, we tried it on the same prototype board we had been working on. A reset sends to a seemingly random starting point in the code (although actually one of several distinct locations), using the recommended C startup file crtatmega.o. An AVR Studio soft reset often performs more like a single-step, sometimes sends it to one of those same "random" locations, and sometimes sends it off into the weeds.

In an attempt to make some sense of things, I got my hands on an old board with a different end usage, but also built around the Mega16, and it performed identically. I have tried every combination of fuse bits that makes any sense whatsoever, we use no lock bits, and I am just really at a loss.

Anyone know of any weirdness between the Mega16 and these tools, or have any other ideas?

Thanks, Clark

Reply to
clark
Loading thread data ...

You might try winding out the Software Stack size in Project\Options in the Imagecraft IDE.

Cheers TW

Reply to
Ted

Check that you've got Imagecraft and AVR Studio set up for a Mega16 - if you've got the wrong device set up Imagecraft may generate the wrong (or right for the device you've set up) interrupt vectors.

TW

Reply to
Ted

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.