I am trying to log the values received from GPS to SD card. For this I am using UTFT and tinyFAT libraries. In program A I am printing the values received from GPS on the console without any issues. In B I am writing 1024 lines to a file created in the SD card. In C however, when I am trying to write the values received from GPS to the SD card, Arduino is restarting after it has written 316 values to the SD card. I am not able to figure out why is this happening when both things are working separately in sketch A and B. Thanks. I am using Arduino Mega 2560.