Add support for ESP32-S2 #250

This commit is contained in:
fvanroie 2021-11-20 11:34:36 +01:00
parent ee3ec951b4
commit 0639a0e2b5
6 changed files with 185 additions and 28 deletions

35
boards/esp32s2.json Normal file
View File

@ -0,0 +1,35 @@
{
"build": {
"arduino": {
"ldscript": "esp32s2_out.ld"
},
"core": "esp32",
"extra_flags": "-DBOARD_HAS_PSRAM",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
"mcu": "esp32s2",
"variant": "esp32s2",
"partitions": "esp32_partition_app1856k_spiffs320k.csv"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32s2.cfg"
},
"frameworks": [
"espidf",
"arduino"
],
"name": "Espressif Generic ESP32-S2",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html",
"vendor": "Espressif"
}

View File

@ -150,14 +150,18 @@ const char* Esp32Device::get_chip_model()
case CHIP_ESP32:
return "ESP32";
#ifdef CHIP_ESP32S2
#ifdef ESP32
case CHIP_ESP32S2:
return "ESP32-S2";
#endif
#ifdef CHIP_ESP32S3
case CHIP_ESP32S3:
return "ESP32-S3";
case CHIP_ESP32C3:
return "ESP32-C3";
case CHIP_ESP32H2:
return "ESP32-H2";
#endif
default:

View File

@ -122,12 +122,14 @@ board_build.partitions = user_setups/esp32/partitions_16MB.csv
; -- The Arduino ESP32 v2.0.1 with 3 available flash sizes:
[arduino_esp32_v2]
framework = arduino
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform_packages =
;framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#mem-optimized
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1
;framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
;toolchain-xtensa32 @ 3.80200.200512
;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1/framework-arduinoespressif32-release_IDF4.4.tar.gz
platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
;;framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#mem-optimized
;framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1
;;framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
;;toolchain-xtensa32 @ 3.80200.200512
board_build.embed_files =
data/edit.htm.gz
data/style.css.gz

View File

@ -17,7 +17,7 @@ board_build.filesystem = littlefs
; data/edit.htm.gz
; ----- crash reporter
monitor_filters = esp32_exception_decoder
monitor_filters = esp32s2_exception_decoder
; ----- debugger
; check_tool = cppcheck
@ -56,6 +56,12 @@ build_flags =
-D HASP_USE_GIFDECODE=0
; -- LittleFS build options ------------------------
;-D CONFIG_LITTLEFS_FOR_IDF_3_2 ; obsolete in IDF 3.3
; -- FreeType build options ------------------------
-D LV_USE_FT_CACHE_MANAGER=1 ; crashes without cache
-D USE_LVGL_FREETYPE_MAX_FACES=64 ; max number of FreeType faces in cache
-D USE_LVGL_FREETYPE_MAX_SIZES=4 ; max number of sizes in cache
-D USE_LVGL_FREETYPE_MAX_BYTES=16384 ; max bytes in cache
-D USE_LVGL_FREETYPE_MAX_BYTES_PSRAM=65536 ; max bytes in cache when using PSRAM
lib_ignore =
GxTFT
@ -89,11 +95,50 @@ extra_scripts =
; tools/copy_partitions.py
; -- The ESP32S2 has 2 SPI Hardware Busses available to use:
fspi =
-D TFT_MISO=19
-D TFT_MOSI=23
-D TFT_SCLK=18
hspi =
-D TFT_MISO=37
-D TFT_MOSI=35
-D TFT_SCLK=36
fspi =
-D TFT_MISO=12
-D TFT_MOSI=13
-D TFT_SCLK=14
; -- The Arduino ESP32 v2.0.1 with 3 available flash sizes:
[arduino_esp32s2_v2]
framework = arduino
;platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master
platform_packages = framework-arduinoespressif32 @ https://github.com/tasmota/arduino-esp32/releases/download/2.0.1/framework-arduinoespressif32-release_IDF4.4.tar.gz
platformio/tool-esptoolpy @ https://github.com/tasmota/esptool/releases/download/v3.2/esptool-v3.2.zip
;;framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#mem-optimized
;framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.1
;;framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
;;toolchain-xtensa32 @ 3.80200.200512
board_build.embed_files =
data/edit.htm.gz
data/style.css.gz
data/script.js.gz
board_build.filesystem = littlefs
; ----- crash reporter
monitor_filters = esp32_exception_decoder
extra_scripts =
${esp32.extra_scripts}
[esp32s2_4mb_v2]
extends = exp32, arduino_esp32s2_v2
board_upload.flash_size=4MB
board_upload.maximum_size = 4194304
board_build.partitions = user_setups/esp32/partitions_4MB.csv
[esp32s2_8mb_v2]
extends = exp32, arduino_esp32s2_v2
board_upload.flash_size=8MB
board_upload.maximum_size = 8388608
board_build.partitions = user_setups/esp32/partitions_8MB.csv
[esp32s2_16mb_v2]
extends = exp32, arduino_esp32s2_v2
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_build.partitions = user_setups/esp32/partitions_16MB.csv

View File

@ -6,17 +6,14 @@
;***************************************************;
[env:esp32s2-featherwing-24]
extends = esp32s2
board = featheresp32
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0
extends = esp32s2_4mb_v2
board = esp32s2
build_flags =
${env.build_flags}
${esp32s2.build_flags}
-D HASP_MODEL="Adafruit ESP32-S2 Featherwing 2.4"
-D USE_HSPI_PORT
;region -- TFT_eSPI build options ------------------------
-D ILI9341_DRIVER=1
@ -26,17 +23,23 @@ build_flags =
-D SPI_FREQUENCY=27000000
-D SPI_TOUCH_FREQUENCY=2500000
-D SPI_READ_FREQUENCY=20000000
; -D USER_SETUP_LOADED=1
-D TOUCH_DRIVER=0x0610 ;STMPE610
;-D USER_SETUP_LOADED=1
-D LGFX_USE_V1=1
-D TFT_MISO=19
-D TFT_MOSI=18
-D TFT_SCLK=5
-D TFT_DC=33
-D TFT_CS=15
-D TOUCH_DRIVER=0x0610 ;STMPE610
-D TFT_MISO=12 ;37
-D TFT_MOSI=13 ;35
-D TFT_SCLK=14 ;36
-D TFT_DC=5
-D TFT_CS=6
-D TFT_RST=-1 ; RST
-D TFT_BCKL=-1 ; Solder the LITE pad to a PWM enabled pin of the ESP.
-D TOUCH_CS=32
-D TOUCH_CS=7
-D TOUCH_SDA=33
-D TOUCH_SCL=34
-D TOUCH_IRQ=8
-D I2C_TOUCH_PORT=-1
-D I2C_TOUCH_ADDRESS=-1
-D I2C_TOUCH_FREQUENCY=-1
;endregion
lib_deps =

View File

@ -0,0 +1,68 @@
;***************************************************;
; Metro ESP32-S2 with Waveshare Touch Shield ;
; - Adafruit Metro ESP32-S2 board ;
; - ili9486 Waveshare TFT Touch Shield ;
; - XPT2046 touch controller ;
;***************************************************;
[env:esp32s2-metro-ili9486]
extends = esp32s2_4mb_v2
board = esp32s2
build_flags =
${env.build_flags}
${esp32s2.build_flags}
-D HASP_MODEL="Adafruit ESP32-S2 Featherwing 2.4"
-D USE_HSPI_PORT
;region -- TFT_eSPI build options ------------------------
-D ILI9486_DRIVER=1
-D TFT_WIDTH=240
-D TFT_HEIGHT=320
-D TFT_ROTATION=0 ; Use default, see TFT_ROTATION values
-D SPI_FREQUENCY=27000000
-D SPI_TOUCH_FREQUENCY=2500000
-D SPI_READ_FREQUENCY=20000000
;-D USER_SETUP_LOADED=1
-D LGFX_USE_V1=1
-D TOUCH_DRIVER=0x2046 ;XPT2046
-D TFT_SCLK=42 ;36 ;42
-D TFT_MISO=21 ;37 ;21
-D TFT_MOSI=16 ;35 ;16
-D TFT_CS=15
-D TFT_BCKL=14
-D TFT_RST=13
-D TFT_DC=12
-D TOUCH_BUSY=11
-D SD_CS=10
-D TOUCH_CS=7
-D TOUCH_IRQ=9
-D TOUCH_SDA=33
-D TOUCH_SCL=34
-D I2C_TOUCH_PORT=-1
-D I2C_TOUCH_ADDRESS=-1
-D I2C_TOUCH_FREQUENCY=-1
;endregion
; SCLK = 42
; MISO = 21
; MOSI = 16
; LCD_CS = 15
; LCD_BL = 14
; LCD_RST = 13
; LCD_DC=12
; TP_BUSY=11
; SD_CS=10
; TP_IRQ=9
lib_deps =
${env.lib_deps}
${esp32s2.lib_deps}
adafruit/Adafruit STMPE610@^1.1.3 ;STMPE610 touch controller
lovyan03/LovyanGFX @ ^0.4.5
lib_ignore =
${env.lib_ignore}
${esp32s2.lib_ignore}
TFT_eSPI