diff --git a/boards/esp32s2.json b/boards/esp32s2.json new file mode 100644 index 00000000..58754e6f --- /dev/null +++ b/boards/esp32s2.json @@ -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" +} \ No newline at end of file diff --git a/src/dev/esp32/esp32.cpp b/src/dev/esp32/esp32.cpp index 00b8400c..b9776ce6 100644 --- a/src/dev/esp32/esp32.cpp +++ b/src/dev/esp32/esp32.cpp @@ -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: diff --git a/user_setups/esp32/_esp32.ini b/user_setups/esp32/_esp32.ini index 6353f774..88721b74 100644 --- a/user_setups/esp32/_esp32.ini +++ b/user_setups/esp32/_esp32.ini @@ -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 diff --git a/user_setups/esp32s2/_esp32s2.ini b/user_setups/esp32s2/_esp32s2.ini index 29010390..1c05afa1 100644 --- a/user_setups/esp32s2/_esp32s2.ini +++ b/user_setups/esp32s2/_esp32s2.ini @@ -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 diff --git a/user_setups/esp32s2/esp32s2-featherwing-24.ini b/user_setups/esp32s2/esp32s2-featherwing-24.ini index 63b365ef..ed7b8aa4 100644 --- a/user_setups/esp32s2/esp32s2-featherwing-24.ini +++ b/user_setups/esp32s2/esp32s2-featherwing-24.ini @@ -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 = diff --git a/user_setups/esp32s2/esp32s2-metro.ini b/user_setups/esp32s2/esp32s2-metro.ini new file mode 100644 index 00000000..3bdfc09b --- /dev/null +++ b/user_setups/esp32s2/esp32s2-metro.ini @@ -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