I have tried every trick in the web to get my program to load in an ESP32.
the capacitor from RESET to ground
10k resistors in the RESET and GPIO0 to ground lines
ground GPIO0 through a 10k ohm resistor, then ground RESET, then release RESET, then release GPIO0 then upload.
I have determined that you see CONNECTING....____ if you use Port ttyAMAO, which does not happen if you use ttyUSB0.
The ESPRESSIF core for the RPi's processor was written many years ago, and is not, any longer, developed or supported. I did try to load the old core, once. After 6 hours of compiling, I gave up.
It's unclear OP, what exactly you were trying to achieve with ESP32 and RPI. I can only make a guess that you have a board with ESP32 and an RPI. I further assume the ESP32 board works on a PC/MAC. Finally I assume when you tried to load code to ESP32 using an RPI, it just doesn't work.
Please check my assumptions before I go further because if all assumptions are correct, all you have to do is to use the esp_tool.py to load code, which works on RPI without a hitch. I don't know if you CAN load code via some RPI version of Arduino IDE though.
I have tried all the tricks to get a program to load, from the Arduino IDE to an ESP32. An RPi3B+, an RPi4, and a PC with Ubuntu, all running IDE 1.8.13, with ESP32 installed. it just won't take it. I'm going to try the Expressif IDE next.
some people say revert to a previous version of esptool.py, but not which one or where to get it.
You need to establish a base line that your ESP32 works on at least one computer before trying on RPI. I know the RPI4 is pretty snappy and all but I only use it over VNC if I need to develop something on Python and ensure it works on RPIs and I never compile anything on it. Arduino tools on RPI need to be built from source, or are not very up to date. It's not the best environment to do development, better if you do deployment on it.
For instance, the most up-to-date ESP32-Arduino component is based on ESP-IDF V3.3, which relies on a pseudo nix environment on windows and requires an esptool.exe to upload code. I don't know the equivalence on nix machines. I imagine it uses Python 2.x, that's dino turd old. The latest ESP-IDF V4.3/4.4 already uses a Python 3.x based esptool.py, a pure Python script that I guarantee you works on RPI0W and RPI4 because I've just done some custom jig and Python factory firmware build with them, with the esptool.py and its required components that I copied from ESP-IDF V4.3.
Issue is, you have to wait for the ESP32-Arduino 2.0, which is based on ESP-IDF V4.x but is in beta or alpha so until then, it's best for you, an ESP32 newcomer, to use windows.
There's nothing bad using a $200 windows laptop while you watch birds in your retirement. Once you get your hands on the sweet official release ESP32-Arduino 2.0 sometime later this year, you can gift that laptop to your grand kids.
Espressif is cranking out a lot of hardware/dev kit goodies lately so I give them some slack when they didn't deliver the USB host stack on their S2 or not upgrading their ESP32-Arduino to the latest ESP-IDF. ESP-IDF is the foundation of all ESP development environments including ESP32-Arduino so maybe you would be interested in using is once you've got enough experience with ESP32-Arduino. There is a lot you can do with ESP32. Welcome to the "club"!
ESP32s and ESP32S2s work well enough under Windows 7+, so before assuming your having the same IDE issues that other Pi users appear to have, I would take a step back in time and check that your ESP32s are working under a standard Windows setup.
And don't forget there is not a current ESP32 CORE build for the RPi processor. If you want you can use the build from 5+ years ago. You'll have to compile that build before use and at 6 hours, I was still compiling.
It's not a your doing it wrong kind of thing. There just is not a binary built for the RPi processor and you have to build one yourself from a very old version of the ESP32 Arduino core..