Skip to content

Commit 2f6dd4c

Browse files
committed
esp32-d0-pico2 tunings, add psram and flash mem type info in status
Firmware ======== - esp32-d0.ini: update env:esp32-d0-pico2 frontend ======= - models / System status: add flash_chip_mode and psram_mode backend ======= - System Status add psram_mode and flash_chip_mode - main: add CONFIG_SPIRAM_MODE_OCT check on redefining new operator
1 parent 0e12cc9 commit 2f6dd4c

7 files changed

Lines changed: 12671 additions & 12624 deletions

File tree

firmware/esp32-c3.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ lib_deps = ${esp32-c3-base.lib_deps}
2929

3030
; Replaced partitioning by no OTA because flash > 100% other partitioning (no ota?) or Tasmota platform needed
3131
[env:esp32-c3-supermini]
32-
board = esp32-c3-devkitm-1
32+
board = esp32-c3-devkitm-1 ; https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-c3-devkitm-1.json
3333
board_build.mcu = esp32c3
3434
; Uncomment min_spiffs.csv setting if using EMBED_WWW with ESP32
3535
; board_build.partitions = min_spiffs.csv

firmware/esp32-d0.ini

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ board = esp32dev ; https://github.com/platformio/platform-espressif32/blob/devel
2424
board_build.partitions = boards/ESP32_4MB_NO_OTA.csv
2525
; board_build.partitions = min_spiffs.csv
2626
build_flags = ${esp32-d0-base.build_flags}
27-
-D HTTPD_STACK_SIZE=6144 ; d0-tuning... 4096 ;8192 ; also set by livescripts default 4096 but not enough for more complex read and update (esp32 has no livescripts therefore set this explicitly here
27+
-D HTTPD_STACK_SIZE=6144 ; instead of the default 8192 d0-tuning... 4096 ;8192 ; also set by livescripts default 4096 but not enough for more complex read and update (esp32 has no livescripts therefore set this explicitly here
2828
-D LOLIN_WIFI_FIX ; some boards have wifi issues if this is not defined, this sets WIFI_POWER_8_5dBm
2929
; -D LED_BUILTIN=2
3030
; -D KEY_BUILTIN=0
@@ -40,7 +40,7 @@ lib_deps = ${esp32-d0-base.lib_deps}
4040
board = esp32_16MB
4141
board_build.partitions = boards/ESP32_16MB_3MBFlash.csv ; standard for 16MB flash: 3MB firmware, 10 MB filesystem
4242
build_flags = ${esp32-d0-base.build_flags}
43-
-D HTTPD_STACK_SIZE=6144 ;d0-tuning...4096 ;8192 ; also set by livescripts default 4096 but not enough for more complex read and update (esp32 has no livescripts therefore set this explicitly here
43+
-D HTTPD_STACK_SIZE=6144 ;instead of the default 8192 d0-tuning...4096 ;8192 ; also set by livescripts default 4096 but not enough for more complex read and update (esp32 has no livescripts therefore set this explicitly here
4444
-D LOLIN_WIFI_FIX ; some boards have wifi issues if this is not defined, this sets WIFI_POWER_8_5dBm
4545
lib_deps = ${esp32-d0-base.lib_deps}
4646

@@ -85,7 +85,7 @@ board_build.partitions = boards/ESP32_4MB_NO_OTA.csv
8585
; board_build.partitions = min_spiffs.csv
8686
build_flags = ${env.build_flags}
8787
-D CONFIG_IDF_TARGET_ESP32=1
88-
-D HTTPD_STACK_SIZE=6144 ; a bit more as there are no app tasks atm
88+
-D HTTPD_STACK_SIZE=6144 ; instead of the default 8192 a bit more as there are no app tasks atm
8989
-D LOLIN_WIFI_FIX ; some boards have wifi issues if this is not defined, this sets WIFI_POWER_8_5dBm
9090
; -D LED_BUILTIN=2
9191
; -D KEY_BUILTIN=0
@@ -103,7 +103,7 @@ board_build.partitions = boards/ESP32_4MB_NO_OTA.csv
103103
; board_build.partitions = min_spiffs.csv
104104
build_flags = ${env.build_flags}
105105
-D CONFIG_IDF_TARGET_ESP32=1
106-
-D HTTPD_STACK_SIZE=6144 ; a bit more as there are no app tasks atm
106+
-D HTTPD_STACK_SIZE=6144 ; instead of the default 8192 a bit more as there are no app tasks atm
107107
-D LOLIN_WIFI_FIX ; some boards have wifi issues if this is not defined, this sets WIFI_POWER_8_5dBm
108108
-D ARDUINO_USB_CDC_ON_BOOT=0 ; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (needed on "classic ESP32")
109109
-DBOARD_HAS_PSRAM
@@ -117,11 +117,32 @@ lib_deps = ${env.lib_deps}
117117
[env:esp32-d0-pico2]
118118
board = esp32-pico-devkitm-2 ; https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json
119119
; see also https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32/esp32-pico-devkitm-2/index.html
120-
board_build.partitions = default_8MB.csv ;boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist)
120+
board_build.partitions = default_8MB.csv ; boards/ESP32_8MB.csv has not enough flash (2MB)
121121
board_build.arduino.memory_type = qio_qspi ; Added: PSRAM memory type
122122
board_build.flash_mode = qio ; Added: Flash mode for PSRAM
123+
upload_speed = 460800 ; upload_speed = 921600 was too fast ... if not set esphome web installer even uses slower speed
123124
build_flags = ${esp32-d0-base.build_flags}
124-
-D HTTPD_STACK_SIZE=6144
125+
; -D HTTPD_STACK_SIZE=6144 ; instead of the default 8192
125126
-DBOARD_HAS_PSRAM ; Added: Enable PSRAM
126-
-mfix-esp32-psram-cache-issue ; Added: Fix ESP32 PSRAM cache bug
127-
lib_deps = ${esp32-d0-base.lib_deps}
127+
; -mfix-esp32-psram-cache-issue ; Added: Fix ESP32 PSRAM cache bug
128+
; -D CONFIG_ESP_IPC_TASK_STACK_SIZE=2048 ; ← ADD THIS (double the default)
129+
; -D CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=0 ; ← ADD (keep IPC/system stacks in internal RAM)
130+
; -D CONFIG_I2S_ISR_IRAM_SAFE=1
131+
lib_deps = ${esp32-d0-base.lib_deps}
132+
133+
; [env:esp32-d0-pico2-quin]
134+
; board = esp32dev ; https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-pico-devkitm-2.json
135+
; ; see also https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32/esp32-pico-devkitm-2/index.html
136+
; board_build.partitions = default_8MB.csv ;boards/ESP32_8MB.csv ; Fixed: was default_8MB.csv (doesn't exist)
137+
; ; board_build.arduino.memory_type = qio_qspi ; Added: PSRAM memory type
138+
; upload_speed = 460800 ; upload_speed = 921600 was too fast ... if not set esphome web installer even uses slower speed
139+
; build_flags = ${esp32-d0-base.build_flags}
140+
; -D HTTPD_STACK_SIZE=6144. ; instead of the default 8192
141+
; -DBOARD_HAS_PSRAM ; Added: Enable PSRAM
142+
; ; -mfix-esp32-psram-cache-issue ; Added: Fix ESP32 PSRAM cache bug
143+
; lib_deps = ${esp32-d0-base.lib_deps}
144+
; monitor_filters = esp32_exception_decoder
145+
; board_upload.flash_size = 8MB
146+
; board_upload.maximum_size = 8388608
147+
; ; board_build.f_flash = 80000000L
148+
; board_build.flash_mode = dio

interface/src/lib/types/models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ export type StaticSystemInformation = {
139139
arduino_version: string;
140140
flash_chip_size: number;
141141
flash_chip_speed: number;
142+
flash_chip_mode: number; // 🌙
143+
psram_mode: string; // 🌙
142144
cpu_reset_reason: string;
143145
heap_info_app: string; // 🌙
144146
heap_info_dma: string; // 🌙

interface/src/routes/system/status/SystemStatus.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@
296296
{((systemInformation.used_psram / systemInformation.psram_size) * 100).toFixed(1)} %
297297
of {Math.round(systemInformation.psram_size / 1000).toLocaleString('en-US')} KB
298298
<span
299-
>({Math.round(systemInformation.free_psram / 1000).toLocaleString('en-US')} KB free)</span
299+
>({Math.round(systemInformation.free_psram / 1000).toLocaleString('en-US')} KB free, {systemInformation.psram_mode})</span
300300
>
301301
</div>
302302
</div>
@@ -490,7 +490,7 @@
490490
<div class="text-sm opacity-75">
491491
{Math.round(systemInformation.flash_chip_size / 1000).toLocaleString('en-US')} KB / {(
492492
systemInformation.flash_chip_speed / 1000000
493-
).toLocaleString('en-US')} MHz
493+
).toLocaleString('en-US')} MHz ({systemInformation.flash_chip_mode}) <!-- 🌙 -->
494494
</div>
495495
</div>
496496
</div>

lib/framework/SystemStatus.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ esp_err_t SystemStatus::systemStatus(PsychicRequest *request)
154154
root["free_psram"] = ESP.getFreePsram();
155155
root["used_psram"] = ESP.getPsramSize() - ESP.getFreePsram();
156156
root["psram_size"] = ESP.getPsramSize();
157+
// #if CONFIG_ESP32S3_SPIRAM_SUPPORT // WLEDMM -S3 has "qspi" or "opi" PSRAM mode
158+
#if CONFIG_SPIRAM_MODE_OCT
159+
root["psram_mode"] = "🚀 OPI";
160+
#elif CONFIG_SPIRAM_MODE_QUAD
161+
root["psram_mode"] = "QSPI";
162+
#else
163+
root["psram_mode"] = "other";
164+
#endif
165+
// #endif
157166
}
158167
root["cpu_freq_mhz"] = ESP.getCpuFreqMHz();
159168
root["cpu_type"] = ESP.getChipModel();
@@ -169,6 +178,20 @@ esp_err_t SystemStatus::systemStatus(PsychicRequest *request)
169178
root["arduino_version"] = ARDUINO_VERSION;
170179
root["flash_chip_size"] = ESP.getFlashChipSize();
171180
root["flash_chip_speed"] = ESP.getFlashChipSpeed();
181+
switch (ESP.getFlashChipMode()) { // 🌙
182+
// missing: Octal modes
183+
case FM_QIO: root["flash_chip_mode"] = "QIO"; break;
184+
case FM_QOUT: root["flash_chip_mode"] = "QOUT";break;
185+
case FM_DIO: root["flash_chip_mode"] = "DIO"; break;
186+
case FM_DOUT: root["flash_chip_mode"] = "DOUT or other";break;
187+
#if defined(CONFIG_IDF_TARGET_ESP32S3) && CONFIG_ESPTOOLPY_FLASHMODE_OPI
188+
case FM_FAST_READ: root["flash_chip_mode"] = "🚀OPI";break;
189+
#else
190+
case FM_FAST_READ: root["flash_chip_mode"] = "fast_read";break;
191+
#endif
192+
case FM_SLOW_READ: root["flash_chip_mode"] = "slow_read";break;
193+
default: root["flash_chip_mode"] = "other"; break;
194+
}
172195
root["fs_total"] = ESPFS.totalBytes();
173196
root["fs_used"] = ESPFS.usedBytes();
174197
root["core_temp"] = temperatureRead();

0 commit comments

Comments
 (0)