Author Topic: Programming an ESP32 from Raspberry Pi  (Read 848 times)

0 Members and 1 Guest are viewing this topic.

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1082
  • Country: gb
Programming an ESP32 from Raspberry Pi
« on: July 24, 2022, 01:24:10 am »
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.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 3375
  • Country: dk
Re: Programming an ESP32 from Raspberry Pi
« Reply #1 on: July 24, 2022, 01:43:35 am »
CTS is an input ....
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1082
  • Country: gb
Re: Programming an ESP32 from Raspberry Pi
« Reply #2 on: July 24, 2022, 02:17:04 am »
It is? Well, never mind then...  :palm:

I can never remember which direction all the serial control signals are. :)
 

Online djacobow

  • Super Contributor
  • ***
  • Posts: 1112
  • Country: us
  • takin' it apart since the 70's
Re: Programming an ESP32 from Raspberry Pi
« Reply #3 on: July 24, 2022, 03:06:48 am »
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.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 3375
  • Country: dk
Re: Programming an ESP32 from Raspberry Pi
« Reply #4 on: July 24, 2022, 03:32:23 am »
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.

with a gpio available it should be possible to make a minor change to: https://github.com/espressif/esptool/blob/master/esptool/loader.py


 
The following users thanked this post: eugene

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1082
  • Country: gb
Re: Programming an ESP32 from Raspberry Pi
« Reply #5 on: July 24, 2022, 06:40:08 am »
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.

That 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.
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1082
  • Country: gb
Re: Programming an ESP32 from Raspberry Pi
« Reply #6 on: July 24, 2022, 06:44:07 am »
with a gpio available it should be possible to make a minor change to: https://github.com/espressif/esptool/blob/master/esptool/loader.py

Hmm, yes, I guess one could alter _setDTR and _setRTS methods there to toggle GPIOs instead, but I'd prefer not to get into maintaining custom versions of utilities if I can help it.
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 436
  • Country: us
Re: Programming an ESP32 from Raspberry Pi
« Reply #7 on: July 25, 2022, 05:36:31 pm »
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.

with a gpio available it should be possible to make a minor change to: https://github.com/espressif/esptool/blob/master/esptool/loader.py

esptool 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.
90% of quoted statistics are fictional
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 3375
  • Country: dk
Re: Programming an ESP32 from Raspberry Pi
« Reply #8 on: July 25, 2022, 06:56:45 pm »
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.

with a gpio available it should be possible to make a minor change to: https://github.com/espressif/esptool/blob/master/esptool/loader.py

esptool 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.

sure it has a uart so it can be used to program, but can it also automatically reset and control IO0 to enter the bootloader?
 

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 436
  • Country: us
Re: Programming an ESP32 from Raspberry Pi
« Reply #9 on: July 27, 2022, 02:53:42 am »
sure it has a uart so it can be used to program, but can it also automatically reset and control IO0 to enter the bootloader?

If 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.

« Last Edit: July 27, 2022, 03:00:51 am by eugene »
90% of quoted statistics are fictional
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf