ESP32 S2 and ESPhome upload

No luck for me on a Win11 PC, Windows won’t find a driver to load for the ESP32 and says the device isn’t working. I’ve tried all the silabs variants for Windows.

When the ESP32 is plugged in with no buttons pressed, it appears as a new drive (odd?). If I plug in while the “O” button is pressed it appears in Device Manager under “other devices” with no drivers and in a non-working state.

I connected my S2 to the box running HA and ESPHome for the initial load and had no issues.

1 Like

Did you try the specific sequence here?
https://www.wemos.cc/en/latest/tutorials/s2/get_started_with_arduino_s2.html#upload-code

1 Like

Did you first install the CP210x driver (item 1 in the list)?
Did you connect the board without any buttons pressed (item 3) and then press the buttons in the order given in item 4 in the list?

Thanks @olealm, yes - I installed the drivers (the VCP one, as well as trying the others). Looks like Win11 eventually gave up on me messing with USB ports - after a reboot I was able to complete steps 1-5. Step 6 (which has to be via web.esphome.io as I’m on a Win11 PC and not my HASSIO server) fails with esphome saying it only supports ESP8266 or ESP32.

This at least proved the device was active, so I created a new config on ESPHome then downloaded the .bin file and followed your backup instructions to flash it. The flashing worked but the S2 mini didn’t appear to do anything after that - no lights, no wifi connection etc.

@Mahko_Mahko I followed the code download sequence as shown there.

Next I tried connecting it to my HASSIO server (RPi4) directly as @gaz99 suggested and tried downloading. The device is identified on the RPi and compile completes, but download fails with an error:

ERROR Running command failed: [Errno 32] Broken pipe
ERROR Please try running esptool.py --before default_reset --after hard_reset --baud 460800 --port /dev/ttyACM0 --chip esp32s2 write_flash -z --flash_size detect 0x10000 /data/esp32-s2-01/.pioenvs/esp32-s2-01/firmware.bin 0x1000 /data/cache/platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin 0x8000 /data/esp32-s2-01/.pioenvs/esp32-s2-01/partitions.bin 0xe000 /data/cache/platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin locally.

This happens whether or not O button is pressed on boot.

1 Like

Ok, so hopefully you have gotten a few steps further down on the road to success!
For step 6 I used this setting in the ESPHome sketch (not sure if it actually matters, but might be worth a try):

esp32:
  board: esp32-s2-saola-1
  framework:
    type: esp-idf

Later on I have changed the esp32 setting it to the one from @gaz99 above and updated wirelessly with no issues.

Yes I tried that board config along with other suggestions. Any use of the esp-idf framework gives me an error - didn’t write this one down, but it indicated this framework is not supported for the board type.

I only have one of these boards to play with, so can’t discount it may be faulty. Will go back to my other ESP32’s for now - my initial reason for trying this one was to test the ADC range as I’ve found the ADC on the Wemos ESP32 mini is 0 - 1.04V and I wanted a small form factor ESP32 that supported 0 - 3.2V.

that’s what resistors are for.

Ok. If you happen to have this Wemos D1 Mini ESP32 board it looks like the ADC range can be set in firmware.

Yes I knew someone would point that out :slight_smile: . Agreed but it does up the component count & complexity when you’re using multiple ADCs.

Thanks @olealm that’s the one I have (a few of) - I had no idea that was an option! Will read up on how to update that.

So easy to implement ADC attenuation settings once you know where to look! This detail is not listed (or referenced) under the ESPHome ESP32 entry, but is included under the general ADC settings which I should have re-read when moving from ESP8266 to ESP32.

1 Like

So has anyone managed to actually get this working? I am able to flash the s2 using the web flasher. (cannot get it to flash with windows one.( i do the button compination, holding 0 while inserting usb then press once the rst and when it gets recognized again from pc I remove my hand from the 0. But it just never connects to wifi or when I loaded a status led, still doesnt do anything. I have installed a simple led blind/flash with arduino IDE and it works! Just need to reset the board after you have flashed it. I have like 6 off them and waiting for another 6 to arrive ahahah. I really though it was too good to be true (price and size)
the code I have tried is:

esphome:
name: test
esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: arduino
version: 2.0.5 also tried 2.0.3
platform_version: 5.2.0 also tried 5.0.0

Here is a sample configuration file that is working for me, but I’ve also tested with the newest versions (arduino 2.05 and platform 5.2.0) for other ESP32S2 boards and it also works.
I think what fixed my problems was the “platform options” settings.

esphome:
  name: $devicename
  platformio_options:
    board_build.f_flash: 40000000L
    board_build.flash_mode: dio
    board_build.flash_size: 4MB

esp32:
  board: adafruit_qtpy_esp32s2
  variant: esp32s2
  framework:
    type: arduino
    version: 2.0.3
    platform_version: 4.3.0

yes couldn’t get it work either. However below does work but is not in arduino framework so there some issue with binary sensor templating

esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: esp-idf
platform_version: GitHub - jhamhader/platform-espressif32: Espressif 32: development platform for PlatformIO

I’ve also struggled quite a bit, trying all the various suggestions above. What finally worked for me was some combination of @olealm & @gaz99 's methods.
(Windows 10.0.19043, ESPHome 2022.9.4)

First of all, unlike @olealm, I was unable to install the 1st CP210x driver (CP210x Universal Windows Driver, v11.1.0); however, I was able to install the 3rd driver (CP210x VCP Windows, v6.7), yet I don’t think it made a difference - the following stages worked either way. It might not be required, as I was able to get a COM port out of the box (without additional drivers), much like in exiledyorkie’s screenshot.

As to the actual procedure:

  1. Follow stages 2-5 from olealm’s procedure. The next stage (#6), flashing via ESPHome Dashboard did not work, in spite of several retries.
  2. In ESPHome Dashboard, create a new device; skip installation via USB; select any board, and once again skip installation.
  3. Per @gaz99, edit YAML and replace with the following:
esp32:
  board: lolin_s2_mini
  variant: ESP32S2
  framework:
    type: arduino
    version: 2.0.3
    platform_version: 5.0.0
  1. Select Install / Manual download / Modern format; A bin file will be generated (e.g. device-name-factory.bin)
  2. Flash it using ESPtool (replacing with your COM port and bin filename):
esptool -p <COM port> write_flash 0x0 device-name-factory.bin
  1. Reset the device (power cycle, e.g. disconnecting & reconnecting the USB).

For me the device became online in the ESPHome Dashboard, and from this stage forward I’m able to update it wirelessly.

5 Likes

This is working for S2 boards.

Thanks @ItayKishon, after many hours trying different processes…this worked for me on the first go. I had already tried this board config without success, so perhaps the flashing parameters made the difference. @olealm, how did you arrive at the offset you specified, and does it make sense to not have it?

So far I’ve only loaded a sample YAML (one that I had working on a D1 mini) but my ESP32-S2 board is quite unresponsive, it takes 5+ seconds for the onboard LED to respond to a switch command. But at least it’s loaded with ESPHome.

Has anyone tried the ledc option? or drive a mosfet?
I was able to get it working with arduino ide and using analogue write command. ```analogWrite(pwm,50);
on pin16.
with esphome i cannot get it to work.
I am able to use any gpio as a switch though but if i want a variable voltage 0-3.3v it just doesnt work.
Maybe I am missing something? ledc might not be the option? as not even full brightness doesnt produce 3.3v on the output pin

esphome:
name: esp32s21
esp32:
board: lolin_s2_mini
variant: ESP32S2
framework:
type: arduino
version: 2.0.5 ( also tried: 2.0.3)
platform_version: 5.2.0 (also tried: 5.0.0 and 4.3.0)

status_led:
pin: GPIO15
output:

  • platform: ledc
    pin: GPIO16
    id: gpio_16
    light:
  • platform: monochromatic
    output: gpio_16
    name: “Kitchen Light”

Yup its broken, took me a few hours to figure it out. Try this

external_components:

  - source: github://pr#3820
    components:
      # list all components modified by this Pull Request here
      - ledc

working ?esp32 s2
I can’t control PWM

outputs:

  • platform: ledc

if so can you send the full code?

1 Like