You asked for guesses: the problem might have nothing to do with the array size, etc., your uart... function might be failing sometimes for unknown reason and you are just looking for a problem in a wrong place.FWIW.