Programming an ESP32 from Raspberry Pi - Page 1
Forum section: electronics / general

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 24, 2022, 01:24:10 am
content: Does anyone know if it's possible to program an ESP32 using a Raspberry Pi's UART,including using the auto-reset circuitry(from DTR/RTS)?Now, I know that the Raspberry Pi UARTs don't have (or don't expose on the GPIO header) the DTR signal - only CTS & RTS - but I was wondering if there is any way to convince esptool to use CTS instead of DTR.I perused the esptool documentation but couldn't see any options related to UART alternative signals.

author: langwadt
author_rank: Super Contributor
timestamp: July 24, 2022, 01:43:35 am
content: CTS is an input ....

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 24, 2022, 02:17:04 am
content: It is? Well, never mind then...I can never remember which direction all the serial control signals are.

author: djacobow
author_rank: Super Contributor
timestamp: July 24, 2022, 03:06:48 am
content: If the serial pins on the RPi GPIO header are not sufficient (I believe the main 40pin header only has tx and rx), you can always plug in an FTDI or other serial adapter cable into the RPi's USB port, and you'll get a complete serial port with all the extra signals. That will almost certainly work fine.An alternative that you might investigate is JTAG programming. There is a branch of OpenOCD that works with ESP32, so you should be able to use it to JTAG program (and debug!). If you build it on the Raspberry Pi and use "LinuxGPIO" adapter, you can choose whichever GPIO pins are convenient for you and I bet it will work. I do exactly this for Cypress PSoC and it works surprisingly well.

author: langwadt
author_rank: Super Contributor
timestamp: July 24, 2022, 03:32:23 am
content: Quote from: djacobow on July 24, 2022, 03:06:48 amwith a gpio available it should be possible to make a minor change to:https://github.com/espressif/esptool/blob/master/esptool/loader.py

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 24, 2022, 06:40:08 am
content: Quote from: djacobow on July 24, 2022, 03:06:48 amThat was my first idea, which obviously should be the most straightforward solution. But then I thought "hang on, the GPIO header has a UART on it".JTAG is out, as that's not present on the target board.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 24, 2022, 06:44:07 am
content: Quote from: langwadt on July 24, 2022, 03:32:23 amHmm, yes, I guess one could alter_setDTRand_setRTSmethods there to toggle GPIOs instead, but I'd prefer not to get into maintaining custom versions of utilities if I can help it.

author: eugene
author_rank: Frequent Contributor
timestamp: July 25, 2022, 05:36:31 pm
content: Quote from: langwadt on July 24, 2022, 03:32:23 amesptool uses the UART on a Raspberry Pi and can be used to program ESP32. There are a few tutorials online. No reason to reinvent the wheel.

author: langwadt
author_rank: Super Contributor
timestamp: July 25, 2022, 06:56:45 pm
content: Quote from: eugene on July 25, 2022, 05:36:31 pmsure it has a uart so it can be used to program, but can it also automatically reset and control IO0 to enter the bootloader?

author: eugene
author_rank: Frequent Contributor
timestamp: July 27, 2022, 02:53:42 am
content: Quote from: langwadt on July 25, 2022, 06:56:45 pmIf you say it doesn't, then I believe you. Does it not run on RPi? The developers sure make it sound like it should access the bootloader.