ESP32-S3 FH4N2 WeAct Studio Mini won't run with platformio settings. Several issues

I have spent the past 12+ hours (taking some short breaks only) trying to figure out how to configure the ESP32-S3-Mini from WeAct Studio. For the life of me, I simply cannot find the right settings.

A dumb and simple hello_world.cpp code works fine when flashing it with the Arduino IDE after setting the USB CDC on boot option to enabled (as previously reported EVERYWHERE), however, nothing seems to work on platfomio. Believe me, I have read every result on the pio forum, SOVF and Google related to the configuration settings for the ESP32-S3 without any success.

These are my settings on the Arduino IDE:

and the successful output:

image

I have approached this through the creation of a custom .json file for the device and also through different build_flags. My objective is to “carbon copy” the same settings from the Arduino IDE to either of these two configuration files.

My latest platformio.ini file looks like this:

[env:esp32s3]
platform = espressif32
board = esp32-s3-mini
framework = arduino
upload_protocol = esptool

monitor_speed = 460800   ; several posts saying that this could solve the issue

board_build.flash_mode = dio   ; read point 1 below

build_flags =
	-D ARDUINO_USB_MODE=1
	-D ARDUINO_USB_CDC_ON_BOOT=1    
	-D ARDUINO_DFU_ON_BOOT=0
	-D ARDUINO_CORE_DEBUG=0
	-D ARDUINO_UPLOAD_MODE=0
	-D ARDUINO_ERASE_FLASH_BEFORE_UPLOAD=1

while my custom configuration for the WeAct Mini, named esp32-s3-mini.json is configured as follows:

FIle: esp32-s3-mini.json
{
  "build": {
    "arduino":{
      "ldscript": "esp32s3_out.ld",
      "memory_type": "qio_qspi",
      "partitions": "default.csv"
    },
    "core": "esp32",
    "extra_flags": [
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=0",
      "-DARDUINO_USB_MSC_ON_BOOT=0"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "qio",
    "hwids": [
      [
        "0x303A",
        "0x1001"
      ]
    ],
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "bluetooth",
    "wifi"
  ],
  "debug": {
    "default_tool": "esp-builtin",
    "onboard_tools": [
      "esp-builtin"
    ],
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "esp32-s3-mini",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "speed": 921600
  },
  "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitm-1.html",
  "vendor": "Espressif"
}

Amongst the many issues that I am facing, I can list them as follows:

  1. Boot-looping. I am aware that changing the flash_mode to qio could work. I doesn’t. The board constantly connects/disconnects after printing this on the serial monitor:

image

  1. Serial COM port is lost. Sometimes after changing some of the flags, the port dissapears and I am unable to upload the code. Only after connecting the board while pressing boot + short rst pulse + release boot push buttons I can make it accept code again. This works in 1 of 5 attempts only. Highly frustrating.

  1. There isn’t a specific list of flags available for pio that to copy the same settings from the Arduino IDE. For instance, I created the flag -D ARDUINO_ERASE_FLASH_BEFORE_UPLOAD=1 expecting that it could work. Since the project configuration and compilation were successful I assument that this could be the right flag, however, I have not found any clear references that confirm this flag as correct.

  2. After adding the lines:

build_flags =
	-DBOARD_HAS_PSRAM
	-mfix-esp32-psram-cache-issue

as recommended here the bootlooping occurs at a later point, compared to the one shown in Point 1. I am aware that these lines apply only when having external RAM, however, a this point I am testing EVERY possibility.

What am I missing? At this point I can’t think clearly and my head is just foggy nand extremely annoyed by these boards.

Final question. How can I prevent the board writing the memory information after bootup? My final application might have some issues with that.

image

To be frank, I find these ESP32-S3 chips extremely unreliable, convoluted and extremely poorly documented and poorly supported by espressif. What is the deal with them?

Please take a look at ESP32-S3-Zero does not work on PlatformIO - #10 by sivar2311

I also created a esp32-s3-fh4r2.json - see 2 posts later.
I would be pleased if you could test this.

Oh, the ESP32 are very well documented by Espressif!
Maybe you missed the datasheet?

The problem is rather that there are now many different modules and they have to be configured accordingly - which is the tricky part.

Dear @sivar2311

Thank you for your help with this. Unfortunately, while your solution seemed promising, it did not work for me.

Here are my findings.

  1. First, I tried by simply using the parameters that worked for @frotaitalos in the post you shared (the one marked as solution). I created a new environment in my same project that looks like this:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_upload.flash_size = 4MB
board_build.partitions = default.csv
build_flags = 
  -DARDUINO_USB_CDC_ON_BOOT=1
  -DBOARD_HAS_PSRAM

the board boot-cycles throwing this to the serial console:

I noticed that the USB port changes enumeration from COM16 to COM14 in my case.

  1. Then, I said “ok, let’s try with the .json file” so I created the new json in the boards folder, created a new environment:
[env:esp32-s3-fh4r2]
platform = espressif32
framework = arduino
board = esp32-s3-fh4r2

and, unfortunately, the board doesn’t show ANYTHING on the serial console. It’s blank.

Interestingly, during a second attempt using the same configuration, I lost the COM Port:

image
image

I was able to recover the COM port by holding boot + short RST pulse + releasing boot switches. Then the board changes from COM14 to COM16 when resetting the chip.

  1. I “Frankesteined” my configuration with parts of your settings and still get the same boot-looping behaviour.

There is no configuration that exactly replicates the settings from the Arduino IDE where the system works just fine. The reality is that I am embarking on a massive project where I will not use the Arduino IDE for mental sanity and many other reasons. I truly need the VSCode+pio combo to work for me.

Apologies for the long post and also for the closing marks from my orginal post. I was heavily sleep-deprived and frustrated :wink:

Any more ideas?

Could I be facing a hardware issue?

After more than 20 hours spent on this issue I think I finally figured it out.

The issue was on the settings from my serial monitor YAT. It turns out that the Flow Control had to be Hardware RTS/CTS

I previously had No flow control selected.

This is in line with an old bug report I filed in the YAT Sourceforge repository related to a similar issue with a XIAO board with flow control:

https://sourceforge.net/p/y-a-terminal/bugs/578/

The original report on this Flow Control issue:

https://sourceforge.net/p/y-a-terminal/discussion/serialport/thread/9b9e7abe9f/

I would like to thank @sivar2311 for his help. While you gave me a clear answer I realised that my settings and custom .json file were correct all the time and the problem was due to an external factor.

This issue should be considered as closed and to other users facing the same issue: Enable Hardware Flow Control on your serial terminal!

1 Like