CM4 & Sierra EM7345 Modem

I’m testing an M.2 Sierra EM7345 LTE modem on the Oratek Tofu carrier board with a Pi CM4.
I recognize that it’s not an officially tested/supported modem, but thought I might be able to get it to work.

According to ModemManager it is a supported modem:

Sierra Wireless EM7345 0x1199 0xa001 FIH7160_V1.1_MODEM_01.1349.12 Sierra (MBIM) 3GPP

Though as you can see it uses mbim, not qmi which I’m not quite sure how to handle.

When I run lsusb, I can see what looks like it might be modem (its the only external device attached at the moment).

root@5254c10:~# lsusb
Bus 001 Device 001: ID 1d6b:0002

But ModemManager can’t find it - presumably because I need to do some setup with mbim?

root@5254c10:~# mmcli -S
successfully requested to scan devices
root@5254c10:~# mmcli -m 0
error: couldn't find modem

I also noticed that there is an existing udev rule for Sierra modems in BalenaOS, so that is encouraging:

root@5254c10:~# cat /lib/udev/rules.d/77-mm-sierra.rules

# do not edit this file, it will be overwritten on update
ACTION!="add|change|move|bind", GOTO="mm_sierra_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1199", GOTO="mm_sierra"
GOTO="mm_sierra_end"

LABEL="mm_sierra"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInterfaceNumber}"

# Netgear AC341U: enable connection status polling explicitly
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9057", ENV{ID_MM_QMI_CONNECTION_STATUS_POLLING_ENABLE}="1"

# MC74XX: Add port hints
#  if 03: primary port
#  if 02: raw NMEA port
#  if 00: diag/qcdm port
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9071", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9071", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_TYPE_GPS}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9071", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_PORT_TYPE_QCDM}="1"

# EM7565: Add port hints
#  if 03: primary port
#  if 02: raw NMEA port
#  if 00: diag/qcdm port
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_PORT_TYPE_AT_PRIMARY}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_PORT_TYPE_GPS}="1"
ATTRS{idVendor}=="1199", ATTRS{idProduct}=="9091", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_PORT_TYPE_QCDM}="1"

LABEL="mm_sierra_end"

Any tips on which direction to head in order to get ModemManager to see the modem?

Looking at this more, perhaps I have my dtoverly and params incorrectly configured.

According to Oratek:

“The USB interface is disabled to save power by default on the CM4. To enable it you need to add the following to the config.txt file :”

dtoverlay=dwc2,dr_mode=host

Which I interpreted for Balena as this:

But when I cat /mnt/boot/config.txt:

root@5254c10:~# cat /mnt/boot/config.txt
arm_64bit=1
avoid_warnings=1
disable_splash=1
dtoverlay=vc4-fkms-v3d
dtoverlay=dwc2
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on
dtparam=dr_mode=host
gpu_mem=16

The dtparam=dr_mode=host doesn’t seem properly formatted. Shouldnt it just be dr_mode=host?

Hi @barryjump

Please try updating the DT overlay to “vc4-fkms-v3d”, “dwc2,dr_mode=host”

Best,

Thanks for helping.

Here’s what I’ve got in device config settings:

Define DT parameters:  "i2c_arm=on","spi=on","audio=on"

Define DT overlays:  “vc4-fkms-v3d”, “dwc2,dr_mode=host”

But unfortunately it seems now that reverted me back to having an empty lsusb output.

root@5254c10:~# lsusb
root@5254c10:~#

So my mistake not paying close enough attention, but I copied and pasted the exact text above and later noticed that doing so results in malformed quotation marks which was causing the blank lsusb results. Fixed that just now and am back to at least seeing a usb device, though I’m not sure what it actually is.

root@5254c10:~# lsusb
Bus 001 Device 001: ID 1d6b:0002

Unfortunately back at square one.

Ok. Have you tried as an alternative following the instructions to set up the cellular?

What Device Type did you use when flashing the CM4 Barry? Or, is this a custom built Yocto / balenaOS with an Oratek kernel and Device Tree? Also, can you check lsusb -v to see if we get any more detailed information? Are we sure that is the modem, and not the root hub?

Hey David,
No its not a custom Yocto - I don’t have the skills to even begin to understand how to handle device trees (I don’t even fully understand the meaning :slight_smile: )

Instead, I just flashed via etcher with the following:
HOST OS VERSION
balenaOS 2.71.3+rev5
production
SUPERVISOR VERSION
12.8.8

Good tip on lsusb -v. It is indeed the USB hub, not the modem. Heres the full output.

root@5254c10:~# lsusb -v

Bus 001 Device 001: ID 1d6b:0002  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 
  bDeviceSubClass         0 
  bDeviceProtocol         1 
  bMaxPacketSize0        64
  idVendor           0x1d6b 
  idProduct          0x0002 
  bcdDevice            5.04
  iManufacturer           3 Linux 5.4.83-v8 dwc2_hsotg
  iProduct                2 DWC OTG Controller
  iSerial                 1 fe980000.usb
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             1
  wHubCharacteristic 0x0008
    Ganged power switching
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0000
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

Hmmm, it could actually be a PCI device I suppose…try running an lspci and see what shows up there?

In the host container? I dont think its included…

root@5254c10:~# lspci
bash: lspci: command not found

Doh! I did not realize that. Well, if you push a privileged Debian container, you could run it in there I suppose. Might need to apt-get install pciutils if it’s not included by default there, either.

Ah, I should have guessed that.
So I added pcutils using a priviledged version of the wifi-connect container like this…

Dockerfile.template

FROM balenalib/%%BALENA_MACHINE_NAME%%-debian

RUN install_packages dnsmasq wireless-tools pciutils 

WORKDIR /usr/src/app

ARG VERSION="4.4.0"
RUN curl -Ls "https://github.com/balena-io/wifi-connect/releases/download/v$VERSION/wifi-connect-v$VERSION-linux-%%BALENA_ARCH%%.tar.gz" \
  | tar -xvz -C  /usr/src/app/

COPY scripts/start.sh .

CMD ["bash", "start.sh"]

docker-compose.yml

version: "2.1"
services:
    wifi-connect:
        build: ./wifi-connect
        network_mode: "host"
        privileged: true
        labels:
            io.balena.features.dbus: '1'
        cap_add:
            - NET_ADMIN
        environment:
            DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"

And the command returns nothing unfortunately…

root@5254c10:/usr/src/app# lspci
root@5254c10:/usr/src/app#

:cry:

@barryjump it looks like you need a special device tree for this board. But let’s try something else, could you please try to create a new application with no releases only WiFi or Ethernet. And with that, we will try to see if the modem is detected? Could you please share more documentation of the modem?

@mrrobot is this modem compatible with the board?

looking fwd to see this up&running :slight_smile:

@mpous I think you might be right about the custom device tree.

I moved the device to an empty application to get it back to factory build and unfortunately all I see is the USB controller.

root@5254c10:~# lsusb
Bus 001 Device 001: ID 1d6b:0002

Heres a screenshot.

It IS possible that I have a dud modem (there aren’t any LEDs on the modem to confirm power). But my suspicion is that the modem is okay and I just don’t have it configured correctly. Mostly because Oratek says they confirmed tested compatibility with their board.

RE docs, they’re a little hard to find but here’s what I was working from:

just to clarify you don’t see it doing nmcli d or nmcli c right?

It should be interesting to have the manual to see if this is just a library that needs to be upgraded on the OS kernel or that a custom device tree is needed.

Hi,

I have a custom board (CM3 based) with an EM7455; I’m assuming your board will work similar to mine.
In my board the PCIe lines are not connected, but that shouldn’t matter as those pins are NC on the modem itself.
The USB device you’re seeing (1d6b:0002) will also be shown if your m.2 card is powered down.
lsusb -v says this is the OTG Controller.

Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9
  bDeviceSubClass         0
  bDeviceProtocol         1
  bMaxPacketSize0        64
  idVendor           0x1d6b
  idProduct          0x0002
  bcdDevice            4.19
  iManufacturer           3 Linux 4.19.118 dwc_otg_hcd
  iProduct                2 DWC OTG Controller
  iSerial                 1 3f980000.usb
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             1
  wHubCharacteristic 0x0008
    Ganged power switching
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0503 highspeed power enable connect
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

Are you certain your modem is properly powered (at least 3.2V) ?
You can measure this on TP6 if you have the equipment.
The TOFU board requires the 12V (barrel jack or terminal block) to generate the 3V3 that is used for the modem.
If you are powering it through USB-C or PoE, it will not work.

When I power up my modem, I can see the following in dmesg:

[  403.062904] usb 1-1.3: config 1 has an invalid interface number: 8 but max is 4
[  403.070248] usb 1-1.3: config 1 has an invalid interface number: 10 but max is 4
[  403.077728] usb 1-1.3: config 1 has no interface number 1
[  403.083169] usb 1-1.3: config 1 has no interface number 4
[  403.090768] usb 1-1.3: New USB device found, idVendor=1199, idProduct=9071, bcdDevice= 0.06
[  403.099165] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  403.106495] usb 1-1.3: Product: Sierra Wireless EM7455 Qualcomm\xc2\xae Snapdragon\xe2\x84\xa2 X7 LTE-A
[  403.114609] usb 1-1.3: Manufacturer: Sierra Wireless, Incorporated
[  403.120790] usb 1-1.3: SerialNumber: LF83417306031024
[  403.149995] usbcore: registered new interface driver cdc_wdm
[  403.157103] usbcore: registered new interface driver qcserial
[  403.165034] usbserial: USB Serial support registered for Qualcomm USB modem
[  403.173566] qmi_wwan 1-1.3:1.8: cdc-wdm0: USB WDM device
[  403.180010] qmi_wwan 1-1.3:1.8 wwan0: register 'qmi_wwan' at usb-3f980000.usb-1.3, WWAN/QMI device, 3e:24:9b:44:ab:45
[  403.191373] qmi_wwan 1-1.3:1.10: cdc-wdm1: USB WDM device
[  403.198760] qmi_wwan 1-1.3:1.10 wwan1: register 'qmi_wwan' at usb-3f980000.usb-1.3, WWAN/QMI device, 3e:24:9b:44:ab:45
[  403.209872] usbcore: registered new interface driver qmi_wwan
[  403.215824] qcserial 1-1.3:1.0: Qualcomm USB modem converter detected
[  403.224022] usb 1-1.3: Qualcomm USB modem converter now attached to ttyUSB4
[  403.232622] qcserial 1-1.3:1.2: Qualcomm USB modem converter detected
[  403.239438] usb 1-1.3: Qualcomm USB modem converter now attached to ttyUSB5
[  403.250204] qcserial 1-1.3:1.3: Qualcomm USB modem converter detected
[  403.257021] usb 1-1.3: Qualcomm USB modem converter now attached to ttyUSB6
[  444.861969] usb 1-1.3: USB disconnect, device number 6
[  444.867297] qmi_wwan 1-1.3:1.10: nonzero urb status received: -71
[  444.873394] qmi_wwan 1-1.3:1.10: wdm_int_callback - 0 bytes
[  444.878967] qmi_wwan 1-1.3:1.10: wdm_int_callback - usb_submit_urb failed with result -19
[  444.890427] qcserial ttyUSB4: Qualcomm USB modem converter now disconnected from ttyUSB4
[  444.899648] qcserial 1-1.3:1.0: device disconnected
[  444.905921] qcserial ttyUSB5: Qualcomm USB modem converter now disconnected from ttyUSB5
[  444.914293] qcserial 1-1.3:1.2: device disconnected
[  444.919976] qcserial ttyUSB6: Qualcomm USB modem converter now disconnected from ttyUSB6
[  444.928306] qcserial 1-1.3:1.3: device disconnected
[  444.933540] qmi_wwan 1-1.3:1.8 wwan0: unregister 'qmi_wwan' usb-3f980000.usb-1.3, WWAN/QMI device
[  444.983571] qmi_wwan 1-1.3:1.10 wwan1: unregister 'qmi_wwan' usb-3f980000.usb-1.3, WWAN/QMI device

As far as I’m aware, I haven’t explicitly added any drivers or overlays to affect my modem, other than claiming a GPIO to enable/disable power.

2 Likes

Thank you for reminding me! I feel like a fool because I read that in Oratek’s docs and COMPLETELY forgot about it.

Looks like we’re up and running now!

root@5254c10:~# lsusb
Bus 001 Device 003: ID 1199:a001  
Bus 001 Device 002: ID 0424:2514  
Bus 001 Device 001: ID 1d6b:0002  
root@5254c10:~# mmcli -m 0
  -----------------------------
  General  |         dbus path: /org/freedesktop/ModemManager1/Modem/0
           |         device id: 5675b3161b18c519d97d067d0306c851b82640be
  -----------------------------
  Hardware |      manufacturer: Sierra Wireless Inc.
           |             model: Sierra Wireless EM7345 4G LTE
           | firmware revision: FIH7160_V1.2_WW_01.1442.04_VZ
           |      h/w revision: XMM7160_V1.2_MBIM_GNSS_NAND_RE
           |         supported: gsm-umts, lte
           |           current: gsm-umts, lte
           |      equipment id: 013937007110263
  -----------------------------
  System   |            device: /sys/devices/platform/soc/fe980000.usb/usb1/1-1/1-1.1
           |           drivers: cdc_mbim, cdc_acm
           |            plugin: sierra
           |      primary port: cdc-wdm0
           |             ports: cdc-wdm0 (mbim), wwan0 (net), ttyACM0 (at)
  -----------------------------
  Status   |             state: failed
           |     failed reason: sim-missing
           |       power state: on
           |    signal quality: 0% (cached)
  -----------------------------
  Modes    |         supported: allowed: 2g, 3g, 4g; preferred: none
           |           current: allowed: any; preferred: none
  -----------------------------
  IP       |         supported: ipv4, ipv6, ipv4v6

Next step is to get a SIM in there and start setting up a connection.
Can’t thank you enough @TJvV :pray:

@TJvV Im on to the next challenge and perhaps you can advise. Your Sierra modem uses MBIM? I’m noticing that my EM7345 doesnt speak QMI but rather MBIM which I’m not familiar with. It appears that out of the box ModemManager in BalenaOS doesn’t play well with MBIM, unless I’m mistaken.

How did you get your Sierra talking over MBIM? I’m seeing that libmbim is not preinstalled.

Hi @barryjump,

This is a new subject for me as well, so don’t expect me to have all the answers just yet.

I’ve looked into my apt history, and I did install libmbim-utils and libqmi-utils myself.
I’ve found a script that allows me to switch between qmi and mbim.
The same site has a tutorial for setting up your mbim connection.

The switching script should be specific to my modem, but maybe it will work on yours as well.

What I’ve tried just now is to change my modem to mbim.
At first it reported to be running mbim, but didn’t really accept commands; after rebooting it showed up properly.

nmcli d showed the device as disconnected, so I ran nmcli d /dev/cdc-wdm0 connect and it appeared to come up.
Running the command from the tutorial gives me this:

root@df8f8df:/# mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration

[/dev/cdc-wdm0] IPv4 configuration available: 'address, gateway, dns, mtu'
     IP [0]: '10.227.126.115/29'
    Gateway: '10.227.126.116'
    DNS [0]: '194.151.228.34'
    DNS [1]: '194.151.228.18'
        MTU: '1500'

This corresponds with my wwan0 interface as shown:

root@df8f8df:/# ip a s wwan0
8: wwan0: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether 5e:e1:c4:61:51:07 brd ff:ff:ff:ff:ff:ff
    inet 10.227.126.115/29 brd 10.227.126.119 scope global noprefixroute wwan0
       valid_lft forever preferred_lft forever

Testing it out, suggests I can properly send data over it.

root@df8f8df:/# ping 8.8.8.8 -I wwan0
PING 8.8.8.8 (8.8.8.8) from 10.227.126.115 wwan0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=150 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=22.1 ms

If yours doesn’t come online, you may want to check out which profile/APN you have selected.

2 Likes

Wow, nice work here @TJvV – and interesting note on the need for 12v power. :slight_smile: