ESP32-S3 program does not run correctly with PlatformIO, but works fine with the Arduino IDE

Hello, I’m programming a custom board through USB CDC connected directly to pins 23 and 24 on an ESP32-S3-MINI-1-N8.

After pulling the boot pin low and toggling reset, the COM port appears and I can upload a program using the Arduino IDE. I can then reset the chip and my program prints to the COM port as expected.

When I perform the same steps using my PlatformIO project, the program uploads successfully, but the COM port does not reappear after I reset the chip.

Here are the settings used in the Arduino IDE:

Here is my board configuration:

templog-v1.json:

{
  "build": {
    "arduino":{
      "ldscript": "esp32s3_out.ld",
      "partitions": "default_8MB.csv"
    },
    "core": "esp32",
    "extra_flags": [
      "-DARDUINO_ESP32S3_DEV",
      "-DARDUINO_USB_MODE=1",
      "-DARDUINO_USB_CDC_ON_BOOT=1",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "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": "TemplogV1.0 8M Flash",
  "upload": {
    "flash_size": "8MB",
    "maximum_ram_size": 327680,
    "maximum_size": 8388608,
    "wait_for_upload_port": true,
    "require_upload_port": true,
    "speed": 921600
  },
  "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
  "vendor": "Espressif"
}

Here is my platformio.ini:

[platformio]
build_cache_dir = buildCache/

[env:templog-esp-s3]
platform = espressif32
board = templog-v1
board_build.arduino.memory_type = dio_opi
framework = arduino
monitor_speed = 115200
monitor_port = COM671
upload_port = COM671
build_flags =
    -DCORE_DEBUG_LEVEL=5
    -Werror=return-type
lib_ldf_mode = deep+
platform_packages =
tool-esptoolpy@1.40801.0

Here is my program:

#include <Arduino.h>

void setup() {

    Serial.begin();
}

void loop() {

    Serial.println("Hello");
    delay(500);
}

What could be missing from my configuration that prevents the serial port from coming back up?

Some minor details:

  • The board has no LEDs or test points so I can’t verify if the program is running at all, or if it’s just a CDC COM port issue
  • When I enter upload mode with the boot/enable sequence and upload with PlatformIO, the COM port does not immediately disappear, and when I open it, I see this bootloader message “ESP-ROM:esp32s3-20210327”. After resetting the board, it does not reappear.

Thank you!

You did not specify the platform version.

Which Espressif Arduino version do you use in Arduino IDE and which version do you have installed in PlatformIO?

For the Arduino IDE, it works with both 3.2.1 as well as 2.0.17.

For platform IO, I have now specified
platform = espressif32@6.11.0

So I’m not sure which version I was using before, but I get the same results with 6.11.0

I think your memory_type is wrong.
Assuming your board has QIO Flash and OPI PASRAM this setting must be
board_build.arduino.memory_type = qio_opi

To get Arduino 3.2.1 and to rule out other sources of possible errors, please use this platformio.ini:

[env:templog-esp-s3]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip
board = templog-v1
board_build.arduino.memory_type = qio_opi
framework = arduino
monitor_speed = 115200
monitor_port = COM671
upload_port = COM671
build_flags =
    -DCORE_DEBUG_LEVEL=5

Manually updating to 3.2.1 fixed the issue!

Thanks! you’re awesome.