Connecting EC25 using VintageNetMobile

Hi there, I’m trying to use VintageNetMobile with a Quectel EC25 modem in a rpi4, but I haven’t been able to get it work, when I run VintageNet.get_by_prefix([]) I got (the part related with ppp0):

  {["interface", "ppp0", "config"],
   %{
     type: VintageNetMobile,
     vintage_net_mobile: %{
       modem: VintageNetMobile.Modem.QuectelEC25,
       service_providers: [%{apn: "imovil.virginmobile.cl"}]
     }
   }},
  {["interface", "ppp0", "connection"], :disconnected},
  {["interface", "ppp0", "state"], :retrying},
  {["interface", "ppp0", "type"], VintageNetMobile}

It is posible to send AT commands (I don’t know why that works, because AFAIK the /dev/ttyUSB3 is used by VintageNetMobile.Modem.QuectelEC25)

iex(19)> Elixircom.run("/dev/ttyUSB3", speed: 115200)
at
OK
ATI
Quectel
EC25
Revision: EC25AUFAR02A04M4G

OK

the last thing that I get with dmesg

[    6.798652] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[    6.804770] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[   11.064161] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   13.058396] usb 1-1.3: new high-speed USB device number 3 using xhci_hcd
[   13.199423] usb 1-1.3: New USB device found, idVendor=2c7c, idProduct=0125, bcdDevice= 3.18
[   13.208005] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[   13.216335] usb 1-1.3: Product: Android
[   13.221219] usb 1-1.3: Manufacturer: Android
[   13.305067] usbcore: registered new interface driver option
[   13.310936] usbserial: USB Serial support registered for GSM modem (1-port)
[   13.318297] option 1-1.3:1.0: GSM modem (1-port) converter detected
[   13.324980] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[   13.332511] option 1-1.3:1.1: GSM modem (1-port) converter detected
[   13.339184] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
[   13.346472] option 1-1.3:1.2: GSM modem (1-port) converter detected
[   13.353126] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
[   13.360397] option 1-1.3:1.3: GSM modem (1-port) converter detected
[   13.367007] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3

It’s important to note that I connect the modem with the rpi4 through USB, using an adapter. Any suggestion on how to debug the problem?. I tried connecting the modem in a Linux based computer and it worked (the ppp connection)

Could you check whether the wwan0 network interface is present? VintageNet.info and ifconfig can do this.

VintageNetMobile wants that the wwan0 interface is present before it even attempts to set up the PPP connection on /dev/ttyUSB3. If VintageNetMobile were a little smarter it could do better, but I believe this is the problem.

Since you have the modem’s serial ports working, I’m inferring that you’ve enabled the required kernel modules at https://github.com/nerves-networking/vintage_net_mobile/blob/main/lib/vintage_net_mobile/modem/quectel_EC25.ex#L60-L66. If you haven’t, then maybe that’s the issue (plus I’m surprised that the serial ports showed up)

As a final guess, could you run dmesg? There might be a hint in the kernel logs as to why wwan0 isn’t showing up or maybe something else is happening.

Thank you for your answer.

I had a couple of modules missing (CONFIG_USB_SERIAL_WWAN and CONFIG_USB_WDM).

By the way, the same configuration works with the simcom 7600

1 Like

That’s really good to know about the simcom modem. When you get a chance, could you post a PR or an issue (and I’ll make the change) to the VintageNetMobile project with the Linux kernel options and anything else relevant to someone else using a SIMCOM 7600 modem?

Thanks again for reporting back!

It worked straight away with the configuration of the EC25, there is an issue related with simcom modems, I commented there.

just let me know if there is anything else to test

1 Like

This is great news, thanks @nadsat and @fhunleth .

Could you please share how you’ve enabled the required kernel modules?

And a sample use of the EC25 modem?

I added these modules to a base Nerves system (in my case was rpi4)

CONFIG_PPP=m
CONFIG_PPP_BSDCOMP=m
CONFIG_PPP_DEFLATE=m
CONFIG_PPP_FILTER=y
CONFIG_PPP_MPPE=m
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
CONFIG_USB_NET_CDC_NCM=m
CONFIG_USB_NET_HUAWEI_CDC_NCM=m
CONFIG_USB_NET_QMI_WWAN=m
CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_SERIAL_WWAN=m
CONFIG_USB_WDM=m
CONFIG_USB_USBNET=m
CONFIG_USB_NET_DRIVERS=m

in the nerves_defconfig

BR2_PACKAGE_USB_MODESWITCH=y
BR2_PACKAGE_PPPD=y
BR2_PACKAGE_PPPD_FILTER=y
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="${NERVES_DEFCONFIG_DIR}/busybox.fragment"

and the busybox.fragment

CONFIG_MKNOD=y
CONFIG_WC=y

finally the configuration in target.exs

{"ppp0",
  %{
    type: VintageNetMobile,
    vintage_net_mobile: %{
      modem: VintageNetMobile.Modem.QuectelEC25,
      service_providers: [
        %{apn: "apn.provider.com"}
      ]
    }
}}

That worked for both EC25 and sim7600

1 Like

Hi @nadsat and @fhunleth I’m back with tests SIM7080G using USB connection. Trying to setup Quetcel EC25 on rpi0 target.

iex(9)> VintageNet.get_by_prefix([])                    
[
  {["available_interfaces"], ["wlan0"]},
  {["connection"], :internet},
  {["interface", "eth0", "config"],
   %{ipv4: %{method: :dhcp}, type: VintageNetEthernet}},
  {["interface", "eth0", "connection"], :disconnected},
  {["interface", "eth0", "state"], :retrying},
  {["interface", "eth0", "type"], VintageNetEthernet},
  {["interface", "lo", "addresses"],
   [
     %{
       address: {0, 0, 0, 0, 0, 0, 0, 1},
       family: :inet6,
       netmask: {65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535},
       prefix_length: 128,
       scope: :host
     },
     %{
       address: {127, 0, 0, 1},
       family: :inet,
       netmask: {255, 0, 0, 0},
       prefix_length: 8,
       scope: :host
     }
   ]},
  {["interface", "lo", "hw_path"], "/devices/virtual"},
  {["interface", "lo", "lower_up"], true},
  {["interface", "lo", "mac_address"], "00:00:00:00:00:00"},
  {["interface", "lo", "present"], true},
  {["interface", "ppp0", "config"],
   %{
     type: VintageNetMobile,
     vintage_net_mobile: %{
       modem: VintageNetMobile.Modem.QuectelEC25,
       service_providers: [%{apn: "internet.easym2m.eu"}]
     }
   }},
  {["interface", "ppp0", "connection"], :disconnected},
  {["interface", "ppp0", "state"], :retrying},
  {["interface", "ppp0", "type"], VintageNetMobile},
  {["interface", "usb0", "addresses"],
   [
     %{
       address: {65152, 0, 0, 0, 41166, 1791, 65208, 51384},
       family: :inet6,
       netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0},
       prefix_length: 64,
       scope: :link
     },
     %{
       address: {172, 31, 131, 33},
       family: :inet,
       netmask: {255, 255, 255, 252},
       prefix_length: 30,
       scope: :universe
     }
   ]},
  {["interface", "usb0", "config"], %{type: VintageNetDirect}},
  {["interface", "usb0", "connection"], :lan},
  {["interface", "usb0", "hw_path"],
   "/devices/platform/soc/20980000.usb/gadget"},
  {["interface", "usb0", "lower_up"], true},
  {["interface", "usb0", "mac_address"], "a2:ce:06:b8:c8:b8"},
  {["interface", "usb0", "present"], true},
  {["interface", "usb0", "state"], :configured},
  {["interface", "usb0", "type"], VintageNetDirect},
  {["interface", "wlan0", "addresses"],
   [
     %{
       address: {65152, 0, 0, 0, 47655, 60415, 65063, 58576},
       family: :inet6,
       netmask: {65535, 65535, 65535, 65535, 0, 0, 0, 0},
       prefix_length: 64,
       scope: :link
     },
     %{
       address: {192, 168, 106, 206},
       family: :inet,
       netmask: {255, 255, 255, 0},
       prefix_length: 24,
       scope: :universe
     }
   ]},
  {["interface", "wlan0", "config"],
   %{
     ipv4: %{method: :dhcp},
     type: VintageNetWiFi,
     vintage_net_wifi: %{
       networks: [
         %{
           key_mgmt: :wpa_psk,
           mode: :infrastructure,
           psk: "-----------------------------",
           ssid: "FGM-HOMEOFFICE"
         }
       ]
     }
   }},
  {["interface", "wlan0", "connection"], :internet},
  {["interface", "wlan0", "hw_path"],
   "/devices/platform/soc/20300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1"},
  {["interface", "wlan0", "lower_up"], true},
  {["interface", "wlan0", "mac_address"], "b8:27:eb:27:e4:d0"},
  {["interface", "wlan0", "present"], true},
  {["interface", "wlan0", "state"], :configured},
  {["interface", "wlan0", "type"], VintageNetWiFi},
  {["interface", "wlan0", "wifi", "access_points"],
   [
     %VintageNetWiFi.AccessPoint{
       band: :wifi_2_4_ghz,
       bssid: "f4:92:bf:90:af:da",
       channel: 11,
       flags: [:wpa2_psk_ccmp, :wps, :ess],
       frequency: 2462,
       signal_dbm: -34,
       signal_percent: 93,
       ssid: "FGM-HOMEOFFICE"
     }
   ]},
  {["interface", "wlan0", "wifi", "clients"], []},
  {["interface", "wlan0", "wifi", "current_ap"],
   %VintageNetWiFi.AccessPoint{
     band: :wifi_2_4_ghz,
     bssid: "f4:92:bf:90:af:da",
     channel: 11,
     flags: [:wpa2_psk_ccmp, :wps, :ess],
     frequency: 2462,
     signal_dbm: -34,
     signal_percent: 93,
     ssid: "FGM-HOMEOFFICE"
   }}
]

I think I’m missing something in the target rpi0 setup. Since dmesg:

[   17.925430] dwc2 20980000.usb: 20980000.usb supply vusb_d not found, using dummy regulator
[   17.925534] dwc2 20980000.usb: Linked as a consumer to regulator.0
[   17.925556] dwc2 20980000.usb: 20980000.usb supply vusb_a not found, using dummy regulator
[   17.925695] dwc2 20980000.usb: Configuration mismatch. dr_mode forced to device
[   18.029245] dwc2 20980000.usb: dwc2_check_params: Invalid parameter lpm=1
[   18.029267] dwc2 20980000.usb: dwc2_check_params: Invalid parameter lpm_clock_gating=1
[   18.029279] dwc2 20980000.usb: dwc2_check_params: Invalid parameter besl=1
[   18.029287] dwc2 20980000.usb: dwc2_check_params: Invalid parameter hird_threshold_en=1
[   18.029322] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[   18.029770] using random self ethernet address
[   18.029783] using random host ethernet address
[   18.031889] usb0: HOST MAC 1a:8b:ae:f5:f1:16
[   18.032400] usb0: MAC 66:b2:98:18:e1:20
[   18.032471] using random self ethernet address
[   18.032482] using random host ethernet address
[   18.032617] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[   18.032629] g_ether gadget: g_ether ready
[   18.032661] dwc2 20980000.usb: bound driver g_ether
[   18.544869] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   18.544894] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[   18.561378] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready
[   22.633212] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

And Vintagenet Info:

iex(7)> VintageNet.Info.info()                          
VintageNet 0.9.1

All interfaces:       ["lo", "usb0", "wlan0"]
Available interfaces: ["wlan0"]

Interface eth0
  Type: VintageNetEthernet
  Present: false
  Configuration:
    %{ipv4: %{method: :dhcp}, type: VintageNetEthernet}

Interface ppp0
  Type: VintageNetMobile
  Present: false
  Configuration:
    %{
      type: VintageNetMobile,
      vintage_net_mobile: %{
        modem: VintageNetMobile.Modem.QuectelEC25,
        service_providers: [%{apn: "internet.easym2m.eu"}]
      }
    }

Interface usb0
  Type: VintageNetDirect
  Present: true
  State: :configured (1 days, 4:14:53)
  Connection: :disconnected (1 days, 4:14:54)
  Addresses: 172.31.131.33/30
  Configuration:
    %{type: VintageNetDirect}

Interface wlan0
  Type: VintageNetWiFi
  Present: true
  State: :configured (1 days, 4:14:53)
  Connection: :internet (1 days, 4:14:46)
  Addresses: 192.168.106.206/24, fe80::ba27:ebff:fe27:e4d0/64
  Configuration:
    %{
      ipv4: %{method: :dhcp},
      type: VintageNetWiFi,
      vintage_net_wifi: %{
        networks: [
          %{
            key_mgmt: :wpa_psk,
            mode: :infrastructure,
            psk: "....",
            ssid: "FGM-HOMEOFFICE"
          }
        ]
      }
    }

:ok

In the other hand in raspbian without install additional linux drivers it is detected:

Not sure if the kernel setup and other requirements you have done are well done in my side.

Any idea on how to debug USB on rpi0 target. Or a sample use options on QuectelEC25 to properly setup PPP on rpi0?

Options:
 
  * `:ppp_tty` - A tty for the PPP connection. This defaults to `"ttyUSB2"`
    which works unless other USB serial devices cause Linux to set it to
    something different.

I haven’t worked with the SIM7080, but according to what you showed using raspbian, you may need to include CONFIG_USB_NET_CDCETHER (check if the name is right). Also the set of AT commands might defer from SIM7600 or EC25.