[HN Gopher] Using 4G LTE wireless modems on a Raspberry Pi
       ___________________________________________________________________
        
       Using 4G LTE wireless modems on a Raspberry Pi
        
       Author : geerlingguy
       Score  : 59 points
       Date   : 2022-01-20 21:00 UTC (2 hours ago)
        
 (HTM) web link (www.jeffgeerling.com)
 (TXT) w3m dump (www.jeffgeerling.com)
        
       | geerlingguy wrote:
       | This blog post has been quite the effort--coming into it I
       | thought I'd just learn some new things, document a simple
       | process, and be done.
       | 
       | But along the way I probably spent 40 hours (and counting) trying
       | to figure out the ins-and-outs of 4G LTE modems and Linux
       | networking when it comes to these oddball devices.
       | 
       | I hope some parts of this post help anyone else new to LTE
       | networking in Linux, and maybe somebody can help clear up some of
       | my open questions, like:
       | 
       | Why doesn't Quectel have any firmware downloads on their site?
       | (And is there any way to get them besides downloading random
       | files posted to forums?)
       | 
       | Is there any advantage to using QMI (`wwan0` / qmi_wwan) vs ECM
       | (`usb0` / cdc_ether)?
       | 
       | Why does it seem there's no real documentation for LTE modems on
       | Linux? What little _good_ information I found was in random
       | presentation slides scattered around the Internet.
       | 
       | Other than that it's either extremely technical documentation
       | pages that expect a very high level of familiarity already, or
       | some very cookie-cutter blog posts that give a walkthrough to get
       | Internet going, but don't really explain anything.
       | 
       | (Also in the course of my research I learned a lot from OSMOCOM's
       | work reverse-engineering some of the LTE modems (including the
       | QC25 I'm using): https://osmocom.org/projects/quectel-
       | modems/wiki/EC25 ).
        
         | rcarmo wrote:
         | Yeah, things have become wildly fragmented since the "plain" 3G
         | modem days, and there are no effective standards for USB multi-
         | point devices (LTE made Ethernet emulation more popular, but
         | weird pseudo-serials to configure them just became... weirder).
        
           | geerlingguy wrote:
           | Heh, when I started researching and found that, yes, uart and
           | AT commands are still the preferred way to interact with
           | these modems, I was wondering if I had time-warped back to
           | the 90s!
        
         | drblah wrote:
         | As someone who as also spent way more hours on LTE/5G modems
         | than I want to, this post resonates with me. I also learned a
         | few things, namely about the ECM. I will have to look into
         | that. Thanks!
         | 
         | As for the firmware. It seems to just be how these companies do
         | things, unfortunately. At work, we use modems from both Quectel
         | and Simcom and the experience described in OP is very similar.
         | For Simcom we have gotten access to a "secret-but-public"
         | Onedrive share with documentation, drivers and firmware where
         | they put up stuff sporadically. Sometimes the firmware updates
         | even works!
         | 
         | I have a theory that Qualcomm who makes the chipsets used by
         | Quectel and Simcom (at least for the 5G modems) imposes some
         | kind of heavy NDA which prevents free distribution of firmware
         | and documentation. Everything seems very "hush, hush" at least.
         | 
         | While I can't help answer your remaining questions, I can point
         | to wiki I have found really helpful:
         | http://trac.gateworks.com/wiki/wireless/modem
        
         | pd0wm wrote:
         | Have you experimented with modemmanager/networkmanager to
         | handle the configuration of the modem? For me that has worked
         | quite reliably across a pretty large fleet of devices with a
         | Quectel EG25 (qmi over usb).
         | 
         | Regarding FW updates, have you tried opening a support ticket
         | with Quectel? For me they have been extremely responsive and
         | helpful, providing extra documentation on special AT commands
         | and stuff.
        
           | geerlingguy wrote:
           | I have not--that was what I was trying (mmcli) early on in my
           | exploration, but I kept hitting speedbumps, so switched gears
           | to configuring the modem over TTY and using QMI utils
           | directly.
           | 
           | I would like to use modemmanager though, it _seems_ like it's
           | the nicer path.
        
             | pd0wm wrote:
             | With modemmanager you get a lot of nice stuff for "free",
             | like automatic reconnect, DHCP, good logging, and an APN
             | database (useful if you don't provide your own SIMs). It
             | also allows you to easily set up correct priorities between
             | WiFi and LTE, both for routing and DNS. Especially DNS is
             | something I didn't think about at first, but the DNS server
             | provided by your LTE connection is not always reachable
             | over your WiFi/ethernet connection.
             | 
             | This is the config I'm using:
             | https://github.com/commaai/agnos-
             | builder/blob/master/userspa...
             | 
             | You can run modemmanager in debug mode, which allows you to
             | send AT commands over dbus (or mmcli) in case you still
             | want to configure some stuff manually or get debug info.
        
         | 0xbadc0de5 wrote:
         | If firmware is your thing - you may want to look into Sierra
         | Wireless EM7355, EM7455, etc series. They are linux compatible
         | and have firmware, docs and SDK available from the Sierra site.
         | https://source.sierrawireless.com/devices/mc-series/mc7455/
        
         | samueldr wrote:
         | You might want to look around the Pinephone and Pinephone Pro
         | communities. Both phones use the EG25-G modem, chosen for
         | better worldwide band availabilities, rather than splitting the
         | Pinephone in "EU" and "NA" batches.
         | 
         | Users also are working on providing a mostly liberated firmware
         | for the modem:
         | 
         | - https://github.com/Biktorgj/pinephone_modem_sdk
        
         | anonymouse008 wrote:
         | My god, this community and the things we toil and labor over,
         | then give freely to one another... is just... dang inspiring.
         | 
         | It makes life worth living.
         | 
         | Thank you kind, brave soul.
        
       | awsanswers wrote:
       | Jeff Geerling is a very special software engineer and public
       | communicator! The internet and the world need more geerlingguys
        
       | riston wrote:
       | Looking for a similar solution, I had one Huawei USB 3G stick
       | lying around and used that with RPI 3. Everything worked just
       | fine but after a couple of days it would randomly disconnect and
       | wouldn't restore the connection so currently, I am looking for
       | some 3G/4G router to do the same job.
        
         | geek_at wrote:
         | When I moved into my new house but the internet fiber was not
         | yet activated I also used a Pi with a Huawei 3g dongle as
         | gateway for my home. Most expensive internet I had to use for 3
         | weeks.
         | 
         | Didn't have any reconnects though but I had a script running
         | checking the connection and if it failed it would re dial
        
       | 0xbadc0de5 wrote:
       | ModemManager / NetworkManager also work really well with these
       | modems on RPi using nmcli.
        
         | davidhyde wrote:
         | I found that using the Ubuntu Server build for RPi supported
         | more modern modems out of the box than Raspberry Pi OS as the
         | latter operating system links to very old builds of these
         | tools.
        
         | geerlingguy wrote:
         | This was something I was exploring a little bit, but as I had
         | some early trouble--and since all the guides I could find
         | seemed to _not_ use MM/NM--I didn't keep trying.
         | 
         | I would like to figure it out though, because it _seems_ they
         | 'd be the more plug-and-play solution if they can work with the
         | modem out of the box.
        
       | sneak wrote:
       | > _A SIM card with a 4G data plan. I bought a SixFab SIM and used
       | their monthly pay-as-you-go service for testing. You could pull
       | out the SIM from your mobile phone (on most carriers at least)
       | but that is a bit inconvenient as your phone won 't get service
       | until you put the SIM back in. You could also get a plan and SIM
       | from any major carrier (e.g. AT&T, T-Mobile, Verizon in the
       | USA)--though you have to make sure the carrier you use works with
       | the LTE modem you have!_
       | 
       | As an aside: You should pull out the SIM from your mobile phone
       | anyway, and use a VPN hotspot instead (and connect your phone to
       | that with Wi-Fi). The carriers are monitoring all of your
       | unencrypted DNS traffic (and your unencrypted SNI traffic that
       | starts all of your TLS/SSL connections that says to which
       | hostname you're connecting) and selling it, alongside your phone
       | number and name. Use a hotspot that supports a VPN so you're only
       | sending VPN traffic across a mobile carrier network.
       | 
       | (This is why T-Mobile in the US is now blocking Apple's "Private
       | Relay" encrypted service and are complaining loudly - it's
       | costing them sniffing-data-resale revenue.)
       | 
       | Same goes for the Pi: make sure you run a VPN client so you're
       | only sending encrypted traffic across the wwan0 interface. Verify
       | with 'tcpdump -i wwan0'.
        
         | kube-system wrote:
         | I feel like you'd probably get more predictable experience by
         | using an always-on VPN configuration on your phone than a wifi
         | hotspot.
        
       | turbinerneiter wrote:
       | I used Huawei USB LTE modems with good success, they are plug and
       | play. Shows up as an wired Ethernet connection.
       | 
       | I just plug them in my laptop first, use the browser based config
       | site to set it up and then put it on the pi.
        
       | walrus01 wrote:
       | Note that where it says:
       | 
       | > A mini PCI Express 4G LTE modem. I used a Quectel EC25-A, but
       | there are some from Sierra Wireless I've heard recommended too.
       | 
       | This is actually just a mini-pci-e adapter board that exposes the
       | USB pins to the USB type A connector seen in the photo. It's not
       | an actual pci-e bus device LTE modem. As shown in the example, it
       | appears to the kernel as a USB device.
        
         | ya_throw wrote:
         | Most PCI cellular modems are actually USB devices, or at least
         | can be put into USB mode.
        
           | geerlingguy wrote:
           | This is something I haven't even researched yet, but are 5G
           | modems (the ones that seem to be more M.2 slot style) also
           | using USB, or are they finally running over the PCIe bus?
        
             | andrewxdiamond wrote:
             | USB 3.2 Gen 2 Supports "up to" 10GBs, same as 5G.
             | 
             | Seems like there would be no reason to upgrade to PCIe,
             | since (I assume) it would be a pretty expensive update for
             | no meaningful change in theoretical max speed.
        
       | hackcasual wrote:
       | Kind of surprisingly, from the opposite end of complexity
       | surprise, for me was getting a Google Fi data only SIM working on
       | an esp32 arduino type environment. Using Lilygo's T-SIM7000G and
       | about an hour of coding got me pinging an MQTT server. Not my
       | video, but very helpful:
       | https://www.youtube.com/watch?v=uMXzOegaY6U
        
       | 0xbadc0de5 wrote:
       | Another very useful project is diag-parser at:
       | https://github.com/moiji-mobile/diag-parser It will pull low-
       | level baseband (NAS, RRC) messages out into PCAP format.
        
       | rileyphone wrote:
       | I developed an integration for LTE for work a few years ago for a
       | linux server, I found the experience the same in how little clear
       | information there was. We tried quite a few different cards,
       | though I can't remember the one that ended up "working" (the
       | project wasn't ever deployed). I could not get qmi_wwan or wvdial
       | to work consistently, which was crucial as if it went down
       | someone would have to physically intervene. I ended up using
       | plain old pppd and chatscripts, which was especially amusing to
       | me as a late millennial who never expected to use such antiquated
       | technologies. Another fidgety thing was the SIM pin, especially
       | given the threat that multiple failed attempts to set it would
       | lead to a lockout. That being said, it is far simpler to just get
       | an LTE modem with ethernet ports and let that take care of the
       | connection.
        
       ___________________________________________________________________
       (page generated 2022-01-20 23:01 UTC)