Files
desklock/firmware/components/esp_hosted/slave/main/Kconfig.openthread
T
jpmschweitzerandClaude Fable 5 cb5826e02b
Test, Build and Push / test-gateway (push) Successful in 12s
Test, Build and Push / release (push) Skipped
Test, Build and Push / build-gateway (push) Skipped
Fork fix: the SDIO wedge is FIXED (esp-hosted-mcu #167)
Root cause (verified against our exact IDF tree, not the community guess):
the "258" in "sdio_write_task: Failed to send data: 258" is NOT a timeout
(that is 263). 258 = 0x102 = ESP_ERR_INVALID_ARG. On the ESP32-P4, block-
mode CMD53 writes require the SOURCE buffer to be 64-byte (cache-line)
aligned; the IDF sdmmc driver rejects a misaligned source with INVALID_ARG
BEFORE any bus activity. esp_hosts write loop then declares "Unrecoverable
host sdio state" and reboots the whole P4. The audio TX payload is not
64-aligned, so streaming mic audio wedged on the very FIRST frame (which is
exactly what we saw: listening -> instant Failed to send -> reboot).

This also explains why buffer/queue/clock/retry tuning all did nothing: the
write never reached the bus. And why our symptom was instant, not after
~100 writes (the community block-mode-desync theory) — it is the first
misaligned buffer, every time.

Fix: vendored esp_hosted 2.12.11 as an editable local component (overrides
the registry copy) and bounce a misaligned TX payload through one aligned
DMA scratch buffer in hosted_sdio_write_block (port_esp_hosted_host_sdio.c).
TX is serialized by the bus lock so a single static bounce buffer is safe;
freed in hosted_sdio_deinit. Host-only change — no C6 reflash.

VERIFIED ON HARDWARE (autonomous self-test): 40s of continuous mic-audio
upstream streaming — the traffic that previously wedged on the first frame
— ran clean, zero timeouts, zero reboots. A guarded SDIO_TX_SELFTEST harness
is kept (compiled out) for future SDIO stress testing.

Credit: root cause + patch designed via multi-agent investigation; the
precise 258=INVALID_ARG decode (correcting the upstream community timeout
assumption) came from checking our actual esp_err.h.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 09:50:27 +02:00

169 lines
4.5 KiB
Plaintext

if !OPENTHREAD_RADIO
comment "Radio Only Device must be selected:"
comment "Component config"
comment "└── OpenThread"
comment " └── Thread Core Features"
comment " └── Thread device type ──> Radio Only Device"
endif
if OPENTHREAD_COMMISSIONER
comment "Disable Commissioner:"
comment "Component config"
comment "└── OpenThread"
comment " └── Thread Core Features"
comment " └── [ ] Enable Commissioner"
endif
if OPENTHREAD_JOINER
comment "Disable Joiner:"
comment "Component config"
comment "└── OpenThread"
comment " └── Thread Core Features"
comment " └── [ ] Enable Joiner"
endif
if OPENTHREAD_SRP_CLIENT
comment "Disable SRP Client:"
comment "Component config"
comment "└── OpenThread"
comment " └── Thread Core Features"
comment " └── [ ] Enable SRP Client"
endif
if OPENTHREAD_DNS_CLIENT
comment "Disable DNS Client:"
comment "Component config"
comment "└── OpenThread"
comment " └── Thread Core Features"
comment " └── [ ] Enable DNS Client"
endif
comment " :warning: OpenThread UART port and Hosted UART transport port is same — pick a different UART port"
depends on ESP_UART_HOST_INTERFACE && ESP_HOSTED_OT_UART_PORT = ESP_UART_PORT
choice ESP_HOSTED_OT_INTERFACE
bool "OpenThread Transport"
default ESP_HOSTED_OT_TRANSPORT_UART
help
Transport used communicate with OpenThread Host
config ESP_HOSTED_OT_TRANSPORT_HOSTED
bool "Use ESP-Hosted Transport"
help
Use ESP-Hosted transport to communicate with OpenThread Host
config ESP_HOSTED_OT_TRANSPORT_UART
bool "UART"
help
Use dedicated UART to communicate with OpenThread Host
endchoice
if ESP_HOSTED_OT_TRANSPORT_UART
config ESP_HOSTED_OT_UART_PORT
int "UART Port to Use"
default 1
range 0 1
help
Select UART Port to Use. Do not select the UART Port used for console output (if enabled)
config ESP_HOSTED_OT_UART_PIN_TX
int "TX GPIO number"
default 14 if IDF_TARGET_ESP32C5
default 21 if IDF_TARGET_ESP32C6
default 12 if IDF_TARGET_ESP32H2
default 17 if IDF_TARGET_ESP32H4
help
GPIO used for UART TX
config ESP_HOSTED_OT_UART_PIN_RX
int "RX GPIO number"
default 13 if IDF_TARGET_ESP32C5
default 20 if IDF_TARGET_ESP32C6
default 22 if IDF_TARGET_ESP32H2
default 18 if IDF_TARGET_ESP32H4
help
GPIO used for UART RX
config ESP_HOSTED_OT_UART_BAUDRATE
int "Baud Rate"
default 460800
range 9600 3500000
help
Baud Rate to Use. Make sure Hardware supports the rate.
Standard rates are 9600, 19200, 38400, 57600, 115200, 460800, 921600
choice ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS
bool "Number of Data Bits"
default ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_8
help
Number of Data Bits to use
config ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_5
bool "5 Bits"
config ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_6
bool "6 Bits"
config ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_7
bool "7 Bits"
config ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_8
bool "8 Bits"
endchoice
config ESP_HOSTED_OT_UART_NUM_DATA_BITS
int
default 0 if ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_5
default 1 if ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_6
default 2 if ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_7
default 3 if ESP_HOSTED_OT_UART_PRIV_NUM_DATA_BITS_8
choice ESP_HOSTED_OT_UART_PRIV_PARITY
bool "Parity"
default ESP_HOSTED_OT_UART_PRIV_PARITY_NONE
config ESP_HOSTED_OT_UART_PRIV_PARITY_NONE
bool "None"
config ESP_HOSTED_OT_UART_PRIV_PARITY_EVEN
bool "Even"
config ESP_HOSTED_OT_UART_PRIV_PARITY_ODD
bool "Odd"
endchoice
config ESP_HOSTED_OT_UART_PARITY
int
default 0 if ESP_HOSTED_OT_UART_PRIV_PARITY_NONE
default 2 if ESP_HOSTED_OT_UART_PRIV_PARITY_EVEN
default 3 if ESP_HOSTED_OT_UART_PRIV_PARITY_ODD
choice ESP_HOSTED_OT_UART_PRIV_STOP_BITS
bool "Number of Stop Bits"
config ESP_HOSTED_OT_UART_PRIV_STOP_BITS_1
bool "1"
config ESP_HOSTED_OT_UART_PRIV_STOP_BITS_1_5
bool "1.5"
config ESP_HOSTED_OT_UART_PRIV_STOP_BITS_2
bool "2"
endchoice
config ESP_HOSTED_OT_UART_STOP_BITS
int
default 1 if ESP_HOSTED_OT_UART_PRIV_STOP_BITS_1
default 2 if ESP_HOSTED_OT_UART_PRIV_STOP_BITS_1_5
default 3 if ESP_HOSTED_OT_UART_PRIV_STOP_BITS_2
endif
config ESP_HOSTED_OT_NETIF_QUEUE_SIZE
int "OpenThread Network Interface Queue Size"
default 10
help
The packet queue size for the OpenThread network interface
config ESP_HOSTED_OT_TASK_QUEUE_SIZE
int "OpenThread Task Queue Size"
default 10
help
The OpenThread task queue size