Go Down

Topic: [SOLVED]ATtiny84/44 not working properly when sketch gets above 1/3 of Flash (Read 551 times) previous topic - next topic

Ferreri

I am creating a 10 LED persistence of vision display using a 14 pin ATtiny and the arduino as a programmer.

Everything works fine until the sketch gets around a third of the ATtiny's capacity (approx 1400 bytes on the ATtiny44 and 2600 on ATtiny84).  Beyond that sketch size, behavior gets erratic and then nothing happens.  

I've been able to get the POV to work by commenting out the lines not needed for my specific POV message...not an ideal solution as I'd like to add multiple messages.

The code itself works, and I don't think it's an efficiency thing.  I just lose it when I still have 2/3 of the Flash left.

Any thoughts?

Coding Badly


fungus

Nothing to do with flash. Everything to do with RAM. Post your sketch.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Ferreri

Thanks guys!

All I needed was a mention of RAM.  That led me to read up on the PROGMEM, so I stored a bunch of arrays there.

Then, I got curious and wanted to know how much RAM I was using/had left.  I found this bit of code (can't find original source)

Code: [Select]
int freeRam ()
{
   extern int __heap_start, *__brkval;
   int v;
   return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}


I have no idea how it works, but by printing to the serial monitor I could see how much RAM I had left...pretty cool!

Overall, was able to save more than 260 bytes by moving stuff to PROGMEM.  Regardless, the ATtiny44 is not going to be a good choice, but the 84 works great.

Thanks again!

Go Up