EM9291 in Linux Preventing Shutdown

No, I don’t see any USB interfaces enumerated. I kept the system in PCIe mode since putting the module USB mode causes issues with the PCIe bus.

I was able to get the PCIe driver to compile so I used that. Only reference I see to cdc is here:

sudo dmesg | grep cdc
[    3.509156] usbcore: registered new interface driver cdc_wdm
[    3.512541] usbcore: registered new interface driver cdc_ether
[    3.516899] usbcore: registered new interface driver cdc_ncm
[    3.518707] usbcore: registered new interface driver cdc_mbim
[    3.921939] Modules linked in: sunrpc rapl intel_cstate btmtk bluetooth intel_uncore processor_thermal_mbox mei spi_intel_pci soundcore i2c_i801 cec wmi_bmof int340x_thermal_zone spi_intel i2c_smbus intel_soc_dts_iosf intel_pmc_core intel_vsec int3400_thermal pmt_telemetry fjes(-) pmt_class acpi_thermal_rel acpi_tad acpi_pad mhi_pci_semtech(OE) qcserial(OE) qmi_wwan(OE) usb_wwan(OE) cdc_mbim cdc_ncm cdc_ether cdc_wdm usbnet mii ath11k_pci(OE) mhi(OE) ath11k(OE) mac80211 libarc4 cfg80211 rfkill qmi_helpers nfnetlink overlay xfs nvme_tcp crct10dif_pclmul crc32_pclmul crc32c_intel nvme_fabrics polyval_clmulni nvme polyval_generic nvme_keyring nvme_core ghash_clmulni_intel sha512_ssse3 sha256_ssse3 igc sha1_ssse3 wdat_wdt nvme_auth video wmi pinctrl_tigerlake be2iscsi bnx2i cnic uio cxgb4i cxgb4 tls cxgb3i cxgb3 mdio libcxgbi libcxgb qla4xxx iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables fuse dm_multipath

Here are the VIDs/PIDs in dmesg

$ sudo dmesg | grep idP
[    0.552359] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.11
[    0.552475] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.11
[    0.554581] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.11
[    0.555896] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.11
[    0.928293] usb 3-7: New USB device found, idVendor=0cf3, idProduct=e600, bcdDevice= 0.01

I can see the /dev/wwan0qmi0 and /dev/wwan0mbim0 interface in your log

Have you tried with those interfaces?

I’ve used qmicli to talk to wwan0mbim0 and it seems to be working. Can I use this in this command?
sudo qmicli -p --device=/dev/wwan0mbim0 --loc-start --client-no-release-cid --loc-session-id=53

if you can get the NMEA frame, then it should be fine

I tried that, but it didn’t work fully:

$ sudo qmicli -p --device=/dev/wwan0mbim0 --loc-start --client-no-release-cid --loc-session-id=53
[/dev/wwan0mbim0] Successfully started location tracking (session id 53)
[/dev/wwan0mbim0] Client ID not released:
        Service: 'loc'
            CID: '1'
$ sudo qmicli -p --device=/dev/wwan0mbim0 --loc-follow-nmea --client-cid=1 --client-no-release-cid --loc-session-id=53
error: could not register location tracking events: QMI protocol error (48): 'InvalidArgument'
[/dev/wwan0mbim0] Client ID not released:
        Service: 'loc'
            CID: '1'

Just found that those instruction above is for EM919x only
For EM9291, it no longer supports generating NMEA sentences in QMI LOC.

Instead, you can follow the procedure below:

  1. Download the MBPL SDK MBPL_SDK_R41_ENG4-lite.bin.tar.gz

https://source.sierrawireless.com/resources/airprime/software/mbpl/mbpl-software-latest/#sthash.ZXRwiiKx.dpbs

  1. extract it and run the sample application lite-qmi-loc in 1st terminal:

owner@CNHKG-EX-001367:~/QMI/MBPL/R41/MBPL_SDK_R41_ENG4-lite.bin/SampleApps/lite-qmi-loc$ sudo ./bin/lite-qmi-lochostx86_64  -d /dev/cdc-wdm0 -m
  1. choose option 36 to send NMEA sentences to a virtual serial port

  2. now open a new terminal as the 2nd terminal and run sudo “socat -d -d -v pty,raw,echo=0 pty,raw,echo=0”


owner@CNHKG-EX-001367:~/QMI/MBPL/R30/MBPL_SDK_R30_ENG6-lite.src/SampleApps/lite-qmi-dms$ sudo socat -d -d -v pty,raw,echo=0 pty,raw,echo=0
2024/10/29 14:37:00 socat[28944] N PTY is /dev/pts/19
2024/10/29 14:37:00 socat[28944] N PTY is /dev/pts/20
2024/10/29 14:37:00 socat[28944] N starting data transfer loop with FDs [5,5] and [7,7]
  1. go back to 1st terminal and type the second virtual port which is 20 in my example above

  2. now open a new terminal as the 3rd terminal and run the following to output the message in 1st virtual port which is /dev/pts/19 in my example:

owner@CNHKG-EX-001367:~$ sudo chmod 777 /dev/pts/19
owner@CNHKG-EX-001367:~$ sudo cat < /dev/pts/19
  1. go back to 1st terminal and type “CSI=ab,CT=1,SID=1,FR=1,HAL=2,IRS=1,MI=2000”

  2. in 1st terminal, type “SID=1”

  3. Now you will see the NMEA frame appears in the 3rd terminal which is the 1st virtual port /dev/pts/19 in my example:


owner@CNHKG-EX-001367:~$ sudo cat < /dev/pts/19
$ GPGSA,A,1,,,,,,,,,,,,,,,,*32
$ GPVTG,,T,,M,,N,,K,N*2C
$ GPDTM,W84,,0000.000000,N,00000.000000,E,0.000,W84*5F
$ GPRMC,000000.00,V,,,,,,,010170,,,N,V*00
$ GPGNS,000000.00,,,,,NNNNNN,00,,,,,,V*19
$ GPGGA,000000.00,,,,,0,00,,,,,,,,*64
$ GPGSA,A,1,,,,,,,,,,,,,,,,*32
$ GPVTG,,T,,M,,N,,K,N*2C
$ GPDTM,W84,,0000.000000,N,00000.000000,E,0.000,W84*5F
$ GPRMC,000000.00,V,,,,,,,010170,,,N,V*00
$ GPGNS,000000.00,,,,,NNNNNN,00,,,,,,V*19
$ GPGGA,000000.00,,,,,0,00,,,,,,,,*64
$ GPGSA,A,1,,,,,,,,,,,,,,,,*32

Please note that the above test is done in EM9291 USB MBIM interface with FW 02.15.08.00.

I was able to get GPS working per your instructions. However, it stopped working after a few seconds. I can troubleshoot this later.

I tried loading firmware to the device, and was sucessful twice, but now it does not seem to work.

To load the firmware, I would issues AT!BOOTHOLD and then run the following command.

$ sudo ./fw-download-toolhostx86_64 -c MBIM -d /dev/mhi0_SAHARA -f Images/tmo/ -t 3 -w SWIX65C_02.15.01.00.cwe -n SWIX65C_02.15.01.00_TMO_030.017_000.nvu
Application version: 1.0.2405.0
INFO: QDL Port: /dev/mhi0_SAHARA
INFO: Device Path:
INFO: Device Port: 0-0
INFO: FW Path: Images/tmo/
Target image Info:
Carrier    :TMO
FW Version :02.15.01.00
Model ID   :SWIX65C
Package ID :000
PRI Version:030.017
SKU        :9999999
Modem is already in QDL mode. Continuing FW download.
Waiting for modem to come up in BOOT and HOLD mode ...
BOOT and HOLD Mode. Downloading firmware ...
Downloading: Images/tmo//SWIX65C_02.15.01.00_TMO_030.017_000.nvu
Downloading: Images/tmo//SWIX65C_02.15.01.00.cwe
All image data was downloaded successfully.
Device is about to reset ...
Waiting for modem to come up in ONLINE mode ...
^C

However, now when I try AT!BOOTHOLD the /dev/mhi0_SAHARA device does not come up. The device simply reboots after about 30 seconds.

Actually, after about 15 tries, the system decided to take firmware again. I’m not sure what interaction is causing it.

I’ve moved on to trying to send an SMS, but again had some issues. I used the application lite-qmi-smshostx86_64 with both a T-Mobile and a Verizon SIM. When I tried to send with T-Mobile, I had the T-Mobile SWIX65C_02.15.01.00.cwe and SWIX65C_02.15.01.00_TMO_030.017_000.nvu loaded. When I tried with the Verizon SIM I had SWIX65C_02.17.08.00.cwe and SWIX65C_02.17.08.00_VERIZON_030.090_000.nvu loaded.

For T-Mobile, I get the following errors:

sudo ./lite-qmi-smshostx86_64 -m -d /dev/wwan0mbim0
Open transport "/dev/wwan0mbim0" on USB device in MBIM mode

Please select one of the following options or press 'q' to exit:

    1.  Register for Sms Notification
    2.  Query SMS Service Center
    3.  Set SMS Service Center
    4.  Query SMS List
    5.  Query SMS Item
    6.  Delete SMS
    7.  Send SMS
    8.  Send SMS CDMA
    9.  Get SMS Routes
    10. Set SMS Routes
    (q)uit to exit:
1
RegisterSmsServiceCallbacks ret: 0 Mask: 0x00000004


 7
Enter phone number: 1609XXXXXX
Asynchronous Send: 0|1
0
Enter text message:
ooo
Phone Number: 1609XXXXXX
Message: ooo

SendSmsPdu errorCode: 110 - Unknown Error Code
SMS successfully sent.

2
QuerySmsServiceCenter ret: 0 Mask: 0x00000006

SMS service center number: +12063130004
SMS service center type: 145

For Verizon I get the following:

 sudo ./lite-qmi-smshostx86_64 -d /dev/wwan0mbim0 -m
Open transport "/dev/wwan0mbim0" on USB device in MBIM mode

Please select one of the following options or press 'q' to exit:

    1.  Register for Sms Notification
    2.  Query SMS Service Center
    3.  Set SMS Service Center
    4.  Query SMS List
    5.  Query SMS Item
    6.  Delete SMS
    7.  Send SMS
    8.  Send SMS CDMA
    9.  Get SMS Routes
    10. Set SMS Routes
    (q)uit to exit:
7
Enter phone number: 1609XXXXXX
Asynchronous Send: 0|1
0
Enter text message:
Hello
Phone Number: 1609XXXXXXX
Message: Hello
SendSmsPdu errorCode: 1048 - A specified argument is invalid
SMS successfully sent.

2
QuerySmsServiceCenter ret: 0 Mask: 0x00000006

SMS service center number: +19037029920
SMS service center type: 145

8

Enter phone number:
1609XXXXXXXX
Urgent: 0|1 or enter to continue

Delivery Acknowledgement: 0|1 or enter to continue

Enter text message:
hello
Sending: "hello" to: "1609XXXXXXX"
SendSmsPdu errorCode: 1047 - Unknown error
SMS successfully sent.

there is no need to type AT!BOOTHOLD for firmware upgrade…

have you tried to send SMS with AT command first? (e.g. +CMGS)

BTW, please open a new topic, your question now is no longer related to the title…