From 3817d007aa78b3389adbf26cbbb4e08e16870d12 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 28 Jul 2022 17:52:27 -0400 Subject: [PATCH 1/5] clean up esp32 sdkconfigs --- .../adafruit_feather_esp32_v2/sdkconfig | 59 ++++++------------- .../esp-idf-config/sdkconfig-esp32.defaults | 17 +----- 2 files changed, 20 insertions(+), 56 deletions(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig index f2e8085d3e..4250aa45e3 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig @@ -1,11 +1,4 @@ -# -# 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 - -# +CONFIG_ESP32_SPIRAM_SUPPORT=y # SPI RAM config # # CONFIG_SPIRAM_TYPE_AUTO is not set @@ -13,40 +6,22 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set CONFIG_SPIRAM_SIZE=2097152 -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 +# end of SPI RAM config +# Uncomment to send log output to TX/RX pins on Feather ESP32V2 # -# SPI RAM config +# ESP System Settings # -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 -### # -### # 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 +# 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 diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 6c244f3bbe..0b8efe48cd 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -1,3 +1,6 @@ +# +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# CONFIG_IDF_TARGET_ARCH_XTENSA=y CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET_ESP32=y @@ -112,19 +115,6 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -# 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" -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - # # Compiler options # @@ -1081,7 +1071,6 @@ CONFIG_STACK_CHECK_NONE=y CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y CONFIG_ADC2_DISABLE_DAC=y -CONFIG_SPIRAM_SUPPORT=y CONFIG_TRACEMEM_RESERVE_DRAM=0x0 # CONFIG_ULP_COPROC_ENABLED is not set CONFIG_ULP_COPROC_RESERVE_MEM=0 From 534a482d9428f75fea1a077a51989936645eb1ac Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 2 Aug 2022 21:47:46 -0400 Subject: [PATCH 2/5] initial HUZZAH32 bring-up, with hacked pins --- .../boards/adafruit_feather_huzzah32/board.c | 45 +++++++++++ .../adafruit_feather_huzzah32/mpconfigboard.h | 45 +++++++++++ .../mpconfigboard.mk | 18 +++++ .../boards/adafruit_feather_huzzah32/pins.c | 79 +++++++++++++++++++ .../adafruit_feather_huzzah32/sdkconfig | 22 ++++++ .../common-hal/microcontroller/Pin.c | 4 + 6 files changed, 213 insertions(+) create mode 100644 ports/espressif/boards/adafruit_feather_huzzah32/board.c create mode 100644 ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_feather_huzzah32/pins.c create mode 100644 ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/board.c b/ports/espressif/boards/adafruit_feather_huzzah32/board.c new file mode 100644 index 0000000000..c5e2797b00 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/board.c @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h new file mode 100644 index 0000000000..0c481d6a4b --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather HUZZAH32" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO23}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO18, .miso = &pin_GPIO19}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO17, .rx = &pin_GPIO16}} + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk new file mode 100644 index 0000000000..2ed08856f9 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk @@ -0,0 +1,18 @@ +CIRCUITPY_CREATOR_ID = 0x0000239A +CIRCUITPY_CREATION_ID = 0x00320002 + +IDF_TARGET = esp32 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_STATUS_BAR = 0 +CIRCUITPY_WEB_WORKFLOW = 0 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/pins.c b/ports/espressif/boards/adafruit_feather_huzzah32/pins.c new file mode 100644 index 0000000000..2d96457aad --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/pins.c @@ -0,0 +1,79 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // External pins are in silkscreen order, from top to bottom, left side, then right side + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig new file mode 100644 index 0000000000..9c1fcd9382 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig @@ -0,0 +1,22 @@ +### 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 diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 201fa0ac2b..372819e545 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -48,6 +48,10 @@ static const uint64_t pin_mask_reset_forbidden = GPIO_SEL_3 | // RXD0 // Never ever reset pins used to communicate with SPI flash and PSRAM. GPIO_SEL_6 | // CLK + /////////TEMP + GPIO_SEL_7 | // SD0 + GPIO_SEL_8 | // SD1 + ////////END TEMP GPIO_SEL_9 | // (PSRAM) SD2 GPIO_SEL_10 | // (PSRAM) SD3 GPIO_SEL_11 | // CMD From b027d111a9c533f1ae1d53872b74e5ba67142de2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 2 Aug 2022 22:00:59 -0400 Subject: [PATCH 3/5] remove custom console UART from sdkconfig-esp32.defaults --- .../esp-idf-config/sdkconfig-esp32.defaults | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 0b8efe48cd..c60941afdf 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -470,16 +470,10 @@ CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 # CONFIG_ESP_CONSOLE_UART_DEFAULT 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 is not set +CONFIG_ESP_CONSOLE_NONE=y CONFIG_ESP_CONSOLE_MULTIPLE_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_CONSOLE_UART_NUM=-1 CONFIG_ESP_INT_WDT=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 CONFIG_ESP_INT_WDT_CHECK_CPU1=y From d3d5e36548fdaf7b0d3b7bce7861986ed8080829 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 2 Aug 2022 22:37:06 -0400 Subject: [PATCH 4/5] update adafruit/esp-idf for ESP32_ECO3_CACHE_LOCK_FIX fix --- ports/espressif/esp-idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 0180c0cb80..d51f7d8821 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 0180c0cb80f052919badc15df164e8edde6344ad +Subproject commit d51f7d882187afa4b39c2613fd0fe2ac2fea1145 From 202fac59f8da7af930234c5d29e21d617ed061df Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 4 Aug 2022 13:44:52 -0400 Subject: [PATCH 5/5] 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) {