platformio / platform-espressif32

Espressif 32: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/espressif32
Apache License 2.0
934 stars 633 forks source link

Add support for ESP32-S3-WROOM-1-N4R2 #1389

Open nicola-reat opened 5 months ago

nicola-reat commented 5 months ago

Hi everyone, I would like to ask if anyone has already used an esp32-s3-wroom1-n4r2 with platformio

Jason2866 commented 5 months ago

yes.

nicola-reat commented 5 months ago

yes. @Jason2866

Okk can you send me your configuration??

Jason2866 commented 5 months ago

this boards json

{
  "build": {
    "arduino": {
      "memory_type": "qio_qspi"
    },
    "core": "esp32",
    "extra_flags": [
      "-DBOARD_HAS_PSRAM",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "qio",
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "wifi",
    "bluetooth"
  ],
  "debug": {
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "WROOM-1-N4R2",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://www.espressif.com",
  "vendor": "espressif"
}
nicola-reat commented 5 months ago

this boards json

{
  "build": {
    "arduino": {
      "memory_type": "qio_qspi"
    },
    "core": "esp32",
    "extra_flags": [
      "-DBOARD_HAS_PSRAM",
      "-DARDUINO_RUNNING_CORE=1",
      "-DARDUINO_EVENT_RUNNING_CORE=1"
    ],
    "f_cpu": "240000000L",
    "f_flash": "80000000L",
    "flash_mode": "qio",
    "mcu": "esp32s3",
    "variant": "esp32s3"
  },
  "connectivity": [
    "wifi",
    "bluetooth"
  ],
  "debug": {
    "openocd_target": "esp32s3.cfg"
  },
  "frameworks": [
    "arduino",
    "espidf"
  ],
  "name": "WROOM-1-N4R2",
  "upload": {
    "flash_size": "4MB",
    "maximum_ram_size": 327680,
    "maximum_size": 4194304,
    "require_upload_port": true,
    "speed": 460800
  },
  "url": "https://www.espressif.com",
  "vendor": "espressif"
}

Thanks so much

Jason2866 commented 5 months ago

Take care to use a matching partition scheme! Every scheme for 4MB flash will work.

nicola-reat commented 5 months ago

Take care to use a matching partition scheme! Every scheme for 4MB flash will work.

Yes, thanks, I'll implement it now

robertlipe commented 3 months ago

Unfortunately, while Espressif and Platformio are at a stalemate, I don't see a lot of merges being accepted to add changes like this.

If you control the project and not the build system (perhaps you're distributing open source and don't want to coach people into modifying their build systems or you don't have write access to the platformio directory) you can also get most of the juice from this orange in your own platformio.ini.

I've started to split my customizations to the .ini into triplets or quartets. One for the chip. One for the module. One for the board. One for the project. Yes, it's a bit tortured. This runs pretty firmly into a speed bump by 'extends' not actually working sensibly (though tickets to that topic get closed as 'working as documented') but it's workable. Relevant snippets from an active project for that module's bigger sibling.

This isn't quite the same module as you have, but it may provide inspirational for anyone else using modern-ish Espressif parts and trying to just make a working binary.

This may still technically be a bit over-described, but it's what's in my tree right now, though it's a work in progress. The key for these s3-nNrR modules really is to dial in the memory type as qspi (most boards > 2MB have ospi, not qspi - that's a frequent trap) and to set the BOARD_HAS_PSRAM flag and flash_size. Otherwise, the code will boot loop if it loads at all.

[dev_esp32-s3]
extends         = base
board           = esp32-s3-devkitc-1
board_build.mcu = esp32s3
board_build.f_cpu = 240000000L
monitor_speed   = 115200
upload_speed    = 1000000

; This describes a specific MODULE from Espressif. It may appear on different BOARDS.
[dev_esp32-s3-n16r2]
extends         = dev_esp32-s3
build_flags     = -DUSE_PSRAM=1
                  -DBOARD_HAS_PSRAM=1
                  ${dev_esp32-s3.build_flags}
board_build.arduino.memory_type = qio_qspi
board_build.partitions = default_16MB.csv
board_upload.flash_size = 16MB

[dev_yulc]
extends         = dev_esp32-s3-n16r2
build_unflags   = -DARDUINO_USB_MODE=1
build_flags     = -DARDUINO_USB_CDC_ON_BOOT=1 ; Counterintuitively, CDC = 1 lets USB Serial mode work.
                  -DARDUINO_USB_MODE=0 ; “Hardware CDC and JTAG” instead of "TinyUSB"
                  -DLED_PIN0=1 # These pins are defined by the hardware
                  -DLED_PIN1=2 # GPIO 2
                  ${dev_esp32-s3-n16r2.build_flags}

[env:yulc-hexagon]
extends         = dev_esp32-s3-n16r2
build_flags     =-DHEXAGON=1
                  -DENABLE_WIFI=1
                  -DENABLE_NTP=1
                  -DENABLE_OTA=1
                  -DENABLE_WEBSERVER=1
                  -DPOWER_LIMIT_MW=1000  # turn down brightness for now
                  ${dev_yulc.build_flags}
lib_ignore      = Bounce2
                  IRremoteESP8266
                  U8g2
                  QRCode

The plan is to build up in layers. Describe the chip. Describe the package. Describe the eval board/hardware. Describe the project running on the hardware.

nikito7 commented 3 months ago

It works ok with Tasmota