Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of Simple CMUX Client Library with CAVLI C16QS Modem (IDFGH-12078) #507

Closed
3 tasks done
Noushadalik opened this issue Feb 8, 2024 · 22 comments · Fixed by #688
Closed
3 tasks done

Comments

@Noushadalik
Copy link

Noushadalik commented Feb 8, 2024

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

Hi,
The purpose of this issue is to assess the compatibility of the Simple CMUX Client Library with the CAVLI C16QS Modem. Additionally, an application note for CMUX integration on the CAVLI C16QS Modem (based on 3GPP 27.010) has been provided for reference
@david-cermak

C16QS CMUX Application Note1.0.pdf

@github-actions github-actions bot changed the title Compatibility of Simple CMUX Client Library with CAVLI C16QS Modem Compatibility of Simple CMUX Client Library with CAVLI C16QS Modem (IDFGH-12078) Feb 8, 2024
@Noushadalik
Copy link
Author

HI,
Any update?

@david-cermak
Copy link
Collaborator

Hi @Noushadalik

Have you tried this library with your modem?
Looking at the Application Note, it looks like it should support the basic functionality of using DLC1 and DLC2 as either AT or data channel.
Unfortunately, I do not have this device with me to test it.

If you experience a specific problem, please report it here, with verbose logging enabled. (we were able to fix many issues in the past just by analyzing generic issue reports)

@Noushadalik
Copy link
Author

HELLO @david-cermak

I changed the AT command to enable CMUX (from AT+CMUX=0 to AT+CMUX=1) as per the CAVLI C16QS modem CMUX application note.
image

But I can't enter CMUX mode. Detailed verbose logs are attached below

`I (1680) cmux_example: GSM POWER Off !!
I (5690) cmux_example: GSM POWER ON !!
I (7190) cmux_example: not set_flow_control, because 2-wire mode active.
V (7190) command_lib: set_cmux
V (7190) command_lib: generic_command_common
V (7190) command_lib: generic_command
D (7190) command_lib: generic_command command AT+CMUX=1

D (7200) command_lib: Response: ^boot.rom'v

V (7300) CMUX Received: 0x3ffbf90c f9 03 73 01 d7 f9 |..s...|
D (7300) CMUX: Payload frame: dlci:00 type:73 payload:0 available:2
V (7310) CMUX Received: 0x3ffbf90c f9 07 3f 01 de f9 |..?...|
D (7310) CMUX: Payload frame: dlci:01 type:3f payload:0 available:2
V (7320) CMUX Received: 0x3ffbf90c f9 07 ef 27 0d 0a 52 44 59 0d 0a 0d 0a 2b 41 54 |...'..RDY....+AT|
V (7330) CMUX Received: 0x3ffbf91c 52 45 41 44 59 0d 0a eb f9 |READY....|
D (7340) CMUX: Payload frame: dlci:01 type:ef payload:19 available:21
E (8350) cmux_example: Failed to configure multiplexed command mode... exiting
V (8350) intr_alloc: esp_intr_free: Disabling int, killing handler
D (8350) event: deleted loop 0x3ffba760`

@Noushadalik
Copy link
Author

Hi @david-cermak
Any update?

@Noushadalik
Copy link
Author

hello @david-cermak
Any update Today?

@david-cermak
Copy link
Collaborator

Thanks for testing this and sorry for the delay.

From the log, I can see that the device successfully switched to CMUX protocol, but failed later, probably trying to get one channel into data mode. This could be also related to the fact, that you've set the CMUX mode directly after powering the device up.

Could you please try to run the console example (with the modified command library) and try to run these commands?

} else if (mode == "CMUX1") {
dev_mode = esp_modem::modem_mode::CMUX_MANUAL_MODE;
} else if (mode == "CMUX2") {
dev_mode = esp_modem::modem_mode::CMUX_MANUAL_EXIT;
} else if (mode == "CMUX3") {
dev_mode = esp_modem::modem_mode::CMUX_MANUAL_SWAP;
} else if (mode == "CMUX4") {
dev_mode = esp_modem::modem_mode::CMUX_MANUAL_DATA;
} else if (mode == "CMUX5") {
dev_mode = esp_modem::modem_mode::CMUX_MANUAL_COMMAND;

Especially CMUX1 (which would only switch to cmux protocol without any additional channel processing)
CMUX2 would probably fail (cmux exit is usually very device specific) and share the verbose logs again.

The expected behavior would be

  1. set_mode CMUX1 -> manually switched to the CMUX mode
  2. cmd AT -> expect OK on DLCI1
  3. set_mode CMUX3 -> swap the channels
  4. cmd AT -> expect OK on DLC2
  5. set_mode CMUX4 -> expect using the DLCI2 as the network channel with PPP protocol (might fail, but would reveal the reason in the logs)

@Noushadalik
Copy link
Author

hi @david-cermak
Sorry for the delay.
We tested the Modem console example with our CAVLI16QS modem. We can't set the cmux mode by using the "set_mode CMUX1" command.
The responses are attached below.

image

@Noushadalik
Copy link
Author

hi @david-cermak
Please let me know if any updates are available.

@david-cermak
Copy link
Collaborator

david-cermak commented Mar 18, 2024

Hi @Noushadalik

What I meant was using the console application to interact with the device (not updating the app to send these commands):

  1. Update the command library to use AT+CMUX=1 (as you already did)
  2. Use the console application as is and wait for the device to boot up
  3. Send commands and share replies (as mentioned above in Compatibility of Simple CMUX Client Library with CAVLI C16QS Modem (IDFGH-12078) #507 (comment))

The interaction should look something like:

cmux

PS: Not sure if the VS code console allows you to type in commands, but you can use any other Windows terminal...

PPS: I've already ordered an evaluation board with this modem, so I'll take a look into it

@Noushadalik
Copy link
Author

Noushadalik commented Mar 18, 2024

Hi,
@david-cermak

As per your instructions, we tested the Modem console on Putty and waited for the device to boot up. The detailed logs are attached below.

Steps to reproduce:

  1. Download console example code
  2. Update the command library to use AT+CMUX=1
  3. Build the code and flash to ESP
  4. Open Putty and check the following commands
    set_mode CMUX1 -
    cmd AT -
    set_mode CMUX3 -
    cmd AT -
    set_mode CMUX4 -
I (27) boot: ESP-IDF v4.4.3-dirty 2nd stage bootloader
I (27) boot: compile time 12:43:40
I (27) boot: chip revision: 1
I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (74) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (82) boot:  2 factory          factory app      00 00 00010000 00100000
I (89) boot: End of partition table
I (94) boot_comm: chip revision: 1, min. application chip revision: 0
I (101) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=211e4h (135652)                                                                              map
I (158) esp_image: segment 1: paddr=0003120c vaddr=3ff80063 size=00008h (     8)                                                                              load
I (159) esp_image: segment 2: paddr=0003121c vaddr=3ffb0000 size=02510h (  9488)                                                                              load
I (168) esp_image: segment 3: paddr=00033734 vaddr=40080000 size=0c8e4h ( 51428)                                                                              load
I (194) esp_image: segment 4: paddr=00040020 vaddr=400d0020 size=7b55ch (505180)                                                                              map
I (377) esp_image: segment 5: paddr=000bb584 vaddr=4008c8e4 size=01c2ch (  7212)                                                                              load
I (380) esp_image: segment 6: paddr=000bd1b8 vaddr=400c0000 size=00064h (   100)                                                                              load
I (383) esp_image: segment 7: paddr=000bd224 vaddr=50000000 size=00028h (    40)                                                                              load
I (398) boot: Loaded app from partition at offset 0x10000
I (398) boot: Disabling RNG early entropy source...
I (414) cpu_start: Pro cpu up.
D (414) efuse: In EFUSE_BLK0__DATA3_REG is used 1 bits starting with 15 bit
D (414) efuse: In EFUSE_BLK0__DATA5_REG is used 1 bits starting with 20 bit
D (421) efuse: In EFUSE_BLK0__DATA3_REG is used 3 bits starting with 9 bit
D (428) efuse: In EFUSE_BLK0__DATA3_REG is used 1 bits starting with 2 bit
I (435) cpu_start: Starting app cpu, entry point is 0x40081484
I (0) cpu_start: App cpu up.
D (449) clk: RTC_SLOW_CLK calibration value: 3149018
I (461) cpu_start: Pro cpu start user code
I (461) cpu_start: cpu freq: 160000000
I (461) cpu_start: Application information:
I (466) cpu_start: Project name:     modem-console
I (471) cpu_start: App version:      v4.4.3-dirty
I (477) cpu_start: Compile time:     Mar 18 2024 12:42:52
I (483) cpu_start: ELF file SHA256:  97a3d23437bfc22e...
I (489) cpu_start: ESP-IDF:          v4.4.3-dirty
V (494) memory_layout: reserved range is 0x3f4211cc - 0x3f421204
D (500) memory_layout: Checking 7 reserved memory ranges:
D (506) memory_layout: Reserved memory range 0x3ffae000 - 0x3ffae6e0
D (512) memory_layout: Reserved memory range 0x3ffb0000 - 0x3ffb3fd0
D (519) memory_layout: Reserved memory range 0x3ffe0000 - 0x3ffe0440
D (525) memory_layout: Reserved memory range 0x3ffe3f20 - 0x3ffe4350
D (531) memory_layout: Reserved memory range 0x40070000 - 0x40078000
D (538) memory_layout: Reserved memory range 0x40078000 - 0x40080000
D (544) memory_layout: Reserved memory range 0x40080000 - 0x4008e510
D (551) memory_layout: Building list of available memory regions:
V (557) memory_layout: Examining memory region 0x3ffae000 - 0x3ffb0000
V (563) memory_layout: Start of region 0x3ffae000 - 0x3ffb0000 overlaps reserved                                                                              0x3ffae000 - 0x3ffae6e0
D (573) memory_layout: Available memory region 0x3ffae6e0 - 0x3ffb0000
V (580) memory_layout: Examining memory region 0x3ffb0000 - 0x3ffb8000
V (586) memory_layout: Start of region 0x3ffb0000 - 0x3ffb8000 overlaps reserved                                                                              0x3ffb0000 - 0x3ffb3fd0
D (596) memory_layout: Available memory region 0x3ffb3fd0 - 0x3ffb8000
V (602) memory_layout: Examining memory region 0x3ffb8000 - 0x3ffc0000
D (609) memory_layout: Available memory region 0x3ffb8000 - 0x3ffc0000
V (616) memory_layout: Examining memory region 0x3ffc0000 - 0x3ffc2000
D (622) memory_layout: Available memory region 0x3ffc0000 - 0x3ffc2000
V (629) memory_layout: Examining memory region 0x3ffc2000 - 0x3ffc4000
D (635) memory_layout: Available memory region 0x3ffc2000 - 0x3ffc4000
V (642) memory_layout: Examining memory region 0x3ffc4000 - 0x3ffc6000
D (649) memory_layout: Available memory region 0x3ffc4000 - 0x3ffc6000
V (655) memory_layout: Examining memory region 0x3ffc6000 - 0x3ffc8000
D (662) memory_layout: Available memory region 0x3ffc6000 - 0x3ffc8000
V (668) memory_layout: Examining memory region 0x3ffc8000 - 0x3ffca000
D (675) memory_layout: Available memory region 0x3ffc8000 - 0x3ffca000
V (682) memory_layout: Examining memory region 0x3ffca000 - 0x3ffcc000
D (688) memory_layout: Available memory region 0x3ffca000 - 0x3ffcc000
V (695) memory_layout: Examining memory region 0x3ffcc000 - 0x3ffce000
D (701) memory_layout: Available memory region 0x3ffcc000 - 0x3ffce000
V (708) memory_layout: Examining memory region 0x3ffce000 - 0x3ffd0000
D (715) memory_layout: Available memory region 0x3ffce000 - 0x3ffd0000
V (721) memory_layout: Examining memory region 0x3ffd0000 - 0x3ffd2000
D (728) memory_layout: Available memory region 0x3ffd0000 - 0x3ffd2000
V (734) memory_layout: Examining memory region 0x3ffd2000 - 0x3ffd4000
D (741) memory_layout: Available memory region 0x3ffd2000 - 0x3ffd4000
V (747) memory_layout: Examining memory region 0x3ffd4000 - 0x3ffd6000
D (754) memory_layout: Available memory region 0x3ffd4000 - 0x3ffd6000
V (761) memory_layout: Examining memory region 0x3ffd6000 - 0x3ffd8000
D (767) memory_layout: Available memory region 0x3ffd6000 - 0x3ffd8000
V (774) memory_layout: Examining memory region 0x3ffd8000 - 0x3ffda000
D (780) memory_layout: Available memory region 0x3ffd8000 - 0x3ffda000
V (787) memory_layout: Examining memory region 0x3ffda000 - 0x3ffdc000
D (794) memory_layout: Available memory region 0x3ffda000 - 0x3ffdc000
V (800) memory_layout: Examining memory region 0x3ffdc000 - 0x3ffde000
D (807) memory_layout: Available memory region 0x3ffdc000 - 0x3ffde000
V (813) memory_layout: Examining memory region 0x3ffde000 - 0x3ffe0000
D (820) memory_layout: Available memory region 0x3ffde000 - 0x3ffe0000
V (827) memory_layout: Examining memory region 0x3ffe0000 - 0x3ffe4000
V (833) memory_layout: Start of region 0x3ffe0000 - 0x3ffe4000 overlaps reserved                                                                              0x3ffe0000 - 0x3ffe0440
V (843) memory_layout: End of region 0x3ffe0440 - 0x3ffe4000 overlaps reserved 0                                                                             x3ffe3f20 - 0x3ffe4350
D (852) memory_layout: Available memory region 0x3ffe0440 - 0x3ffe3f20
V (859) memory_layout: Examining memory region 0x3ffe4000 - 0x3ffe8000
V (865) memory_layout: Start of region 0x3ffe4000 - 0x3ffe8000 overlaps reserved                                                                              0x3ffe3f20 - 0x3ffe4350
D (875) memory_layout: Available memory region 0x3ffe4350 - 0x3ffe8000
V (882) memory_layout: Examining memory region 0x3ffe8000 - 0x3fff0000
D (888) memory_layout: Available memory region 0x3ffe8000 - 0x3fff0000
V (895) memory_layout: Examining memory region 0x3fff0000 - 0x3fff8000
D (901) memory_layout: Available memory region 0x3fff0000 - 0x3fff8000
V (908) memory_layout: Examining memory region 0x3fff8000 - 0x3fffc000
D (914) memory_layout: Available memory region 0x3fff8000 - 0x3fffc000
V (921) memory_layout: Examining memory region 0x3fffc000 - 0x40000000
D (928) memory_layout: Available memory region 0x3fffc000 - 0x40000000
V (934) memory_layout: Examining memory region 0x40070000 - 0x40078000
V (941) memory_layout: Region 0x40070000 - 0x40078000 inside of reserved 0x40070                                                                             000 - 0x40078000
V (950) memory_layout: Examining memory region 0x40078000 - 0x40080000
V (956) memory_layout: Region 0x40078000 - 0x40080000 inside of reserved 0x40078                                                                             000 - 0x40080000
V (965) memory_layout: Examining memory region 0x40080000 - 0x40082000
V (972) memory_layout: Region 0x40080000 - 0x40082000 inside of reserved 0x40080                                                                             000 - 0x4008e510
V (981) memory_layout: Examining memory region 0x40082000 - 0x40084000
V (987) memory_layout: Region 0x40082000 - 0x40084000 inside of reserved 0x40080                                                                             000 - 0x4008e510
V (996) memory_layout: Examining memory region 0x40084000 - 0x40086000
V (1003) memory_layout: Region 0x40084000 - 0x40086000 inside of reserved 0x4008                                                                             0000 - 0x4008e510
V (1012) memory_layout: Examining memory region 0x40086000 - 0x40088000
V (1018) memory_layout: Region 0x40086000 - 0x40088000 inside of reserved 0x4008                                                                             0000 - 0x4008e510
V (1027) memory_layout: Examining memory region 0x40088000 - 0x4008a000
V (1034) memory_layout: Region 0x40088000 - 0x4008a000 inside of reserved 0x4008                                                                             0000 - 0x4008e510
V (1043) memory_layout: Examining memory region 0x4008a000 - 0x4008c000
V (1050) memory_layout: Region 0x4008a000 - 0x4008c000 inside of reserved 0x4008                                                                             0000 - 0x4008e510
V (1059) memory_layout: Examining memory region 0x4008c000 - 0x4008e000
V (1065) memory_layout: Region 0x4008c000 - 0x4008e000 inside of reserved 0x4008                                                                             0000 - 0x4008e510
V (1074) memory_layout: Examining memory region 0x4008e000 - 0x40090000
V (1081) memory_layout: Start of region 0x4008e000 - 0x40090000 overlaps reserve                                                                             d 0x40080000 - 0x4008e510
D (1090) memory_layout: Available memory region 0x4008e510 - 0x40090000
V (1097) memory_layout: Examining memory region 0x40090000 - 0x40092000
D (1104) memory_layout: Available memory region 0x40090000 - 0x40092000
V (1111) memory_layout: Examining memory region 0x40092000 - 0x40094000
D (1117) memory_layout: Available memory region 0x40092000 - 0x40094000
V (1124) memory_layout: Examining memory region 0x40094000 - 0x40096000
D (1131) memory_layout: Available memory region 0x40094000 - 0x40096000
V (1137) memory_layout: Examining memory region 0x40096000 - 0x40098000
D (1144) memory_layout: Available memory region 0x40096000 - 0x40098000
V (1151) memory_layout: Examining memory region 0x40098000 - 0x4009a000
D (1157) memory_layout: Available memory region 0x40098000 - 0x4009a000
V (1164) memory_layout: Examining memory region 0x4009a000 - 0x4009c000
D (1171) memory_layout: Available memory region 0x4009a000 - 0x4009c000
V (1177) memory_layout: Examining memory region 0x4009c000 - 0x4009e000
D (1184) memory_layout: Available memory region 0x4009c000 - 0x4009e000
V (1191) memory_layout: Examining memory region 0x4009e000 - 0x400a0000
D (1197) memory_layout: Available memory region 0x4009e000 - 0x400a0000
I (1204) heap_init: Initializing. RAM available for dynamic allocation:
D (1211) heap_init: New heap initialised at 0x3ffae6e0
I (1217) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (1223) heap_init: New heap initialised at 0x3ffb3fd0
I (1228) heap_init: At 3FFB3FD0 len 0002C030 (176 KiB): DRAM
I (1234) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1241) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (1247) heap_init: New heap initialised at 0x4008e510
I (1252) heap_init: At 4008E510 len 00011AF0 (70 KiB): IRAM
V (1259) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1265) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0xE
D (1273) intr_alloc: Connected src 46 to int 2 (cpu 0)
D (1279) FLASH_HAL: extra_dummy: 1
V (1282) memspi: raw_chip_id: 16405E

V (1286) memspi: chip_id: 5E4016

V (1289) memspi: raw_chip_id: 16405E

V (1293) memspi: chip_id: 5E4016

D (1296) spi_flash: trying chip: issi
D (1300) spi_flash: trying chip: gd
D (1304) spi_flash: trying chip: mxic
D (1308) spi_flash: trying chip: winbond
D (1312) spi_flash: trying chip: generic
I (1316) spi_flash: detected chip: generic
I (1320) spi_flash: flash io: dio
D (1324) cpu_start: calling init function: 0x401322e8
D (1329) cpu_start: calling init function: 0x4013220c
D (1335) cpu_start: calling init function: 0x400ec8d4
D (1340) cpu_start: calling init function: 0x400e3b08
D (1345) cpu_start: calling init function: 0x400da778
D (1350) cpu_start: calling init function: 0x400da058
D (1355) cpu_start: calling init function: 0x400d3884
D (1360) cpu_start: calling init function: 0x400d2b98
V (1365) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1372) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0xC02
D (1380) intr_alloc: Connected src 17 to int 3 (cpu 0)
V (1385) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1392) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0x40E
D (1400) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (1405) cpu_start: Starting scheduler on PRO CPU.
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): checking args
V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): Args okay. Resulting flags                                                                              0x40E
D (10) intr_alloc: Connected src 25 to int 2 (cpu 1)
I (10) cpu_start: Starting scheduler on APP CPU.
D (1455) heap_init: New heap initialised at 0x3ffe0440
D (1455) heap_init: New heap initialised at 0x3ffe4350
V (1465) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1465) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0xE
D (1465) intr_alloc: Connected src 16 to int 12 (cpu 0)
I (1485) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulld                                                                             own: 0| Intr:0
D (1495) partition: Loading the partition table
V (1495) calculated md5: 0x3ffb75b8   f4 ad 4f 45 38 56 4b 5d  74 35 b6 2c 75 b6                                                                              95 24  |..OE8VK]t5.,u..$|
V (1505) stored md5: 0x3f438070   f4 ad 4f 45 38 56 4b 5d  74 35 b6 2c 75 b6 95                                                                              24  |..OE8VK]t5.,u..$|
D (1515) partition: Partition table MD5 verified
D (1545) esp_netif_lwip: LwIP stack has been initialized
D (1545) esp_netif_lwip: esp-netif has been successfully initialized
D (1545) event: running task for loop 0x3ffba550
D (1545) event: created task for loop 0x3ffba550
D (1555) event: created event loop 0x3ffba550
D (1555) esp_netif_objects: esp_netif_add_to_list 0x3ffbb47c
D (1565) esp_netif_objects: esp_netif_add_to_list netif added successfully (tota                                                                             l netifs: 1)
D (1575) esp-netif_lwip-ppp: esp_netif_new_ppp: PPP connection created: 0x3ffbb7                                                                             ac
I (1585) uart: queue free spaces: 30
V (1585) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1595) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0xE
D (1595) intr_alloc: Connected src 35 to int 13 (cpu 0)
I (1605) modem_console: Initializing esp_modem for the SHINY module...
V (1625) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (1625) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting fla                                                                             gs 0xE
D (1635) intr_alloc: Connected src 34 to int 17 (cpu 0)
D (1695) modem_console: Not a deep sleep reset


Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
esp> set_mode CMUX1
I (63895) modem_console: Switching to CMUX1 name...
V (63895) command_lib: set_cmux
V (63895) command_lib: generic_command_common
V (63895) command_lib: generic_command
D (63905) command_lib: generic_command command AT+CMUX=1

E (65525) modem_console: Failed to set the desired mode
Command returned non-zero error code: 0x1 (ERROR)
esp> set_mode CMUX1
I (83045) modem_console: Switching to CMUX1 name...
V (83045) command_lib: set_cmux
V (83045) command_lib: generic_command_common
V (83045) command_lib: generic_command
D (83055) command_lib: generic_command command AT+CMUX=1

D (83065) command_lib: Response: ^boot.rom'v

V (83165) CMUX Received: 0x3ffbe97c   f9 03 73 01 d7 f9                                 |..s...|
D (83165) CMUX: Payload frame: dlci:00 type:73 payload:0 available:2
V (83185) CMUX Received: 0x3ffbe97c   f9 07 3f 01 de f9                                 |..?...|
W (83185) CMUX: Restarting CMUX state machine (reason: 3)
I (83195) CMUX: Protocol recovered
V (83195) CMUX Received: 0x3ffbe97c   f9 07 ef 27 0d 0a 52 44  59 0d 0a 0d 0a 2b 41 54  |...'..RDY....+AT|
V (83205) CMUX Received: 0x3ffbe98c   52 45 41 44 59 0d 0a eb  f9                       |READY....|
D (83215) CMUX: Payload frame: dlci:01 type:ef payload:19 available:21
W (83225) CMUX: Restarting CMUX state machine (reason: 4)
I (83225) CMUX: Protocol recovered
E (84205) modem_console: Failed to set the desired mode
Command returned non-zero error code: 0x1 (ERROR)
esp> cmd AT
I (96995) modem_console: Sending command AT with timeout 1000
E (97995) modem_console: Failed with TIMEOUT
Command returned non-zero error code: 0x1 (ERROR)
esp> set_mode CMUX3
I (123995) modem_console: Switching to CMUX3 name...
I (124005) modem_console: OK
esp> cmd AT
I (131275) modem_console: Sending command AT with timeout 1000
E (132275) modem_console: Failed with TIMEOUT
Command returned non-zero error code: 0x1 (ERROR)
esp> set_mode CMUX4
I (141195) modem_console: Switching to CMUX4 name...
V (141195) command_lib: set_echo
V (141195) command_lib: generic_command_common
V (141195) command_lib: generic_command
D (141205) command_lib: generic_command command ATE0

E (141705) modem_console: Failed to set the desired mode
Command returned non-zero error code: 0x1 (ERROR)
esp>
D (716215) console.repl: empty line
esp>

@david-cermak
Copy link
Collaborator

Thanks for testing this, could you please try to

  • revert the command lib change, so that we use the original AT+CMUX=0 ?
  • try to set CONFIG_ESP_MODEM_CMUX_DELAY_AFTER_DLCI_SETUP to 500 or 1000 to see if anything changed?

@Noushadalik
Copy link
Author

Hi @david-cermak

  1. when AT+CMUX=0

image

  1. when CONFIG_ESP_MODEM_CMUX_DELAY_AFTER_DLCI_SETUP = 500 (AT+CMUX=1)
image
  1. when CONFIG_ESP_MODEM_CMUX_DELAY_AFTER_DLCI_SETUP = 1000 (AT+CMUX=1)
image

@david-cermak
Copy link
Collaborator

Hi @Noushadalik

Thanks for testing this! Could you please remove (or comment out) these few lines?

if (dlci > MAX_TERMINALS_NUM || (frame_header[1] & 0x01) == 0 ||
(((type & FT_UIH) != FT_UIH) && type != (FT_UA | PF) ) ) {
recover_protocol(protocol_mismatch_reason::UNEXPECTED_HEADER);
return true;
}

and test again (with CONFIG_ESP_MODEM_CMUX_DELAY_AFTER_DLCI_SETUP=500 and AT+CMUX=1)

@Noushadalik
Copy link
Author

Hi @david-cermak
Here is the test outcome

image

@david-cermak
Copy link
Collaborator

Nice, we're one step closer.
Could you please apply this patch and try again?

diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp
index b1bfc78..34a87c5 100644
--- a/components/esp_modem/src/esp_modem_cmux.cpp
+++ b/components/esp_modem/src/esp_modem_cmux.cpp
@@ -137,7 +137,7 @@ bool CMux::data_available(uint8_t *data, size_t len)
         } else {
             return false;
         }
-    } else if (data == nullptr && type == (FT_UA | PF) && len == 0) { // notify the initial SABM command
+    } else if (data == nullptr && (type == (FT_UA | PF) || type == 0x3f) && len == 0) { // notify the initial SABM command
         Scoped<Lock> l(lock);
         sabm_ack = dlci;
     } else if (data == nullptr && dlci > 0) {

(and could you please share your results as text only? it's easier for me to go through, copy-paste and is just smaller)

@Noushadalik
Copy link
Author

Hi@david-cermak

Here is the test outcome

cmux_text.txt

@david-cermak
Copy link
Collaborator

Oh, very nice, looks like success already (with a few warnings which i'll fix real quick)
just give me few day to process the changes and come up with a PR, then I'll ask you to test it again.
Thanks for your help!

@Noushadalik
Copy link
Author

Thank you for the update!
Take your time to fix the warnings and prepare the PR. Let me know when you're ready, and I'll test it again.
Your efforts are appreciated!

@david-cermak
Copy link
Collaborator

Hi @Noushadalik

Sorry it takes so long, but it seems like the changes we added to make it working on the CAVLI device are not compliant with cmux/gsm0710 standard.
The app note, you linked above, says the CMUX mode complies to 3GPP TS 27.010, but this spec clearly states (on the SABM response, paragraph 5.4.1) that we should get an UA frame upon success (or DM frame if the counterpart isn't able to establish the channel). But we're getting 0x3F, which is neither of them. And the same frame type is also mentioned in their app note, chapter 3.1, step 3:

F9 07 3F 01 DE F9

(so it's not only an issue of your device or a wrong firmware).

I'm not sure what we should do in this case. I'll add this info to the list of "known issues" for a start, it already mentions some limitations, deviations and patches.

3) Device A7670 does no not correctly exit CMUX mode. You can apply
this patch to adapt the exit sequence https://github.com/espressif/esp-protocols/commit/28de34571012d36f2e87708955dcd435ee5eab70
::
diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp
index 0c480f8..4418c3d 100644
--- a/components/esp_modem/src/esp_modem_cmux.cpp
+++ b/components/esp_modem/src/esp_modem_cmux.cpp
@@ -206,6 +206,15 @@ bool CMux::on_header(CMuxFrame &frame)
}
size_t payload_offset = std::min(frame.len, 4 - frame_header_offset);
memcpy(frame_header + frame_header_offset, frame.ptr, payload_offset);
+ if (frame_header[1] == 0xEF) {
+ dlci = 0;
+ type = frame_header[1];
+ payload_len = 0;
+ data_available(&frame.ptr[0], payload_len); // Notify DISC
+ frame.advance(payload_offset);
+ state = cmux_state::FOOTER;
+ return true;
+ }
if ((frame_header[3] & 1) == 0) {
if (frame_header_offset + frame.len <= 4) {
frame_header_offset += frame.len;

@Noushadalik
Copy link
Author

Hi @david-cermak
can I use the esp_modem component as a component of the esp idf framework on PlatformIO?

@Noushadalik
Copy link
Author

Hi @david-cermak
Any update today?

@david-cermak
Copy link
Collaborator

I'm not very familiar with PlatformIO, but it should be possible based on their docs: https://docs.platformio.org/en/latest/frameworks/espidf.html#esp-idf-components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants