From 202fac59f8da7af930234c5d29e21d617ed061df Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 4 Aug 2022 13:44:52 -0400 Subject: [PATCH] ESP32 fixes for no PSRAM; some cleanup --- .../adafruit_feather_esp32_v2/sdkconfig | 46 +++++++++++-------- .../adafruit_feather_huzzah32/sdkconfig | 36 +++++++-------- .../boards/adafruit_qtpy_esp32_pico/sdkconfig | 11 +---- .../boards/hardkernel_odroid_go/sdkconfig | 37 ++++----------- ports/espressif/supervisor/port.c | 6 ++- 5 files changed, 62 insertions(+), 74 deletions(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig index 4250aa45e3..c09d8c409a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig @@ -6,22 +6,32 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y -# Uncomment to send log output to TX/RX pins on Feather ESP32V2 -# -# ESP System Settings -# -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -# # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM=y -# # CONFIG_ESP_CONSOLE_NONE is not set -# CONFIG_ESP_CONSOLE_UART=y -# nCONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -# # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -# CONFIG_ESP_CONSOLE_UART_NUM=0 -# CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 -# CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 -# CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -# # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -# # end of ESP System Settings +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### # CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig index 9c1fcd9382..6c0168c829 100644 --- a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig @@ -1,22 +1,20 @@ -### TEST CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - CONFIG_ESP32_SPIRAM_SUPPORT=n -# Uncomment to send log output to TX/RX pins -# -# ESP System Settings -# -CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM=y -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -# end of ESP System Settings +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig index f2e8085d3e..bec9e436b7 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig @@ -1,10 +1,3 @@ -# -# Partition Table -# -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" -CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" -# end of Partition Table - # # SPI RAM config # @@ -33,7 +26,7 @@ CONFIG_ESP32_SPIRAM_SUPPORT=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -### # Uncomment to send log output to TX/RX pins on Feather ESP32V2 +### # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # ### # ESP System Settings ### # @@ -45,7 +38,7 @@ CONFIG_ESP32_SPIRAM_SUPPORT=y ### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y ### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set ### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=32 ### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 ### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 ### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set diff --git a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig index f220cff390..f4fea0c732 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig +++ b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig @@ -1,13 +1,4 @@ -# -# Partition Table -# -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv" -CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv" -# end of Partition Table - -CONFIG_ESP_INT_WDT_TIMEOUT_MS=3000 - -# +CONFIG_ESP32_SPIRAM_SUPPORT=y # SPI RAM config # # CONFIG_SPIRAM_TYPE_AUTO is not set @@ -27,28 +18,20 @@ CONFIG_SPIRAM_MEMTEST=y # CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set CONFIG_SPIRAM_CACHE_WORKAROUND=y -# -# SPI RAM config -# -CONFIG_ESP32_SPIRAM_SUPPORT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set - -### # Uncomment to send log output to TX/RX pins on Feather ESP32V2 +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # ### # ESP System Settings ### # -CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y ### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y ### # CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### CONFIG_ESP_CONSOLE_UART=y +### nCONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y ### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=12 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=15 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=12 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=15 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 ### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set ### # end of ESP System Settings diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 9f58e8625b..84ff736c47 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -160,6 +160,7 @@ void sleep_timer_cb(void *arg); #define PSRAM_HSPI_SPIWP_SD3_IO 2 #define PSRAM_HSPI_SPIHD_SD2_IO 4 +#ifdef CONFIG_SPIRAM // PSRAM clock and cs IO should be configured based on hardware design. // For ESP32-WROVER or ESP32-WROVER-B module, the clock IO is IO17, the cs IO is IO16, // they are the default value for these two configs. @@ -180,9 +181,11 @@ void sleep_timer_cb(void *arg); #define PICO_V3_02_PSRAM_CLK_IO 10 #define PICO_V3_02_PSRAM_CS_IO 9 +#endif // CONFIG_SPIRAM static void _never_reset_spi_ram_flash(void) { #if defined(CONFIG_IDF_TARGET_ESP32) + #if defined(CONFIG_SPIRAM) uint32_t pkg_ver = esp_efuse_get_pkg_ver(); if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) { never_reset_pin_number(D2WD_PSRAM_CLK_IO); @@ -202,6 +205,7 @@ static void _never_reset_spi_ram_flash(void) { never_reset_pin_number(D0WDR2_V3_PSRAM_CLK_IO); never_reset_pin_number(D0WDR2_V3_PSRAM_CS_IO); } + #endif // CONFIG_SPIRAM const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info(); if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_SPI) { @@ -226,7 +230,7 @@ static void _never_reset_spi_ram_flash(void) { never_reset_pin_number(EFUSE_SPICONFIG_RET_SPIHD(spiconfig)); never_reset_pin_number(bootloader_flash_get_wp_pin()); } - #endif + #endif // CONFIG_IDF_TARGET_ESP32 } safe_mode_t port_init(void) {