marcelstoer / nodemcu-pyflasher

Self-contained NodeMCU flasher with GUI based on esptool.py and wxPython.
MIT License
1.46k stars 397 forks source link

ESP32 keeps resetting after flashing with NodeMCU-PyFlasher-4.0-x64 #60

Closed JugensVan closed 4 years ago

JugensVan commented 4 years ago

When i program my esp32 with a simple flash example using NodeMCU-PyFlasher-4.0-x64 it keeps resetting. Can anybody help.

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371

Manuel-Sensate commented 4 years ago

I stumbled over a similar issue - the problem you might have run into is if you are just trying to flash a "barebone" app image binary. you need to prepare the binary (i.e. combine the bootloader, apploader, app and partition binary files to one binary) - then it works fine.

marcelstoer commented 4 years ago

combine the bootloader, apploader, app and partition binary files to one binary

That's correct.

As for flash read err, 1000 there is some information at https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection#early-flash-read-error.

JugensVan commented 4 years ago

I stumbled over a similar issue - the problem you might have run into is if you are just trying to flash a "barebone" app image binary. you need to prepare the binary (i.e. combine the bootloader, apploader, app and partition binary files to one binary) - then it works fine.

Thanks that makes sense. Im new to ESP32. i compile using PlatformIO. Not sure how to combine .bin files. The only bin files i can find in my project are firmware.bin and partitions.bin. I'm used to using .HEX files in batch programming. any help will be apresiated.

Manuel-Sensate commented 4 years ago

It is indeed a bit tricky.. lots of caveats.. I used https://github.com/vtunr/esp32_binary_merger - the required other binaries you find in the Arduino SDK for ESP32.

marcelstoer commented 4 years ago

https://github.com/vtunr/esp32_binary_merger

That's one option (one I didn't know existed). The other is using srec_cat as I do in the NodeMCU ESP32 build at https://github.com/marcelstoer/docker-nodemcu-build/blob/master/build-esp32#L85.

JugensVan commented 4 years ago

It is indeed a bit tricky.. lots of caveats.. I used https://github.com/vtunr/esp32_binary_merger - the required other binaries you find in the Arduino SDK for ESP32.

Thank you. Will try that.

JugensVan commented 4 years ago

https://github.com/vtunr/esp32_binary_merger

That's one option (one I didn't know existed). The other is using srec_cat as I do in the NodeMCU ESP32 build at https://github.com/marcelstoer/docker-nodemcu-build/blob/master/build-esp32#L85.

Thanks now i know how to sort it.

uzi18 commented 4 years ago

have prepared python script to hook after platformio build ends - it creates genuine flash image with all needed stuff

https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py just add to platformio env this line:

extra_scripts             = post:post_esp32.py
marcelstoer commented 4 years ago

@uzi18 I haven't tested it yet but that's a great idea! Once I hear from others who successfully use this I will documented it here in the README.

uzi18 commented 4 years ago

maybe @JugensVan will try to test basically it creates combined file firmware-factory.bin in build dir you can flash it at 0x0 and from this moment just use ota update with or only reflash firmware.bin =)

have created it because lots of espeasy users were confused how to flash firmware

JugensVan commented 4 years ago

Sounds like a good idea. Problem is im new to this platform. and not to sure how to do that. Will ask one of my colleagues to try it. He is ofay with python script .

uzi18 commented 4 years ago

just copy this file to project dir and add extra line into env declaration in platformio.ini you don't need to know python =)

uzi18 commented 4 years ago

like here: https://github.com/letscontrolit/ESPEasy/blob/mega/platformio_esp32_envs.ini#L18

JugensVan commented 4 years ago

just copy this file to project dir and add extra line into env declaration in platformio.ini you don't need to know python =)

I just copied the script to my project directory and added "extra_scripts = post:post_esp32.py" to platformIO.ini it made a "firmware-factory.bin" i flash the firmware using NodeMCU-PyFlasher-4.0-x64 It all seems to work fine. I thank you for all your help. I'm sure more people will find this useful if you need to send a bin file to someone to upgrade firmware in the field.