ATtiny45 crashes with LedControl library

Hi, I'm having this very strange problem. I'm working on a project with a 4 digit 7 segment display using a MAX7219 IC.
I was using the LedControl library on an Arduino and all was fine but, switching to the ATtiny the setDigit function will make the microcontroller not work at all.
This only occurs with setDigit as far as I can tell, for instance, the LCDemoMatrix sketch runs fine but the LCDemo7Segment one wont.
I've tracked it down to the last two lines of the function in the library file:

status[offset+digit]=v;
spiTransfer(addr, digit+1,v);

If I comment these out the rest of the code runs (obviously the digits aren't set).
I'm going crazy here, what could be the problem?

Also, the function from the demo sketch:

void scrollDigits() {
  for(int i=0;i<10;i++) {
    lc.setDigit(0,3,i,false);
    lc.setDigit(0,2,i+1,false);
    lc.setDigit(0,1,i+2,false);
    lc.setDigit(0,0,i+3,false);
    delay(delaytime);
  }
  lc.clearDisplay(0);
  delay(delaytime);
}

Probably out of SRAM, ATtiny45 only has 256 bytes. Do you happen to have an ATtiny85? That might be worth a try.

AVR Memory Usage -- LCDemo7Segment
----------------
Device: attiny45

Program:    2424 bytes (59.2% Full)
(.text + .data + .bootloader)

Data:        229 bytes (89.5% Full)   <--- YIKES! A real squeaker
(.data + .bss + .noinit)


AVR Memory Usage -- LCDemoMatrix
----------------
Device: attiny45

Program:    3300 bytes (80.6% Full)
(.text + .data + .bootloader)

Data:        101 bytes (39.5% Full)
(.data + .bss + .noinit)

vascofg:
If I comment these out the rest of the code runs (obviously the digits aren't set).
I'm going crazy here, what could be the problem?

Probably running out of RAM.

Thanks, you're probably right! I'd never have thought of that. You mind telling me how you got that memory usage report so I can try to reduce the library so it will work?

vascofg:
Thanks, you're probably right! I'd never have thought of that. You mind telling me how you got that memory usage report so I can try to reduce the library so it will work?

Use the "avr-size" command on the command line.

[arduino installation folder]\hardware\tools\avr\bin\avr-size.exe -C --mcu=attiny45 [your .elf file name here - find it in your 'temp' folder]

vascofg:
Thanks, you're probably right! I'd never have thought of that. You mind telling me how you got that memory usage report so I can try to reduce the library so it will work?

What @fungus said :smiley: