How to upload new firmware to the PolargraphSD v3.0

This is for a PolargraphSD v3.0, that’s based on the ESP32 microcontroller.

I’ve switched to using PlatformIO with VSCode as a development environment for PolargraphSD. Although the Arduino IDE is ubiquitous, PlatformIO allows me to use a best-of-breed IDE like VSCode or Atom. I use VSCode because I had a couple of problems with Atom.

PlatformIO is an extension that interfaces with microcontrollers, and manages libraries automatically in a more mature way than Arduino IDE.

There’s a guide to compiling the code using PlatformIO and Arduino IDE in the project wiki: https://github.com/euphy/polargraph_server_polarshield_esp32/wiki/How-to-build-the-firmware

Uploading precompiled binary files

I will periodically include a compiled binary in the project, which you can use if you don’t want to go to the trouble of dealing with IDEs and source code and compiling it yourself.

The project binaries folder (https://github.com/euphy/polargraph_server_polarshield_esp32/tree/master/binaries) contains four files which should be loaded into four memory addresses on the ESP32.

| Address    | File                     |
|------------|--------------------------|
| 0x1000     | bootloader_dio_40m.bin   |
| 0x8000     | partitions.bin           |
| 0xe000     | boot_app0.bin            |
| 0x10000    | firmware.bin             |

You can upload these files to the ESP32 that’s inside a PolargraphSD machine using a few methods.

ESP32 Flash Download Tool for Windows

The easiest for people on Windows is to use the ESP32 Flash Download tool that looks like:

esptool

You might also use esptool, which is a lovely python tool that does the same thing. It’s what most toolchains use because it’s command-line driven, and cross-platform. You’d use it with a command like this:

esptool.py --chip esp32 --port "COM9" --baud 921600 
  --before default_reset --after hard_reset write_flash -z 
  --flash_mode dio --flash_freq 40m --flash_size detect 
  0x1000 bootloader_dio_40m.bin 0x8000 partitions.bin 
  0xe000 boot_app0.bin 0x10000 firmware.bin

all on one line, and once you’ve changed COM9 to the name of your serial port.

Connecting…_____….._____

When the tool connects, it sends a message to the ESP and waits to be invited in. It prints a little progress bar like this while it does so:

If it gets to the end of the line then it’ll time out. Try that a couple of times, but if it doesn’t take on it’s own, use a cocktail stick to push the little BOOT button next to the micro-USB connector, and it’ll bump it into a upload mode.

Press reset to get back running again!

Leave a Reply