Pages: [1]   Go Down
Author Topic: [SOLVED]ATtiny84/44 not working properly when sketch gets above 1/3 of Flash  (Read 388 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: June 12, 2013, 10:56:54 pm by Ferreri » Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 178
Posts: 12293
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Out of SRAM.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 121
Posts: 4601
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

« Last Edit: June 12, 2013, 02:42:20 am by fungus » Logged

No, I don't answer questions sent in private messages...

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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!
Logged

Pages: [1]   Go Up
Jump to: