Skip to content

Commit cc2741d

Browse files
committed
fix(modem): Document CMUX compatibility issue with CAVLI C16QS
Closes espressif#507
1 parent c5653ff commit cc2741d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/esp_modem/en/README.rst

+32
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,35 @@ this patch to adapt the exit sequence https://github.com/espressif/esp-protocols
234234
if ((frame_header[3] & 1) == 0) {
235235
if (frame_header_offset + frame.len <= 4) {
236236
frame_header_offset += frame.len;
237+
238+
4) Device CAVLI C16QS does not correctly enter CMUX mode with esp_modem.
239+
The CMUX as defined in 3GPP TS 27.010: SABM response (paragraph 5.4.1)
240+
should be a UA frame (upon success, DM frame on failure).
241+
This device however responds with 0x3F, which is neither UA nor DM.
242+
You can apply the below patch to adapt the entry sequence
243+
244+
::
245+
246+
diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp
247+
index c47e13b..7afbf73 100644
248+
--- a/components/esp_modem/src/esp_modem_cmux.cpp
249+
+++ b/components/esp_modem/src/esp_modem_cmux.cpp
250+
@@ -137,7 +137,8 @@ bool CMux::data_available(uint8_t *data, size_t len)
251+
} else {
252+
return false;
253+
}
254+
- } else if (data == nullptr && type == (FT_UA | PF) && len == 0) { // notify the initial SABM command
255+
+ } else if (data == nullptr && (type == (FT_UA | PF) || type == 0x3f) && len == 0) { // notify the initial SABM command
256+
Scoped<Lock> l(lock);
257+
sabm_ack = dlci;
258+
} else if (data == nullptr && dlci > 0) {
259+
@@ -238,8 +239,7 @@ bool CMux::on_header(CMuxFrame &frame)
260+
type = frame_header[2];
261+
// Sanity check for expected values of DLCI and type,
262+
// since CRC could be evaluated after the frame payload gets received
263+
- if (dlci > MAX_TERMINALS_NUM || (frame_header[1] & 0x01) == 0 ||
264+
- (((type & FT_UIH) != FT_UIH) && type != (FT_UA | PF) ) ) {
265+
+ if (dlci > MAX_TERMINALS_NUM) {
266+
recover_protocol(protocol_mismatch_reason::UNEXPECTED_HEADER);
267+
return true;
268+
}

0 commit comments

Comments
 (0)