Cannot upload code to Arduino Mega when connected to external power supply

Zapro:
Well i got fed up and whipped out the oscilloscope and tried some stuff out.

When feeding the board a low voltage on VIN the 5V rail looks like this:

It would be interesting to see similar oscilloscope traces when feeding a range of voltages (5.5V - 12V) into the DC jack. Is the 5V stable or does it oscilate?

I ask because I wonder what is the optimum wallwart voltage to get - 7V? 9V?