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>
63 lines
2.9 KiB
C
63 lines
2.9 KiB
C
|
|
/* data included from the c++ packed-data generator,
|
|
and from the c test code. */
|
|
|
|
#define THOUSAND 1000
|
|
#define MILLION 1000000
|
|
#define BILLION 1000000000LL
|
|
#define TRILLION 1000000000000LL
|
|
#define QUADRILLION 1000000000000000LL
|
|
#define QUINTILLION 1000000000000000000LL
|
|
|
|
int32_t int32_arr0[2] = { -1, 1 };
|
|
int32_t int32_arr1[5] = { 42, 666, -1123123, 0, 47 };
|
|
int32_t int32_arr_min_max[2] = { INT32_MIN, INT32_MAX };
|
|
|
|
uint32_t uint32_roundnumbers[4] = { BILLION, MILLION, 1, 0 };
|
|
uint32_t uint32_0_max[2] = { 0, UINT32_MAX };
|
|
|
|
int64_t int64_roundnumbers[15] = { -QUINTILLION, -QUADRILLION, -TRILLION,
|
|
-BILLION, -MILLION, -THOUSAND,
|
|
1,
|
|
THOUSAND, MILLION, BILLION,
|
|
TRILLION, QUADRILLION, QUINTILLION };
|
|
int64_t int64_min_max[2] = { INT64_MIN, INT64_MAX };
|
|
|
|
uint64_t uint64_roundnumbers[9] = { 1,
|
|
THOUSAND, MILLION, BILLION,
|
|
TRILLION, QUADRILLION, QUINTILLION };
|
|
uint64_t uint64_0_1_max[3] = { 0, 1, UINT64_MAX };
|
|
uint64_t uint64_random[] = {0,
|
|
666,
|
|
4200000000ULL,
|
|
16ULL * (uint64_t) QUINTILLION + 33 };
|
|
|
|
#define FLOATING_POINT_RANDOM \
|
|
-1000.0, -100.0, -42.0, 0, 666, 131313
|
|
float float_random[] = { FLOATING_POINT_RANDOM };
|
|
double double_random[] = { FLOATING_POINT_RANDOM };
|
|
|
|
protobuf_c_boolean boolean_0[] = {0 };
|
|
protobuf_c_boolean boolean_1[] = {1 };
|
|
protobuf_c_boolean boolean_random[] = {0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,1,1,0 };
|
|
|
|
TEST_ENUM_SMALL_TYPE_NAME enum_small_0[] = { TEST_ENUM_SMALL(VALUE) };
|
|
TEST_ENUM_SMALL_TYPE_NAME enum_small_1[] = { TEST_ENUM_SMALL(OTHER_VALUE) };
|
|
#define T(v) (TEST_ENUM_SMALL_TYPE_NAME)(v)
|
|
TEST_ENUM_SMALL_TYPE_NAME enum_small_random[] = {T(0),T(1),T(1),T(0),T(0),T(1),T(1),T(1),T(0),T(0),T(0),T(0),T(0),T(1),T(1),T(1),T(1),T(1),T(1),T(0),T(1),T(1),T(0),T(1),T(1),T(0) };
|
|
#undef T
|
|
|
|
#define T(v) (TEST_ENUM_TYPE_NAME)(v)
|
|
TEST_ENUM_TYPE_NAME enum_0[] = { T(0) };
|
|
TEST_ENUM_TYPE_NAME enum_1[] = { T(1) };
|
|
TEST_ENUM_TYPE_NAME enum_random[] = {
|
|
T(0), T(268435455), T(127), T(16384), T(16383),
|
|
T(2097152), T(2097151), T(128), T(268435456),
|
|
T(0), T(2097152), T(268435455), T(127), T(16383), T(16384) };
|
|
#undef T
|
|
|
|
const char *repeated_strings_0[] = { "onestring" };
|
|
const char *repeated_strings_1[] = { "two", "string" };
|
|
const char *repeated_strings_2[] = { "many", "tiny", "little", "strings", "should", "be", "handled" };
|
|
const char *repeated_strings_3[] = { "one very long strings XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" };
|