Problems switching to EXTERNAL_SLOT_2 on WP8548/WP7502

We have the same problem with WP8548 (on mangOH Green, primary CF3) and WP7502 (on our custom board). Using ‘cm sim select’ command we can’t switch to EXTERNAL_SLOT_2. E.g.

login as: root
Linux swi-mdm9x15 3.14.29ltsi-5d7a6bf7c6_ed88cc68b5 #2 PREEMPT Sat Feb 6 02:37:18 PST 2016 armv7l GNU/Linux
root@swi-mdm9x15:~# cm radio
Power: OFF
Current Network Operator:
Status: Not registered and not currently searching for new operator (LE_MRC_REG_NONE)
Signal: No signal strength (0)

root@swi-mdm9x15:~# cm sim info
ICCID: 89701202115300878591
Home Network Operator: Tele2 RU
IMSI: 250202106237359
Phone Number:
root@swi-mdm9x15:~# cm sim select EXTERNAL_SLOT_2
root@swi-mdm9x15:~# cm sim info
Home Network Operator: MegaFon RUS
Phone Number:
root@swi-mdm9x15:~# cm sim
SIM card is absent (LE_SIM_ABSENT).


But when we reboot the board with the EXTERNAL_SLOT_2 selected, ‘cm sim info’ gives us meaningfull information (after reboot completed), ‘cm sim’ reports READY for the second slot and we can establish a connection using ‘cm data connect’ command. When we switch from SLOT_2 to SLOT_1 and back then SIM 2 is reported as ABSENT again (until next reboot). SLOT_1 is always reported as READY.
Could anyone help? Is there a tricky command sequence?
root@swi-mdm9x15:~# cm info firmware
SWI9X15Y_07.12.14.00 r34472 CARMD-EV-FRMWR1 2017/11/29 18:24:42

We faced the same problem. Did you manage to solve it? (Мы столкнулись с такой же проблемой. Вам удалось её решить?)

Yes, we did. Unfortunately, I don’t remember any specific details related to this problem and I don’t have a WP5 hardware to check it. But most likely that this problem had gone with a regular firmware update of WP5. So first of all make sure you have the latest firmware on your WP. Let me know if it doesn’t work for you, I’ll try to help.

We are using the latest version of Legato 20.4.
Firmware Version: SWI9X15Y_07.14.01.00 595652d jenkins 2018/10/26 08:34:29

Seems like one of the updates solved a lot of other problems but not this particular one. CLI still doesn’t work in terms of SIM slot switching.
I’ve pulled the basic algorithm from my project’s code. Here it is.

  1. le_mrc_AddNetRegStateEventHandler(netChangeStateHandler, NULL);
  2. le_sim_SelectCard(desiredSimSlot); // change the sim slot
  3. Wait for 25 seconds to let the sim slot switch (start a timeout timer)
    3.1 While waiting handle net events in netChangeStateHandler(le_mrc_NetRegState_t state, void *contextPtr)
    3.2 netChangeStateHandler(…) MUST include the following line:
    le_sim_Id_t actSimId = le_sim_GetSelectedCard(); // Magic to make it switch to the second SIM slot
    3.3 Also in the handler:
    if (((state == LE_MRC_REG_HOME) || (state == LE_MRC_REG_ROAMING)) && (actSimId == desiredSimSlot))
    // the slot switching procedure completed successfully
    // stop the timeout timer
  4. If the 25s-timer expires then you’re probably dealing with a bad sim card in the slot

In netChangeStateHandler() I also make calls to le_sim_GetHomeNetworkMccMnc(), le_mdc_GetProfile() etc. But I don’t think this significantly affects the SIM slot switching process.
Hope this helps.

Our program logic is very similar. Everything works great as long as both SIM cards are connected. If we leave only one card, then the switch works fine, but le_mdc_StartSession does not complete successfully.

I’m not sure whether your problem is related to my original forum post.
Probably, you should pay more attention to profiles before starting the session.
BTW, I used slightly different approach to iniate a connection le_data_Request/le_data_Release (instead of le_mdc_StartSession/le_mdc_StopSession) to have a bit more control over the connection.
What do logs say why the session fails to start?

modemDaemon[783]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 849 | Sending QMI_WDS_START_NETWORK_INTERFACE_REQ_V01 failed: rc=-3 (Timeout), resp.result=0.[0x00], resp.error=0.[0x00]
modemDaemon[783]/le_pa T=main | pa_mdc_qmi.c StartSession() 1957 | Send qmi timeout.
modemDaemon[783]/le_pa T=main | pa_mdc_qmi.c StartSession() 1994 | Data connection failure reason not available
modemDaemon[783]/modemDaemon T=main | le_mdc.c le_mdc_StartSession() 1304 | Get Async Connection failure 45, 0, 0, 0
The session is not established and the call timed out.
We do not use le _data, because it just does not allow you to fine-tune the profile (set APN, login, password). Perhaps we have not fully understood the documentation.
Please tell us how you get finer control through le_data_Request / le_data_Release?