ESP32 mini S2 had this problem (still has on some boards from ebay/amazon).
The issue was restarting evey 1 second or so when using WiFi (broadcast a wifi network).
Solution from other forums: One capacitor on boards is not soldered right to GND.
Some newer boards are working fine. See below.
I tried to solder a blob of solder a 1/4 inch wire to EN pin on board (also tried 1 inch coiled wire), and it helped, esp32 is not resetting itself anymore and works fine.
Bad module was from amazon, good from Aliexpress (12.2023 order).
