Problem

dxw00d:
Not really. If you the same software on three different sets of hardware, and one set fails, its probably a hardware issue. Try swapping shields around, if you are using them.

I was using ethernet shield logging data on SD card. I removed it and SD related lines from the code but even though this Mega is not not responding much to this code.
What is confusing me is that this set works fine with example codes, I have tested a few, but not with the code others are running fine on.