Help Needed: Correct PlatformIO Configuration for Custom ESP32-S3 Board with ESP32-S3-WROOM-1-N4R2 (4MB Flash, 2MB PSRAM)

Hello,

I am new to ESP32 development and PlatformIO.

I am working with a custom ESP32-S3-based board that uses the ESP32-S3-WROOM-1-N4R2 module, which has 4MB Flash and 2MB PSRAM.
I am trying to set up a new Arduino project using PlatformIO on VSCode, but I am unable to find the correct board configuration for this custom setup.

The closest match I found is ESP32-S3-DevKitC-1, which has 8MB Flash and no PSRAM, but my board has a different memory configuration, and I believe using this configuration may lead to memory issues.

Could anyone please guide me on:

  1. The correct board configuration for the ESP32-S3-WROOM-1-N4R2 (4MB Flash, 2MB PSRAM) module?
  2. How to modify the platformio.ini file to work with this custom setup?

Since this is a custom board, I understand it may not be listed as a pre-defined option in PlatformIO. Any help with setting up this configuration would be greatly appreciated!

Thank you in advance for your help!

This should work for you:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags = 
  -DBOARD_HAS_PSRAM

See GitHub - sivar2311/ESP32-S3-PlatformIO-Flash-and-PSRAM-configurations: ESP32-S3 PlatformIO Flash and PSRAM configurations

This is my simple code.

#include <Arduino.h>

// put function declarations here:
int myFunction(int, int);
int result;

void setup() {
// put your setup code here, to run once:
result = myFunction(2, 3);
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println( result);
delay(3000);
}

// put function definitions here:
int myFunction(int x, int y) {
return x + y;
}

I paste this.

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags =
-DBOARD_HAS_PSRAM

In my platformio.ini

In the serial terminal, I am getting this.

14:22:31.289 → Build:Mar 27 2021
14:22:31.289 → rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
14:22:31.289 → Saved PC:0x403cdb0a
14:22:31.289 → SPIWP:0xee
14:22:31.289 → mode:DIO, clock div:1
14:22:31.289 → load:0x3fce3808,len:0x4bc
14:22:31.289 → load:0x403c9700,len:0xbd8
14:22:31.289 → load:0x403cc700,len:0x2a0c
14:22:31.289 → entry 0x403c98d0
14:22:31.289 → ESP-ROM:esp32s3-20210327

For better readability, please use pre-formatted text when posting code or logs.

In the serial terminal, I am getting this.

Usually an ESP32-S3 DevKit has a COM (UART) and USB port.
Which one do you use to connect your board?

I am actually using UART for the connection, not the USB port.

14:22:31.289 → Build:Mar 27 2021
14:22:31.289 → rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
14:22:31.289 → Saved PC:0x403cdb0a
14:22:31.289 → SPIWP:0xee
14:22:31.289 → mode:DIO, clock div:1
14:22:31.289 → load:0x3fce3808,len:0x4bc
14:22:31.289 → load:0x403c9700,len:0xbd8
14:22:31.289 → load:0x403cc700,len:0x2a0c
14:22:31.289 → entry 0x403c98d0
14:22:31.289 → ESP-ROM:esp32s3-20210327

These are the boot message of the ESP32 and they are totally fine.

But there is no output of our program?

void loop() {
// put your main code here, to run repeatedly:
Serial.println( result);
delay(3000);
}

Please show the complete content of your platformio.ini.

You’ve given this. I am using this

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags = 
  -DBOARD_HAS_PSRAM`

Full Code

`#include <Arduino.h>

// put function declarations here:
int myFunction(int, int);
int  result;

void setup() {
  // put your setup code here, to run once:
  result = myFunction(2, 3);
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println( result);
  delay(3000);
}

// put function definitions here:
int myFunction(int x, int y) {
  return x + y;
}`

output 5.

I am getting output in Arduino, but not in VS Code. I think the issue might be related to the configuration. Also, There is any different configurations are there UART and USB.

Please post a screenshot of your configuration in the ArduinoIDE to find the respective settings for PlatformIO.

The default output for the ESP32-S3-DevKitC-1 is UART (the Serial will output to the UART port by default).

I did not change anything in the Arduino configuration; it is set to the default.

That’s strange… both configurations are set to use UART ArduinoIDE and PlatformIO. So you should see the text in the monitor… :thinking:

Even this is not directly connected to your issue:
Do you use PlatformIO’s builtin serial monitor?

I’m asking because there is no configuration for the baudrate (monitor_speed = 115200) and you still got vaild messages.

Also: Do you have multiple projects open in your VS Code workspace at the same time?

I am using the Arduino Serial Monitor or Tera Term to view the output at a baud rate of 115200. In VS Code, I have only my project open — all other projects are closed.

Add
monitor_speed = 115200 to your platformio.ini.

Close all terminal programs.

Upload the sketch again.

Open platformio’s serial monitor.

As per your feedback, I changed the configuration. Now, in the VS Code serial terminal, I am getting this output. I also tried erasing before programming, but I am still not getting the expected output.


[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.extra_flags = 
  -DBOARD_HAS_PSRAM
monitor_speed = 115200
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cdb0a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cdb0a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021

The boards resets. That’s okay after uploading.

But I see the same output twice…
Does this output repeat over and over again? (Does the ESP reboots again and again?)

Yes, it is continuously printing.

Okay, then the ESP is crashing over and over again!

The only difference in configuration I can see that PSRAM is disabled in ArduinoIDE.

Please remove this from your platformio.ini:

board_build.extra_flags = 
  -DBOARD_HAS_PSRAM

I am still facing the same issue.

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

board_build.arduino.memory_type = qio_qspi
board_build.flash_mode = qio
board_build.psram_type = qio
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
; board_build.extra_flags = 
;   -DBOARD_HAS_PSRAM
monitor_speed = 115200
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x403cdb0a
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x4bc
load:0x403c9700,len:0xbd8
load:0x403cc700,len:0x2a0c
entry 0x403c98d0
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x�ESP-ROM:esp32s3-20210327
Build:Mar 27 2021

know also i am faceing same issue.

I’m running out of ideas…sorry.

OK, thank you for your help.

If anyone can, please provide a solution.