Github Devices Community Docs Blog

Flashing pre-built esp32 binary

Thanks for the awesome project.

I’m trying to flash an esp32 with the pre-built binaries provided with the 0.9.2 release. I’ve tried two different esp32 dev boards and both enter a boot loop once flashed:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3f400020,len:274640
ets Jun 8 2016 00:22:57

The bin file I’ve downloaded is ESP32_OpenMQTTGateway_V092_BLE.zip.

The esptool.py command I’m using is:

esptool.py --port /dev/cu.SLAB_USBtoUART write_flash -z 0x1000 ESP32_OpenMQTTGateway_V092_BLE.bin

Am I doing something wrong?

I’m able to reproduce the same behaviour. This seems due to the fact that we are not providing the min spiffs partition table when flashing. The issue is that for the moment, I don’t know how to provide it except by using platformio and the normal build process.

Note this special partition table is needed due to the big size of ble library.

If we analyse what the arduino IDE is doing when uploading a binary:
C:\Users\Florian\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM4 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:\Users\Florian\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2/tools/partitions/boot_app0.bin 0x1000 C:\Users\Florian\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2/tools/sdk/bin/bootloader_dio_80m.bin 0x10000 C:\Users\Florian\AppData\Local\Temp\arduino_build_47342/main.ino.bin 0x8000 C:\Users\Florian\AppData\Local\Temp\arduino_build_47342/main.ino.partitions.bin

We can see that it flash several binaries:

  • boot_app0.bin 0xe000
  • bootloader_dio_80m.bin 0x1000
  • main.ino.bin 0x10000
  • main.ino.partitions.bin 0x8000

If we use the flash download tool from espressif:

And set the parameters used by arduino IDE, we are able to upload to ESP32 a binary file containing OpenMQTTGateway.

Once done yo should see the followig scree:

Note that I have uploaded the required binaries in the zip file.

https://github.com/1technophile/OpenMQTTGateway/releases/download/v0.9.2/ESP32_OpenMQTTGateway_V092_BLE.zip

Instrutions added to the wik:

I am new to OpenMQTTGateway and trying to follow these instructions for making an RF bridge by flashing the pre-made binaries. The Bluetooth zip file contains multiple files as also depicted in http://docs.openmqttgateway.com/#/upload/binaries. The RF file only one binary.

Is this correct? What to use as address?

Hello,

So as to have the other binaries you can take them from :
https://github.com/1technophile/OpenMQTTGateway/releases/download/v0.9.2/ESP32_OpenMQTTGateway_V092_BLE.zip

Thanks for the quick reply and support. I was not successful,so as an excercise I uploaded the complete BLE version, using esspressif tool, as depicted in the picture.
Unfortunately when restarting the module, I get a comparable repeated message in Arduino’s serial interface as reported by kwijibo007:

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c
ets Jun 8 2016 00:22:57

Could you try to erase the flash before the upload ?

What is the board model you are using ?

Did that a couple of times. Could upload a Hello World like thing without problems through Arduino IDE.
This is the board:

I went to linux to manually flash the ESP32 without the interface, to make sure that the tool is not the issue:

Command:
esptool --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 ESP32_OpenMQTTGateway_V092_BLE_boot_app0.bin 0x1000 ESP32_OpenMQTTGateway_V092_BLE_bootloader_dio_80m.bin 0x10000 ESP32_OpenMQTTGateway_V092_BLE.bin 0x8000 ESP32_OpenMQTTGateway_V092_BLE_partitions.bin

Output of command:

bart@bart-Satellite-P200:~/Downloads/ESP32_OpenMQTTGateway_V092_BLE$ ./fla.sh
esptool.py v2.1
Connecting……___
Chip is ESP32D0WDQ6 (revision (unknown 0xb))
Enabling default SPI flash mode…
Configuring flash size…
Auto-detected Flash size: 4MB
Erasing flash…
Compressed 8192 bytes to 47…
Took 0.08s to erase flash block
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 717.4 kbit/s)…
Hash of data verified.
Erasing flash…
Compressed 15328 bytes to 9994…
Took 0.11s to erase flash block
Wrote 15328 bytes (9994 compressed) at 0x00001000 in 1.0 seconds (effective 117.2 kbit/s)…
Hash of data verified.
Erasing flash…
Compressed 1702640 bytes to 983018…
Took 4.35s to erase flash block
Wrote 1702640 bytes (983018 compressed) at 0x00010000 in 99.2 seconds (effective 137.3 kbit/s)…
Hash of data verified.
Erasing flash…
Compressed 3072 bytes to 143…
Took 0.05s to erase flash block
Wrote 3072 bytes (143 compressed) at 0x00008000 in 0.1 seconds (effective 232.4 kbit/s)…
Hash of data verified.
Leaving…
Hard resetting…
bart@bart-Satellite-P200:~/Downloads/ESP32_OpenMQTTGateway_V092_BLE$

Then scanning for Wifi does not show an access point, thus looking via Arduino IDE what is happening and we see:

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8424
ho 0 tail 12 room 4
load:0x40080400,len:5868
entry 0x4008069c
ets Jun 8 2016 00:22:57

Hooray!!

I found the problem. Your package uses the 80MHz SPI speed. Flashing with the 40MHz and using corresponding bootloader yielded success!

So what I did was:
esptool --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq **40m** --flash_size detect 0xe000 **boot_app0.bin** 0x1000 **bootloader/bootloader_dio_40m.bin** 0x10000 ESP32_OpenMQTTGateway_V092_BLE.bin 0x8000 ESP32_OpenMQTTGateway_V092_BLE_partitions.bin

Where

  • boot_app0.bin is pointing to the bin in the Arduino library (~/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/partitions/boot_app0.bin), and
  • the bootloader directory points to the Arduino library. In my case: ~/.arduino15/packages/esp32/hardware/esp32/1.0.4/tools/sdk/bin

TIP: you may have to push the BOOT button after starting this command …

Restart the device, and then in the serial monitor:

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
mounting FS…
mounted file system
*WM: [3] allocating params bytes: 20
*WM: [2] Added Parameter: server
*WM: [2] Added Parameter: port
*WM: [2] Added Parameter: user
*WM: [2] Added Parameter: pass
*WM: [1] AutoConnect
*WM: [2] ESP32 event handler enabled
*WM: [2] Connecting as wifi client…
*WM: [1] STA static IP:
*WM: [2] setSTAConfig static ip not set
*WM: [3] WIFI station disconnect
*WM: [1] No saved credentials, skipping wifi
*WM: [2] Connection result: WL_NO_SSID_AVAIL
*WM: [3] lastconxresult: WL_NO_SSID_AVAIL
*WM: [1] AutoConnect: FAILED
*WM: [2] AccessPoint set password is VALID
*WM: [1] your_password
*WM: [3] WIFI station disconnect
*WM: [3] WiFi station enable
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: OpenMQTTGateway
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 192.168.4.1
*WM: [2] HTTP server started
*WM: [2] WiFi Scan ASYNC started
*WM: [2] Config Portal Running, blocking, waiting for clients…
*WM: [2] WiFi Scan ASYNC completed in 3020 ms
*WM: [2] WiFi Scan ASYNC found: 7

1 Like

Glad to here that it works!

I now found out that I need PiLight extension so have to compile a configuration myself …

Anyhow, good excercise to get familiar in ESP32 …

I just added it as an example:

This way the next release will contains a ready to flash binary

1 Like

Kudos for you! :smiley::+1:
Made the changes you listed and it works! (Had to get around the installation challenges & quirks of VSCode, PlatformIO and GIT though. In the end, there is nothing like a complete & fresh install :grimacing:)

1 Like

Thanks a lot for your findings!
Really made my day

@1technophile
Thanks a lot for your project, didn’t have a chance to test it completely but sounds very promising so far.
Just a quick question to clarify my thoughts:
When/If I’ll build new firmware image using Platformio, do I understand correct that it will be replacement for ESP32_OpenMQTTGateway_V092_BLE and all other 3 bins I should leave the same including the following ESP32_OpenMQTTGateway_V092_BLE_partitions.bin ?
Thank you in advance

Hello Snakesms,

Yes while you use a binary that correspond to min_spiffs partition scheme.

1 Like

Thanks for fast reply.
I’m afraid I’m too new to the microprocessors world to know what is "min_spiffs partition scheme".
But as soon as my original question was purely related to OMG, can you confirm or disprove that esp32dev-all instead of esp32dev-ble I’m currently using does correspond to required partition schema, please?

Both use the same partition schema.

Please note that from now all the binaries are available into the github release page :

The docs has been updated to detail the 3 upload methods :

Hi Florian.

Thanks for updated manual and provided binaries.
Just probably the last minor question: do you know how to upload compiled binary to the ESP32 OverTheAir? I suppose If PlatfomIO can do that it always can be done using Curl or something similar.
Thank you in advance
Regards Sergiy.