diff --git a/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux index 1c7e2296f1b..18b02189f20 100644 --- a/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux +++ b/components/esp_modem/examples/simple_cmux_client/sdkconfig.ci.sim800_cmux @@ -14,3 +14,11 @@ CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y CONFIG_ESP32_PANIC_PRINT_HALT=y CONFIG_COMPILER_CXX_EXCEPTIONS=y CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y +CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=4 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=4 +# CONFIG_LOG_MASTER_LEVEL is not set diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp index 1ce67a61f61..cf36c5e43f5 100644 --- a/components/esp_modem/src/esp_modem_cmux.cpp +++ b/components/esp_modem/src/esp_modem_cmux.cpp @@ -116,8 +116,10 @@ struct CMux::CMuxFrame { bool CMux::data_available(uint8_t *data, size_t len) { if (data && (type & FT_UIH) == FT_UIH && len > 0 && dlci > 0) { // valid payload on a virtual term + ESP_LOGW("CMUX", "%d", __LINE__); int virtual_term = dlci - 1; if (virtual_term < MAX_TERMINALS_NUM && read_cb[virtual_term]) { + ESP_LOGW("CMUX", "%d", __LINE__); // Post partial data (or defragment to post on CMUX footer) #ifdef DEFRAGMENT_CMUX_PAYLOAD if (payload_start == nullptr) { @@ -129,30 +131,40 @@ bool CMux::data_available(uint8_t *data, size_t len) read_cb[virtual_term](data, len); #endif } else { + ESP_LOGW("CMUX", "%d", __LINE__); return false; } } else if (data == nullptr && type == (FT_UA | PF) && len == 0) { // notify the initial SABM command + ESP_LOGW("CMUX", "%d", __LINE__); Scoped l(lock); sabm_ack = dlci; } else if (data == nullptr && dlci > 0) { + ESP_LOGW("CMUX", "%d", __LINE__); int virtual_term = dlci - 1; if (virtual_term < MAX_TERMINALS_NUM && read_cb[virtual_term]) { + ESP_LOGW("CMUX", "%d", __LINE__); #ifdef DEFRAGMENT_CMUX_PAYLOAD read_cb[virtual_term](payload_start, total_payload_size); #endif } else { + ESP_LOGW("CMUX", "%d", __LINE__); return false; } } else if ((type & FT_UIH) == FT_UIH && dlci == 0) { // notify the internal DISC command + ESP_LOG_BUFFER_HEXDUMP("type 0xEF", data, len, ESP_LOG_INFO); if (len > 0 && (data[0] & 0xE1) == 0xE1) { + ESP_LOGW("CMUX", "%d", __LINE__); // Not a DISC, ignore (MSC frame) return true; } + ESP_LOGW("CMUX", "%d", __LINE__); Scoped l(lock); sabm_ack = dlci; } else { + ESP_LOGW("CMUX", "%d", __LINE__); return false; } + ESP_LOGW("CMUX", "%d", __LINE__); return true; } @@ -234,6 +246,7 @@ bool CMux::on_header(CMuxFrame &frame) // since CRC could be evaluated after the frame payload gets received if (dlci > MAX_TERMINALS_NUM || (frame_header[1] & 0x01) == 0 || (((type & FT_UIH) != FT_UIH) && type != (FT_UA | PF) ) ) { + ESP_LOGI("CMUX", "[1]:%02x [2]:%02x [3]:%02x", frame_header[1], frame_header[2], frame_header[3]); recover_protocol(protocol_mismatch_reason::UNEXPECTED_HEADER); return true; } @@ -340,7 +353,7 @@ bool CMux::on_cmux_data(uint8_t *data, size_t actual_len) actual_len = term->read(data, buffer.size); #endif } - ESP_LOG_BUFFER_HEXDUMP("CMUX Received", data, actual_len, ESP_LOG_VERBOSE); + ESP_LOG_BUFFER_HEXDUMP("CMUX Received", data, actual_len, ESP_LOG_INFO); CMuxFrame frame = { .ptr = data, .len = actual_len }; while (frame.len > 0) { switch (state) {