Trying to create new SD file on each reset, program breaks when SD plugged in

Hello everyone! So I am trying to create a tachometer and shift indicator for a project car. This involves taking the frequency of the tachometer pulse from the engine and displaying this on a seven segment display and on an LED strip. In the future I will be adding sensors such as accelerometer, optical speedometer, temps, etc, and would like to record all of this on an SD card for tuning purposes. I would like to create a new file each time the unit is reset, so I can analyze individual runs without having to manually split a text file with thousands of lines. The problem is when the SD is not inserted into the shield the program runs fine, albeit without SD functionality. When it is inserted the program hangs on the “Initializing SD Card…” line and then spits a backwards question mark into serial monitor, and no other code is ran. I am using a Mega with the ethernet/SD shield from the arduino store and have attached the relevant code. Any input is appreciated!

ProjectCar.ino (4.87 KB)

What happens if you disconnect everything except the Ethernet shield from your Arduino and run File > Examples > SD > listfiles?

pert:
What happens if you disconnect everything except the Ethernet shield from your Arduino and run File > Examples > SD > listfiles?

Initializing SD card...initialization done.
SYSTEM~1/
WPSETT~1.DAT 12
INDEXE~1 76
done!

When I go into file explorer the card is empty, making me believe that the problem is located somewhere in the itoa or strcat functions

OK, this is a good sign. We know your SD card and shield is working correctly. Now try connecting each component back to your board, and testing with the same sketch again. Does it still work? If not, then you know the cause of the problem. One consideration could be power. The SD card draws a fair amount of current. If you are trying to power the LED strip directly from your Arduino board, that is already drawing a lot of current. You could check whether your SD card initializes if you don't turn on the LEDs first.

I am using an external source to power both the seven seg and the LEDs. I am almost certain it is not a hardware problem as the program was running just fine when writing to the same file after each reset. Could it be a library problem such as missing stdlib.h or string.h? I added them in to test but there doesnt seem to be any change in functionality.

You have a working setup and a non-working setup. This is a very good situation to be in for troubleshooting. You only need to do methodical testing until you find exactly what the difference is between those two setups that's causing the problem. It seems like you aren't interested in my assistance with this, so I'll leave the rest of it to you. Good luck!