if I remove 5v supply to mega and connect it to usb then phantom current passes from arduino mega to nano until nano turned on via power supply.
Do post a schematic drawing of what you have in mind - that talks a lot easier.I think it's possible to do what you have in mind, but not sure based on just the description.
2) where is the power supply in that image?
1) why making us scroll back to the thread to hunt down your image, instead of attaching it to the latest reply?
I've long ago learned to not assume the obvious, especially as you've been talking about both 5V supplies and running from USB in different configurations. What is not in the image is considered unknown.For adding attachments to your post, use the Preview button to go to the full editor.
If you wire GND of the Mega and Nano together and 5V from both together then 1 supply may run both as long as it has enough current. Standard 500mA USB has the current. If you have 1 board with both chips they would get common power.
But I want that if I pull jumper to cut supply of both controllers and insert USB port in mega.
That's a lot clearer. Especially as it shows that mysterious jumper you were talking about.The USB is connected to the 5V pin (I remember there's a polyfuse and a MOSFET for power selection in the path as well - check the schematics for details - you can pretty much consider this a direct connection) so this way when you have the USB connected to the Mega, the Nano will simply be powered through the 5V pin of the Mega. No problem there as long as there's not much else connected to the Nano.