mirror of
https://github.com/torlando-tech/pyxis.git
synced 2026-08-03 17:30:14 +00:00
Confirmed fixes: - LVGL hybrid-allocator threshold 1024->256 (lib/lv_mem_hybrid.h): moves ~45KB of small LVGL objects to PSRAM, fixing internal-heap starvation that made the call/loopback pipeline intermittently fail to allocate and reboot mid-call (internal free 71->116KB, largest contiguous block 61->106KB). - ES7210 mic PGA gain 21dB->12dB (lxst_audio.cpp): 21dB saturated the ADC -- an rms-7003 noise floor in silence + 0x8000 negative-rail spikes + a spectral-peak shift that masqueraded as a "+17% pitch warp". At 12dB idle silence is clean (rms 48). Diagnostic harness (PYXIS_TEST_HOOKS, test-only): T:RAWMIC[stage], T:REG, and T:RECORD/T:DUMPREC add a raw-mic UDP tap plus a reliable PSRAM recorder with a checksummed serial transfer, and T:LOOPBACK wiring, for objective mic-capture analysis (offboard Whisper STT scoring). Exploratory / still unresolved: captured speech remains garbled (oscillating static, likely an ES7210 sigma-delta capture instability -- under investigation). Includes a 16kHz/main-PLL clock path + MICBIAS exploration; the "warp" was the gain artifact, not a clock issue, so the 16kHz path can later be simplified back to 8kHz. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWZuYkHBRqNb6BZHV8sTG5
112 lines
4.6 KiB
Plaintext
112 lines
4.6 KiB
Plaintext
# Required for Arduino framework
|
|
CONFIG_FREERTOS_HZ=1000
|
|
|
|
# Flash configuration for 8MB
|
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
|
|
# Enable Bluetooth with NimBLE (uses ~100KB less RAM than Bluedroid)
|
|
CONFIG_BT_ENABLED=y
|
|
CONFIG_BT_NIMBLE_ENABLED=y
|
|
CONFIG_BT_BLUEDROID_ENABLED=n
|
|
|
|
# NimBLE role configuration - enable both central and peripheral for mesh
|
|
CONFIG_BT_NIMBLE_ROLE_CENTRAL=y
|
|
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y
|
|
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y
|
|
CONFIG_BT_NIMBLE_ROLE_OBSERVER=y
|
|
|
|
# NimBLE connection settings
|
|
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3
|
|
CONFIG_BT_NIMBLE_MAX_BONDS=10
|
|
|
|
# NimBLE GATT settings
|
|
CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=517
|
|
CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31
|
|
|
|
# Increase task stack size for stability
|
|
CONFIG_BT_NIMBLE_TASK_STACK_SIZE=8192
|
|
|
|
# Coexistence with WiFi
|
|
CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y
|
|
|
|
# Enable C++ exceptions (required for microReticulum)
|
|
CONFIG_COMPILER_CXX_EXCEPTIONS=y
|
|
CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0
|
|
|
|
# Enable PSRAM (8MB external RAM) for zero heap fragmentation
|
|
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
|
CONFIG_SPIRAM=y
|
|
CONFIG_SPIRAM_MODE_OCT=y
|
|
CONFIG_SPIRAM_SPEED_80M=y
|
|
|
|
# Configure malloc to use PSRAM
|
|
CONFIG_SPIRAM_USE_MALLOC=y
|
|
# Allocations smaller than this go to internal RAM (bytes)
|
|
# Lowered from 4096 to 64 to move Bytes allocations (16-200 bytes) to PSRAM
|
|
# This reduces internal heap fragmentation at cost of slightly slower access
|
|
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=64
|
|
# Reserve this much internal RAM for DMA/ISR (bytes)
|
|
# NOTE: framework=arduino uses PRECOMPILED ESP-IDF libs, so this file is NOT consumed
|
|
# by the tdeck build — internal-RAM placement is controlled via build_flags + custom
|
|
# allocators in platformio.ini (RNS_PSRAM_ALLOCATOR, NIMBLE_MEM_ALLOC_MODE_EXTERNAL)
|
|
# and lib/lv_mem_hybrid.h, not here.
|
|
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
|
|
|
# ============================================================================
|
|
# Boot Time Optimizations
|
|
# These settings reduce boot time. See BOOT_OPTIMIZATIONS.md for details.
|
|
# ============================================================================
|
|
|
|
# Disable PSRAM memory test at boot (~2 seconds saved for 8MB PSRAM)
|
|
# The memory test verifies PSRAM integrity but is redundant for stable hardware.
|
|
# To re-enable for debugging: comment out this line or set to y
|
|
CONFIG_SPIRAM_MEMTEST=n
|
|
|
|
# Reduce bootloader log verbosity (saves serial output time)
|
|
# Bootloader messages are rarely needed in production
|
|
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
|
|
CONFIG_BOOTLOADER_LOG_LEVEL=2
|
|
|
|
# Skip ROM bootloader output (saves serial time)
|
|
CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y
|
|
|
|
# ============================================================================
|
|
# FreeRTOS Timer Service Task
|
|
# Default 2048 is too small when NimBLE/WiFi timer callbacks run
|
|
# ============================================================================
|
|
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=4096
|
|
|
|
# ============================================================================
|
|
# Task Watchdog Timer (TWDT)
|
|
# Detects task starvation and deadlock conditions on user-code core (CPU1).
|
|
# 30s timeout accommodates SPIFFS flash I/O during identity persistence
|
|
# (writing 40-50 destinations to flash takes 5-15s with GC/erase).
|
|
#
|
|
# CPU0 IDLE watchdog INTENTIONALLY DISABLED:
|
|
# ESP-IDF runs the WiFi controller, lwIP TCP/IP stack, and system timer
|
|
# tasks on CPU0. Under heavy network load (busy TCP frames, mDNS, multicast
|
|
# WiFi traffic) those tasks can starve the CPU0 idle task for >30s without
|
|
# any user-code involvement. Triggering an `abort` because lwIP is busy is
|
|
# false-positive — it doesn't mean any pyxis task is misbehaving. We keep
|
|
# the watchdog on the loopTask (added explicitly via esp_task_wdt_add in
|
|
# main.cpp:1421) and on CPU1 idle, which together cover the core where
|
|
# all user code runs. Surfaced 2026-05-05 by the post-graft `task_wdt_isr`
|
|
# abort decoded to esp_vApplicationIdleHook on core 0; pre-graft pyxis
|
|
# was hitting the same pattern (~57s reset cadence).
|
|
# ============================================================================
|
|
CONFIG_ESP_TASK_WDT_EN=y
|
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=30
|
|
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n
|
|
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
|
|
|
|
# ============================================================================
|
|
# Core Dump — writes CPU state + backtrace to flash on crash
|
|
# Read with: espcoredump.py info_corefile -t raw -c 0x7F0000 -s 0x10000 <port>
|
|
# ============================================================================
|
|
CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y
|
|
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
|
|
CONFIG_ESP_COREDUMP_CHECKSUM_SHA256=y
|
|
CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64
|