Led matrix

Like I said, no matter what code I put, but I was trying to run a code from the book beginning arduino chap 21 that teaches how to drive a led display with the max 7219. Ant it starts to run, then stops. Everything stops, I thought could be some problem with the chip or with the arduino. Sometimes the code runs for one minute and it all stops all of a sudden.