I have a simple setup where an Arduino Mega + Raspberry Pi 4 are connected via regular USB cable.
They are also using a shared 5V@5A power supply which provides more than enough power for the 2 devices.
Both of them getting the 5V directly from their VIN pins skipping any kind of voltage regulators on board.
The problem comes when I disconnect the Raspberry Pi now from the 5V line while the Arduino is still running and try to plug it back in. It never boots with only the RED led lighting and the green HDD led never lights up UNTIL removing the USB connection between the 2.
After that it happily boots up and I can plug back the USB.
What is causing it and how to solve it the simplest way with the current setup?
Would adding a diode on the Raspberry Pi VINs help anything? I assume there is some back current loop going on here.