Marlin is restarting when pins 5 Vcc are enabled and has a servo motor connected (RAMPS 1.4) My printer uses an ATMega 2560 with a RAMPS 1.4 shield, A4988 stepper drivers and a 2004 controller LCD interface. The PSU is 360 W (12 V, 30 A).
I bought a BLTouch for my printer, but when installing, Marlin is restarting and is unable to complete the boot.
I realized that this problem happens when it is being powered only by the PSU. When it is started by USB, it works normally.
Note, the USB + PSU combination, when the system (Marlin) has been started by USB, also works normally.
I tried to configure the servo in other positions (0, 1, 2 or 3), but the results were the same:

USB starts = Ok
PSU starts = infinite restart

Another possibility that I tested, was to change the BLTouch for a SG90 micro servo, to check if it was not a problem in the equipment. The result was the same:

USB starts = Ok
PSU starts = infinite restart

In fact there seems to be some problem between ATMega 2560 and the RAMPS 1.4, when powered by the PSU.
Does anyone know how to solve the problem?
In the last case, would the exchange of ATMega 2560 + RAMPS 1.4 be the solution?
PSU is only feeding 12 V into RAMPS, but (if I remember correctly) RAMPS is using Arduino's onboard regulator for converting 12 V to 5 V. That regulator can not provide much power.
If you connect some significant load to any 5 V pin (like servo, LCD backlight, or BLTouch), the regulator will be overloaded and its output voltage will drop (too low or unstable voltage will prevent Arduino from running correctly).
You can prove this hypothesis by measuring the voltage on any 5 V pin when Arduino is in &quot;infinite restart&quot;. It will likely be far below 5 V.
Connecting USB helps because it provides additional power for 5 V rail (but you may be overloading the computer's USB port by doing this).
The solution is to get an external 12 V to 5 V regulator (with enough power, something like 3 A should be ok) and connect it between PSU and some 5 V pin on RAMPS. (Or get PSU that has both 12 V and 5 V output)
If you get an external 5 V supply, it may be a good idea to then completely disconnect RAMPS from Arduino's 5 V regulator. Have a look at https://reprap.org/forum/read.php?219,799595
Also, the regulator on the Arduino board will likely be overheating and may get damaged (But regulators usually have some overcurrent protection so it probably will be OK)
The regulator is located somewhere near the power connector on the Arduino Mega board, Google &quot;AMS1117&quot; if you don't know how it looks. Replacement is possible with intermediate soldering skills. The regulator is only used when powering Arduino from power connector or Vin pin (RAMPS uses the Vin pin). If powered from USB or 5 V pin, it can run without it.