platformio-vscode-ide icon indicating copy to clipboard operation
platformio-vscode-ide copied to clipboard

"Erase Flash" @ ESP32-S3 N8R2 not possible

Open Solar320 opened this issue 1 year ago • 1 comments

We have written the needed data into your clipboar Type: Bug

When I execute the "flash erase tool" I get an Error message:"A fatal error occurred: Unable to verify flash chip connection (No serial data received.). *** [erase] Error 2" I readed somethere that I have to use an parameter for the ESPTool named --no-stub but i do not know where I have to put this command into and also I don't know what it means. I can still flash the sketch with VSC/PlattformIO but not with Arduino IDE, there it shows "no serial data from Flash" or similar.

What i do not understand is, that all my ESP32-S3 with N16R8 are working fine, with the difference that I can program these over the old USB to serial Interface. In do not try to program them over the "native USB IF", may be they throw out the same error then.

If I do not find an solution soon I will connect an FTDI board to the serial IF of the ESP32-S3 N8R2 board and force it to erase the flash via Flash_Download_Tool.

" After Executing task in folder OpenDTU-OnBattery: ..........\penv\Scripts\platformio.exe run --target erase --environment opendtufusionv2

Processing opendtufusionv2 (board: esp32-s3-devkitc-1; framework: arduino; platform: [email protected])

Verbose mode can be enabled via -v, --verbose option Firmware Revision: v24.6.29-15-ge3f9da7 Firmware Branch: development No custom_patches specified CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html PLATFORM: Espressif 32 (6.7.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM) HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa) PACKAGES:

  • framework-arduinoespressif32 @ 3.20016.0 (2.0.16)
  • tool-esptoolpy @ 1.40501.0 (4.5.1)
  • tool-openocd-esp32 @ 2.1100.20220706 (11.0)
  • toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
  • toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5 LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 56 compatible libraries Scanning dependencies... Dependency Graph |-- ESP Async WebServer @ 2.10.8 |-- ArduinoJson @ 7.0.4 |-- espMqttClient @ 1.7.0+sha.70d3113 |-- RF24 @ 1.4.8 |-- U8g2 @ 2.35.19 |-- sunset @ 1.1.7 |-- TaskScheduler @ 3.8.4+sha.3cb61c0 |-- mcp_can @ 1.5.1+sha.6f1f30c |-- EspSoftwareSerial @ 8.2.0 |-- LittleFS @ 2.0.0 |-- Hoymiles @ 0.0.1 |-- ESPmDNS @ 2.0.0 |-- WiFiClientSecure @ 2.0.0 |-- SPI @ 2.0.0 |-- Frozen |-- Ethernet @ 2.0.0 |-- WiFi @ 2.0.0 |-- Update @ 2.0.0 |-- VeDirectFrameHandler |-- CpuTemperature |-- ResetReason |-- MqttSubscribeParser |-- Ticker @ 2.0.0 |-- DNSServer @ 2.0.0 |-- HTTPClient @ 2.0.0 |-- TimeoutHelper @ 0.0.1 |-- SdmEnergyMeter |-- SMLParser Building in release mode Looking for serial port... Auto-detected: COM14 Erasing... esptool.py v4.5.1 Serial port COM14 Connecting... Chip is ESP32-S3 (revision v0.2) Features: WiFi, BLE Crystal is 40MHz MAC: 74:4d:bd:94:bc:c4 Uploading stub... Running stub... Stub running...

A fatal error occurred: Unable to verify flash chip connection (No serial data received.). *** [erase] Error 2 ===================================================== [FAILED] Took 10.21 seconds =====================================================

Environment Status Duration


opendtufusionv2 FAILED 00:00:10.205 ================================================ 1 failed, 0 succeeded in 00:00:10.205 ================================================

  • The terminal process "C:\Users\x.platformio\penv\Scripts\platformio.exe 'run', '--target', 'erase', '--environment', 'opendtufusionv2'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

Extension version: 3.3.3 VS Code version: Code 1.92.0 (b1c0a14de1414fcdaa400695b4db1c0799bc3124, 2024-07-31T23:26:45.634Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info
Item Value
CPUs AMD Ryzen 7 3700X 8-Core Processor (16 x 3593)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.90GB (25.28GB free)
Process Argv --crash-reporter-id c84e3e8b-0c34-45e6-8e76-db5511699037
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
01bff139:31013167
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
refactort:31108082
ccplc:31103425
pythonrstrctxtcf:31103194
wkspc-onlycs-c:31106320

d because it was too large to send. Please paste.

Solar320 avatar Aug 03 '24 07:08 Solar320

Additonally I erased an ESP32-S3 N16R8 over the USB interface with VSC/PlattformIO As you can see, no Problem with it......

Auto-detected: COM20 Erasing... esptool.py v4.5.1 Serial port COM20 Connecting... Chip is ESP32-S3 (revision v0.2) Features: WiFi, BLE Crystal is 40MHz MAC: dc:da:0c:20:8d:20 Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 28.6s Hard resetting via RTS pin... ========================================================== [SUCCESS] Took 37.37 seconds ==========================================================

Environment Status Duration


opendtufusionv2 SUCCESS 00:00:37.368 ========================================================== 1 succeeded in 00:00:37.368 ==========================================================

  • Terminal will be reused by tasks, press any key to close it.

UPDATE: I now used the FTDI Board at 3,3V!!! I connect RX to UTX and TX to URX and GND. Then I pressed the Boot Button until VSC/PlattformIO wants to Write on the Device. In this Way I also was able to erase the flash with the Flash_download_tool_3.9.5

With VSC I was now able to Programm the OpenDTU Fusion V2.1 Board. I do not test again to erase the flash with VSC over the serial connection yet.

I do not use the FTDI 3,3V as an power source for the ESP, as someon does.

At best use the USB at the same PC or an battery. An ext. Powersupply is also possible, but be carefull with external powersupplies! They can carry some difference currents, so its the best to connect all gnd lines between FTDI and the ESP before you connect the power supply to the AC plug! They also schould guarantee an good connection all the time, if they disconnect during the AC is powered up, the difference currents and voltages of the Powersupply can destroy the ESP32.

I also read that you have to connect DTR and so on to the IO15 and 13 of the ESP32-S3, in fact this is not necessary when you are able to press the Boot button. I also read that someon Press EN/Reset button and the Boot Button at the same time, then release the EN/Reset and then the Boot Button. I find this is also not necessary. In my case the Boot Button was enough.

At the End, why this error only occurs at on the ESP32-N8R2 boards but not at the ESP32-S3 N16R8 Boards its still unclear.

ghost avatar Aug 03 '24 08:08 ghost

I use both that chip and the N16R8 with MacOS regularly. No problem. (Well, there's a problem on boards with WCH uarts on MacOS, but that's not this.) The finicky bit is that the small ones are qio and the fast ones are oio, which is another reason the big ones are worth the extra dime. They definitely require different programming specs. (This is why PlatformIO is doing the ESP user base a disservice by not submitting user-submitted fixes and new board/chip description files for the last two years.)d

It's odd that your board is misidentified: "8 MB QD, No PSRAM)".

It should be impossible to lose data over a USB CDC connection, but I've learned to never bet against how awful MS platform code can be. For yuks, I'd try a lower speed. A flash verify is kind of the worst case where it's sending the entire address space of the board over the "serial" port so if the system is overwhelmed by those kilobytes of data (sigh) maybe something weird happens.

I can't make sense of your last paragraph, but I think youre trying to say that connecting power from external AND USB is bad and that's correct. That's why boards like the (good) DevkitC clones thad added USB-C also added a little jumper you can cut/solder to connect power or not. That power that you need to power up an attached keyboard can be bad new if you're squirting power into a source that doesn't expect it - it's not like this device is full USB PD and really aware of bidirectional power.

The stub thing is Espressif uploading an updated loader to the board to implement better compression, support for more flash chips, etc. than the uplaoderd that's burned into the mask rom. You have to be pretty desparate to turn that off, but i can hear that in your post. -)

So I'd try to suss out the exact board definition that gets the SPI configuration perfect, noting that it's just plain different for those two modules. Then I'd try running down the bitrate.

As a last ditch, reduce it to calling esp-idf.py flash erase and friends. If you can repro it with pure ESP-IDF, you can take it esp32.com and get help from the folks that make the chip as that gets all the PlatformIO and arduino goo out of the picture.

robertlipe avatar Jan 14 '25 21:01 robertlipe

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 25 '25 22:04 stale[bot]