ESP32 understanding uploading a sketch process

Thread Starter

zazas321

Joined Nov 29, 2015
838
Hey. Can someone help me understand how does uploading a sketch to ESP32 works exactly? I am using Arduino IDE to program ESP32 devices and it was working fine until someone shared .bin file with me that I wanted to upload to my ESP32 device.

I have tried to upload .bin file to my ESP32 using linux. I have connected esp32 to raspberry PI using USB cable and esptool.py write_flash command as following:


but my ESP32 goes into infinitive SPI_FLASH_RESET loop..

I have read this article:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html

It is still quite difficult to understand what exactly I need to do to properly upload a binary file to my ESP32 device.
Code:
C:\Users\petrikas.lu\Documents\ArduinoData\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM14 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:\Users\petrikas.lu\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin 0x1000 C:\Users\petrikas.lu\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_qio_80m.bin 0x10000 C:\Users\petrikas.lu\AppData\Local\Temp\arduino_build_299430/mqtt_esp32_working.ino.bin 0x8000 C:\Users\petrikas.lu\AppData\Local\Temp\arduino_build_299430/mqtt_esp32_working.ino.partitions.bin
I have checked what arduino IDE is doing and it seems that it is uploading 4 binary files:

boot_app0.bin 0xe000
bootloader_dio_80m.bin 0x1000
mqtt_esp32_working.ino.bin 0x10000
mqtt_esp32_working.ino.partitions.bin 0x8000


My question is what is the simplest way to upload a compiled binary file without using Arduino IDE ( I cannot compile program). Also, Do I need to have multiple binary files? because I only have 1 binary file from the main program
 

Thread Starter

zazas321

Joined Nov 29, 2015
838
The bootloader is probably corrupted. You need to re-load it before you can download files to the ESP32.

Keith
It works when I upload my program using Arduino IDE but does not work from raspberry PI.

Do i need to write flash to 0x10000 addres?
 

Thread Starter

zazas321

Joined Nov 29, 2015
838
What do you mean "it does not work from raspberry Pi" ? What does not work?
Flashing using raspberry pi esptool write_flash command. Do I have to write my binary in 0x10000 address? Do I also have to manually add the bootloader binary when I flash using raspberry Pi ir thats not necessary?
 

Thread Starter

zazas321

Joined Nov 29, 2015
838
UPDATE:
I have downloaded ESP32 download tool. Once the device is programmed initially with any arduino program, I can only then sucessfully upload my binary file to 0x10000 address
 
Top