Can't get S2 Mini to Flash

Hi All, I’ve got a few s2 mini’s that I thought I’d give a try. But I cant seem to get them to flash. The web Flasher does not work, it fails claiming it needs to be in boot mode etc, but when I do this (hold reset and boot and then continue to hold boot after I let go of reset) it still does not work. I can tell it’s in the correct model as the com port changes from COM3 (normal) to COM4.

SO I then down downloaded the ESP flasher, but this also does not work it just seems to do nothing for ever… I’ve downloaded the correct image for S2, placing in slot 1, then proceeded to sync… and it seems to take for ever and does nothing.

Had anyone got an S2 to flash and if so how?

Use esptool from Espressif.
You will need to upload:

  • bootloader
  • partition table
  • WLED binary

All of those require correct configuration for your particular ESP32-S2 development board.

EDIT: If you are inexperienced you may be better off using regular ESP32.

@blazoncek can I get a few more details like the link to
bootloader and partition table (binary?) and what addresses to flash them to?

I mean what ones are you refering to?

I did already try the v4 bootloader from a previous release but I have read that s2 comes with a spi bootloader and it’s not needed.

I know how to use esptool and flash using it so I just need a bit more details of how you succeed in order to duplicate it.

I have tasmota running on the S2 in question and it can control the led strip but I would rather run wled.

Play with PIO and different environments or even platforms. And use it to flash your ESP. It will also flash correct bootloader and partition map.
For me platform espressif@5.3.0 works.

For posterity I’ll provide my working PIO environment for Lolin ESP32-S2 D1 mini with 2MB PSRAM and 4MB flash. You can start with that and modify board parameters and change other build flags as required. If your board does not have PSRAM you can omit those build flags but they should not hurt.

platform = espressif32@5.3.0
platform_packages = 
board = lolin_s2_mini
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
board_build.flash_mode = qio
board_build.f_flash = 80000000L
monitor_filters = esp32_exception_decoder
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=ESP32-S2-Lolin
  -D DATA_PINS=16,39 # or 37
  -D BTNPIN=18  # GPIO0 is onboard button
  -D RLYPIN=35  # Q2 on Dig-Uno
  -D IRPIN=-1
  -D HW_PIN_SCL=35
  -D HW_PIN_SDA=33
  -D TEMPERATURE_PIN=7  # for Dig-Uno
  -D PIR_SENSOR_PIN=33   # Q2 on Dig-Uno (3 for A0, 35 for Q1)
  -D AUDIOPIN=-1  # analog pin
  -D DMTYPE=1     # 0-analog/disabled, 1-I2S generic, 2-ES7243, 3-SPH0645, 4-I2S+mclk, 5-I2S PDM
  -D I2S_SDPIN=3  # A0 on Dig-Uno (35 for Q1, 33 for Q2)
  -D I2S_WSPIN=9  # Q3 on Dig-Uno
  -D I2S_CKPIN=11 # Q4 on Dig-Uno
lib_deps = ${esp32s2.lib_deps} @ 1.9.2+sha.419d7b0 ;; used for USERMOD_AUDIOREACTIVE - using "known working" hash
1 Like

Thx, That’s exactly the board I have so I’ll try it and report back. Interestingly tasmota will flash and work with their generic s2 build. One wonders how.

I saw here that this person succeeded following your advice

Now I wonder how the S2 asset in the latest release is built and why it won’t work. Maybe better to not build it if it has issues as it makes folks think it is functional. I mentioned elsewhere I had another non lolin s2 dev board and it didn’t work after flashing that asset so doesn’t seem like this is a lolin d1 mini specific issue.

Ok @blazoncek your env worked! THX!

I simply clone the repo and made an override file with it.

Here are the two issues I ran across.

  1. PIO/vscode would not recognize the build task in the override file so I had to move it to the platformio.ini
default_envs = lolin_s2_mini_custom
  1. This board has issues getting into program mode and staying there. PIO wants to hard reset the board before upload (like the esphome based web installer) and that takes it out of programming mode. So for upload the trick is to hold the reset and gpio 0 buttons until it gets to waiting for new upload port then release the buttons then it will find the port and upload. I have no idea how to disable that reset or otherwise get this to work “normally”
Looking for upload port...
Auto-detected: /dev/ttyS0
Forcing reset using 1200bps open/close on port /dev/ttyS0
Waiting for the new upload port...
Uploading .pio/build/lolin_s2_mini_custom/firmware.bin v4.4
Serial port /dev/ttyACM0
Chip is ESP32-S2FNR2 (revision v0.0)
Features: WiFi, Embedded Flash 4MB, Embedded PSRAM 2MB, ADC and temperature sensor calibration in BLK2 of efuse V2
Crystal is 40MHz
MAC: 84:fc:e6:c5:ad:4a
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00004fff...

now the question is can I/we make a generic S2 build that will work for any S2 like the tasmota32s2.factory.bin file does?

If you have a bunch of these devices then by all means invest your time and figure out a way. We’d appreciate it.

This is not a pio specific flash issue. It’s the same with for example the tasmota web installer (based on esphome web installer).

I can flash this board with esptool but I MUST set NO before reset. And I must get it into programming mode by holding gpio 0 down at power up for 5 secs.

I think pio and the esphome webinstaller both do this because they assume the board can be automatically put into program mode and this is why there is the issue.

It’s hard enough just to get the thing into programming mode to start. I think that’s a design issue I can’t fix. Other lolin mini boards can be put into programming mode “automatically” but not this one.

I have a handful of them luckily not hundreds as there appears no fix.

Looks like indeed getting into programming mode was a board design flaw.

I now have this problem with my own circuit boards and hope you can help me.

I can flash TASmota without any problems and it works.

However, as soon as I flash WLED, whether via PlatformIO or via Bin File, I get:

Rx][18:05:37.651] E (337) esp_core_dump_flash: No core dump partition found!
[Rx][18:05:37.651] E (337) esp_core_dump_flash: No core dump partition found!
[Rx][18:05:37.651] E (340) psram: PSRAM ID read error: 0x00030000
[Rx][18:05:37.651] ./components/esp_littlefs/src/littlefs/lfs.c:1229:error: Corrupted dir pair at {0x0, 0x1}
[Rx][18:05:37.651] E (350) esp_littlefs: mount failed, (-84)
[Rx][18:05:37.651] E (353) esp_littlefs: Failed to initialize LittleFS
[Rx][18:06:06.320] ESP ROM:esp32s2-rc4-20191025
[Rx][18:06:06.320] Build:Oct 25 2019

If you are just flashing a prebuilt binary that is not what I did here. I cloned the wled github repo and had PIO build and then flash the build using the environment settings mentioned above.

@blazoncek. Is this environment build now included in 0.14.4 assets so I no longer have build my own binary? a quick look seems no.

0.15 has a working Wemos S2 Mini environment.