sdkconfig.defaults.esp32s2 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # =============================================================================
  2. # ESP32-S2 TARGET AND FLASH LAYOUT
  3. # =============================================================================
  4. # Default to ESP32-S2 Generic board profile.
  5. CONFIG_BOARD_ESP32S2_GENERIC=y
  6. CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
  7. CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
  8. # Use smaller partition table for 4MB flash
  9. CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="components/boards/partitions-4m.csv"
  10. # =============================================================================
  11. # ESP32-S2 MEMORY OPTIMIZATIONS
  12. # =============================================================================
  13. # ESP32-S2 has ~320KB DRAM (vs 520KB on ESP32) - memory optimization is critical
  14. # Binary Size: ~1.3 MB, Free: ~32% of app partition (plenty of room for updates)
  15. # Cache Configuration: Balance between memory and performance
  16. # Default: 8KB I-cache + 8KB D-cache leaves ~304KB for app/heap
  17. # For maximum memory: change D-cache to 0KB (if using SPIRAM) or reduce I-cache
  18. # For maximum performance: change both to 16KB (costs ~16KB more DRAM)
  19. CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB=y
  20. CONFIG_ESP32S2_DATA_CACHE_8KB=y
  21. # =============================================================================
  22. # WIFI/LWIP TUNING FOR ESP32-S2
  23. # =============================================================================
  24. # WiFi buffer optimization
  25. # RX BA window must be ≤ 2 × STATIC_RX_BUFFER_NUM
  26. CONFIG_ESP_WIFI_RX_BA_WIN=12
  27. CONFIG_LWIP_TCP_WND_DEFAULT=34816
  28. CONFIG_LWIP_TCP_SND_BUF_DEFAULT=18432
  29. CONFIG_ESP_WIFI_IRAM_OPT=y
  30. CONFIG_ESP_WIFI_RX_IRAM_OPT=y
  31. # lwIP stack size optimization
  32. CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
  33. CONFIG_LWIP_UDP_RECVMBOX_SIZE=32
  34. CONFIG_LWIP_TCP_RECVMBOX_SIZE=32
  35. # =============================================================================
  36. # FREERTOS AND SYSTEM HEAP TUNING
  37. # =============================================================================
  38. # FreeRTOS single-core optimizations
  39. CONFIG_FREERTOS_UNICORE=y
  40. CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y
  41. # Reduce idle task stack from default 1536 to save DRAM
  42. # Default is 1536 bytes (too much for single-core), 1024 is sufficient
  43. # Can reduce further to 768 if needed, but watch for stack overflow warnings
  44. CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024
  45. # Use RTC Fast Memory as heap (adds ~8KB to available heap)
  46. CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y
  47. # Increase main task stack if needed (audio/network operations)
  48. CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072
  49. # =============================================================================
  50. # CONSOLE/USB
  51. # =============================================================================
  52. # USB settings
  53. CONFIG_ESP_CONSOLE_USB_CDC=y
  54. # ESP32-S2 is single-core and has less DRAM than ESP32/S3
  55. # Use SPIRAM if available on the board
  56. # CONFIG_SPIRAM=y
  57. # =============================================================================
  58. # USB Audio Class defaults for the current usb_device_uac integration.
  59. # Keep both streams stereo at 48 kHz so the UAC descriptors, feedback,
  60. # and AirPlay USB backend all use the same resampled output rate.
  61. CONFIG_UAC_SPEAKER_CHANNEL_NUM=2
  62. CONFIG_UAC_MIC_CHANNEL_NUM=2
  63. CONFIG_UAC_SAMPLE_RATE=48000
  64. # =============================================================================
  65. # LED Behavior Configuration
  66. CONFIG_LED_STATUS_PLAYING_VU=y
  67. CONFIG_LED_STATUS_PAUSED_BLINK_SLOW=y
  68. CONFIG_LED_STATUS_STANDBY_OFF=y
  69. # LED inversion (active-low logic)
  70. CONFIG_LED_STATUS_INVERT=n
  71. CONFIG_LED_ERROR_INVERT=n
  72. # =============================================================================
  73. # GPIO defaults (adjust for your board - ESP32-S2 has 47 GPIO pins)
  74. CONFIG_LED_STATUS_GPIO=15
  75. CONFIG_I2S_SCK_IO=35
  76. CONFIG_I2S_BCK_IO=33
  77. CONFIG_I2S_WS_IO=16
  78. CONFIG_I2S_DO_IO=18
  79. # ST7789 TFT display support is not enabled by default.
  80. # The display is optional hardware — enabling it configures specific SPI
  81. # GPIO pins which may conflict with other peripherals on your board.
  82. # To enable, add the following to your own sdkconfig.defaults.esp32s2
  83. # or run: idf.py menuconfig -> Display Configuration