Skip to content

Instantly share code, notes, and snippets.

@morganrallen
Last active January 6, 2022 13:57
Show Gist options
  • Save morganrallen/09bae350b69c2a621d50 to your computer and use it in GitHub Desktop.
Save morganrallen/09bae350b69c2a621d50 to your computer and use it in GitHub Desktop.
ESP32 hacking notes

Basic hookup

As I plan to make a custom breakout board I wanted to solder as few connections as possible. I was able to boot the device, with UART (out at least) soldering the following.

PIN NAME
0 GND
1 3V3
2 EN
15 GND
34 RXD
35 TXD
38 GND

Note I did not solder/reflow/hotair the central GND

Flashing

In order to flash without having to press button or jump jumpers I wanted to use DTR/RTS from the UART to toggle EN and enable flash upload mode. Two more pins are required.

PIN NAME UART
25 IO0 DTR
24 IO2 x
2 EN RTS

GPIO2 can be left connected to GND if not being used, but otherwise needs to be connected to GND in order to boot into flash upload mode.

GPIO0 on the otherhand, must be connected to 3V3 in order to boot, and connected to GND in order to boot into flash upload mode. Connect to DTR on the UART module.

EN shoud be connected to RTS.

Flash tool

The old esptool.py will not work on the ESP32, there is a more up to date version available on the ESP32 forums, registration may be required. Link: esptool32.py

SDK

So far this is definitely the most beta part of working with the ESP32. Just a simple comparison of the linker linker scripts from this and the ESP8266 shows only about 10% of the functionality is available, not including new features unique to the ESP32.

GPIO

Cannot seem to configure GPIO23 as an output. 21 and 22 worked fine.

Bad Boot

At some point I ended up with the bootloader in a bad state and not matter how I reflashed I got the following error

bin status is 0 error
last bin 0 current 0
user code done

This occurred where this would have been expected.

start_addr 2510 40000

jump to run addr @ 0x40000

Command line being used.

esptool32 --port /dev/XBeeX --baud 230400 write_flash -fs 2m 0x0000 ../../bin/boot.bin 0x04000 bin/irom1.bin 0x40000 bin/irom0_flash.bin 0xFE000 ../../bin/blank.bin

Several things happen or where done around the time this problem started. The most notable for me is the multimeter probes connacting each other shorting out the circuit. With my limit electronics knowledge I'm unsure how bad of a problem this is. The circuit was layed out with 5V going through the meter, then connected to an LD33V which powered the board.

Some progress

I've been flashing with -fs 2m without problems so far. After this issue I've dropped that, letting esptool32 default to 4m which has let the boot loader progress.

********************************
*    hello espressif ESP32!    *
* pro cpu 2nd boot is running! *
********************************

2nd boot version : 1.1
SPI Speed      : 40MHz
SPI Mode       : QIO
SPI Flash Size : 1MB
start_addr 2510 40000

jump to run addr @ 0x40000

This is then followed by...

  • Garbage
  • exception(0) or exception(9) mixed with garbage, sometimes with stack
  • Very rarely a successful boot.
Solved!

It's ALWAYS a power supply issue. In the wee early hours I must have messed something up in the power supply. Since cleaning up and rewiring it's now back to normal.

Mysteries of -fs

The ESP31 appears to have 1MB of Flash. esptool32 doesn't appear to support 1MB.

-fs size VS bootloader reporting + result

-fs Reported Size Result
x 1MB Jump 0x40000 + garbage
2m 2MB user code done error
4m 1MB Jump 0x40000 + garbage
4m 4MB link param zone error

Boot Errors

user code done
bin status is 0 error
last bin 0 current 0
user code done

param zone error

This is like the user code done error with an additional message.

bin status is 0 error
last bin 0 current 0
write bin info to system param zone failed
user code done
@morganrallen
Copy link
Author

Question: With the power connected as I have it (5V -> multimeter -> LD33V -> ESP32), what is the potential for damage if I short 5V to ground? If not damage inducing, what effect could this have on the Flash?

@zhivko
Copy link

zhivko commented Nov 6, 2016

Hey @morganrallen!

I just received esp32 wroom32 and find your information very good. It seems it has everything to created my own working PCB to start with Wroom32 (ordered with Olimex).
Can you a bit clarify this: "GPIO2 can be left connected to GND if not being used, but otherwise needs to be connected to GND in order to boot into flash upload mode." it sounds strange like: "it must be connected to GND and otherwise it needs to be connected to GND"?

Have you been able to make your PCB - can you post schematics and pcb?

Wich tool you use? I prefer DesignSpark..

@zhivko
Copy link

zhivko commented Nov 8, 2016

is it "left connected" == "not connected" - that could clarify it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment