Table of Contents
LTE
to test the EM7455 Card (+ NGFF Key-B Adapter) on the BPI-R3 (mPCIe Slot)
Kernel-Options:
CONFIG_USB_USBNET=m CONFIG_USB_SERIAL_OPTION=m CONFIG_USB_SERIAL_QUALCOMM=m CONFIG_USB_NET_CDC_MBIM=m CONFIG_USB_NET_QMI_WWAN=m
Needed tools:
root@bpi-r3:~# apt install libqmi-utils libmbim-utils
i'm using a Congstar-SIM
APN-settings: https://forum.congstar.de/thread/46325-mobil-surfen-mit-congstar-manuelle-einstellungen-zum-mobilen-internet-apn/
Some information of different interface modes and which modules are required on Openwrt: https://forum.banana-pi.org/t/bpi-r3-information/12897/83?u=frank-w
Openwrt:
luci-proto-qmi (recommended) or even luci-proto-modemmanager
QMI-Mode
Step-by-step guide with qmicli:
root@bpi-r3:~# qmicli --device=/dev/cdc-wdm0 --get-expected-data-format 802-3 root@bpi-r3:~# qmicli --device=/dev/cdc-wdm0 --wda-get-data-format [/dev/cdc-wdm0] Successfully got data format QoS flow header: no Link layer protocol: 'raw-ip' Uplink data aggregation protocol: 'disabled' Downlink data aggregation protocol: 'disabled' NDP signature: '0' Downlink data aggregation max datagrams: '0' Downlink data aggregation max size: '0' root@bpi-r3:~# ip link set dev wwan0 down root@bpi-r3:~# echo Y > /sys/class/net/wwan0/qmi/raw_ip root@bpi-r3:~# ip link set dev wwan0 up root@bpi-r3:~# qmicli --device=/dev/cdc-wdm0 -p --uim-verify-pin=PIN1,1234 [/dev/cdc-wdm0] PIN verified successfully root@bpi-r3:~# qmicli --device=/dev/cdc-wdm0 -p --uim-get-card-status [/dev/cdc-wdm0] Successfully got card status Provisioning applications: Primary GW: slot '1', application '1' Primary 1X: session doesn't exist Secondary GW: session doesn't exist Secondary 1X: session doesn't exist Slot [1]: Card state: 'present' UPIN state: 'not-initialized' UPIN retries: '0' UPUK retries: '0' Application [1]: Application type: 'usim (2)' Application state: 'ready' Application ID: A0:00:00:00:87:10:02:FF:49:94:20:89:03:10:00:00 Personalization state: 'ready' UPIN replaces PIN1: 'no' PIN1 state: 'enabled-verified' PIN1 retries: '3' PUK1 retries: '10' PIN2 state: 'enabled-not-verified' PIN2 retries: '3' PUK2 retries: '10' root@bpi-r3:~# qmicli -p -v -d /dev/cdc-wdm0 --wds-stop-network=disable-autoconnect --client-cid=37 qmicli -v -p --device=/dev/cdc-wdm0 --wds-set-ip-family=6 qmicli -d /dev/cdc-wdm0 --wds-get-profile-list=3gpp qmicli -d /dev/cdc-wdm0 --wds-get-channel-rates qmicli -d /dev/cdc-wdm0 --dms-set-fcc-authentication qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
MBIM-Mode
https://gist.github.com/Juul/e42c5b6ec71ce11923526b36d3f1cb2c#connecting-using-mbim
qmicli -d /dev/cdc-wdm0 --dms-set-fcc-authentication --device-open-mbim mbimcli --device=/dev/cdc-wdm0 -p --enter-pin=$PIN1 mbim-network /dev/cdc-wdm0 start mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration ip addr add 10.22.186.x/30 dev wwan0 ip link set wwan0 up ip route add default via 10.22.186.y ping 8.8.8.8 mbim-network /dev/cdc-wdm0 stop
first Test
root@bpi-r3:~# modprobe cdc_mbim /etc/mbim-network.conf: APN=internet.v6.telekom PROXY=yes root@bpi-r3:~# mbimcli --device=/dev/cdc-wdm0 --query-device-caps [/dev/cdc-wdm0] Device capabilities retrieved: Device type: 'remote' Cellular class: 'gsm' Voice class: 'no-voice' SIM class: 'removable' Data class: 'umts, hsdpa, hsupa, lte' SMS caps: 'pdu-receive, pdu-send' Ctrl caps: 'reg-manual' Max sessions: '8' Custom data class: 'unknown' Device ID: '352733105743066' Firmware info: 'SWI9X30C_02.24.03.00' Hardware info: 'EM7455' root@bpi-r3:~# mbim-network /dev/cdc-wdm0 start Loading profile at /etc/mbim-network.conf... APN: internet.v6.telekom APN auth protocol: unset APN user: unset APN password: unset mbim-proxy: yes Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm0 --query-subscriber-ready-status --no-close --device-open-proxy'... [/dev/cdc-wdm0] Subscriber ready status retrieved: Ready state: 'device-locked' Subscriber ID: 'unknown' SIM ICCID: '89490200001355851497' Ready info: 'none' Telephone numbers: (0) 'unknown' [/dev/cdc-wdm0] Session not closed: TRID: '4' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 4) Querying registration state 'mbimcli -d /dev/cdc-wdm0 --query-registration-state --no-open=4 --no-close --device-open-proxy'... [/dev/cdc-wdm0] Registration status: Network error: 'unknown' Register state: 'deregistered' Register mode: 'automatic' Available data classes: 'unknown' Curren t cellular class: 'gsm' Provider ID: 'unknown' Provider name: 'unknown' Roaming text: 'unknown' Registration flags: 'packet-service-automatic-attach' [/dev/cdc-wdm0] Session not closed: TRID: '6' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 6) Attaching to packet service with 'mbimcli -d /dev/cdc-wdm0 --attach-packet-service --no-open=6 --no-close --device-open-proxy'... error: operation failed: PinRequired Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 8) Starting network with 'mbimcli -d /dev/cdc-wdm0 --connect=apn='internet.v6.telekom' --no-open=8 --no-close --device-open-proxy'... error: operation failed: PinRequired Network start failed [/dev/cdc-wdm0] Session not closed: TRID: '10' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 10) root@bpi-r3:~#
so it looks like pin-problem and i tried this:
root@bpi-r3:~# mbimcli --device=/dev/cdc-wdm0 -p --enter-pin=1234 [/dev/cdc-wdm0] PIN operation successful [/dev/cdc-wdm0] PIN info: PIN state: 'locked' PIN type: 'pin2' Remaining attempts: '3' root@bpi-r3:~# mbim-network /dev/cdc-wdm0 start Loading profile at /etc/mbim-network.conf... APN: internet.v6.telekom APN auth protocol: unset APN user: unset APN password: unset mbim-proxy: yes Loading previous state from /tmp/mbim-network-state-cdc-wdm0... Previous Transaction ID: 10 error: no actions specified Clearing state at /tmp/mbim-network-state-cdc-wdm0... Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm0 --query-subscriber-ready-status --no-close --device-open-proxy'... [/dev/cdc-wdm0] Subscriber ready status retrieved: Ready state: 'initialized' Subscriber ID: '26201704168zzzz' SIM ICCID: '8949020000135585yyyy' Ready info: 'none' Telephone numbers: (1) '+491512025xxxx' [/dev/cdc-wdm0] Session not closed: TRID: '4' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 4) Querying registration state 'mbimcli -d /dev/cdc-wdm0 --query-registration-state --no-open=4 --no-close --device-open-proxy'... [/dev/cdc-wdm0] Registration status: Network error: 'unknown' Register state: 'deregistered' Register mode: 'automatic' Available data classes: 'unknown' Current cellular class: 'gsm' Provider ID: 'unknown' Provider name: 'unknown' Roaming text: 'unknown' Registration flags: 'packet-service-automatic-attach' [/dev/cdc-wdm0] Session not closed: TRID: '6' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 6) Attaching to packet service with 'mbimcli -d /dev/cdc-wdm0 --attach-packet-service --no-open=6 --no-close --device-open-proxy'... error: operation failed: RadioPowerOff Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 8) Starting network with 'mbimcli -d /dev/cdc-wdm0 --connect=apn='internet.v6.telekom' --no-open=8 --no-close --device-open-proxy'... error: operation failed: RadioPowerOff Network start failed [/dev/cdc-wdm0] Session not closed: TRID: '10' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 10) root@bpi-r3:~#
got a connection in MBIM-Mode:
root@bpi-r3:~# qmicli -d /dev/cdc-wdm0 --dms-set-fcc-authentication --device-open-mbim [/dev/cdc-wdm0] Successfully set FCC authentication root@bpi-r3:~# mbimcli --device=/dev/cdc-wdm0 -p --enter-pin=1234 [/dev/cdc-wdm0] PIN operation successful [/dev/cdc-wdm0] PIN info: PIN state: 'locked' PIN type: 'pin2' Remaining attempts: '3' root@bpi-r3:~# mbim-network /dev/cdc-wdm0 start Loading profile at /etc/mbim-network.conf... APN: internet.telekom APN auth protocol: PAP APN user: congstar APN password: cs mbim-proxy: yes Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm0 --query-subscriber-ready-status --no-close --device-open-proxy'... [/dev/cdc-wdm0] Subscriber ready status retrieved: Ready state: 'initialized' Subscriber ID: '262017041684242' SIM ICCID: '89490200001355851497' Ready info: 'none' Telephone numbers: (1) '+4915120251510' [/dev/cdc-wdm0] Session not closed: TRID: '4' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 4) Querying registration state 'mbimcli -d /dev/cdc-wdm0 --query-registration-state --no-open=4 --no-close --device-open-proxy'... [/dev/cdc-wdm0] Registration status: Network error: 'unknown' Register state: 'home' Register mode: 'automatic' Available data classes: 'lte' Current cellular class: 'gsm' Provider ID: '26201' Provider name: 'congstar' Roaming text: 'unknown' Registration flags: 'packet-service-automatic-attach' [/dev/cdc-wdm0] Session not closed: TRID: '6' Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 6) Attaching to packet service with 'mbimcli -d /dev/cdc-wdm0 --attach-packet-service --no-open=6 --no-close --device-open-proxy'... Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 8) Starting network with 'mbimcli -d /dev/cdc-wdm0 --connect=apn='internet.telekom',auth='PAP',username='congstar',password='cs' --no-open=8 --no-close --device-open-proxy'... Network started successfully Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 11) root@bpi-r3:~# ip a s wwan0 11: wwan0: <BROADCAST,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 3e:06:6b:05:0a:17 brd ff:ff:ff:ff:ff:ff root@bpi-r3:~# mbimcli -d /dev/cdc-wdm0 -p --query-ip-configuration [/dev/cdc-wdm0] IPv4 configuration available: 'address, gateway, dns, mtu' IP [0]: '10.153.121.ip/29' Gateway: '10.153.121.gw' DNS [0]: '10.74.210.210' DNS [1]: '10.74.210.211' MTU: '1500' [/dev/cdc-wdm0] IPv6 configuration available: 'address, gateway, dns, mtu' IP [0]: '2a01:598:808c:ba9c:c4e4:7a88:29ea:xxxx/64' Gateway: '2a01:598:808c:ba9c:93d:409b:3ddb:ee7' DNS [0]: '2a01:598:7ff:0:10:74:210:210' DNS [1]: '2a01:598:7ff:0:10:74:210:211' MTU: '1500' root@bpi-r3:~# ip a s wwan0 11: wwan0: <BROADCAST,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 3e:06:6b:05:0a:17 brd ff:ff:ff:ff:ff:ff root@bpi-r3:~# ip addr add 10.153.121.ip/29 dev wwan0 root@bpi-r3:~# ip link set wwan0 up [ 357.976946] 8021q: adding VLAN 0 to HW filter on device wwan0 root@bpi-r3:~# ip route add default via 10.153.121.gw root@bpi-r3:~# ip r default via 10.153.121.gw dev wwan0 10.153.121.net/29 dev wwan0 proto kernel scope link src 10.153.121.ip root@bpi-r3:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=113 time=210 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=113 time=30.6 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=113 time=83.7 ms ^C --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 30.566/108.191/210.347/75.416 ms root@bpi-r3:~#
change Mode
Caution this may break functionality!
Make sure all known modules are loaded:
root@bpi-r3:~# modprobe qmi_wwan root@bpi-r3:~# modprobe qcserial root@bpi-r3:~# modprobe cdc_mbim
Get and switch mode (device open param should match your current Mode):
root@bpi-r3:~# qmicli -d /dev/cdc-wdm0 --device-open-mbim --dms-swi-get-usb-composition [/dev/cdc-wdm0] Successfully retrieved USB compositions: USB composition 6: DM, NMEA, AT, QMI [*] USB composition 8: DM, NMEA, AT, MBIM USB composition 9: MBIM root@bpi-r3:~# qmicli -d /dev/cdc-wdm0 --device-open-qmi --dms-swi-get-usb-composition [/dev/cdc-wdm0] Successfully retrieved USB compositions: [*] USB composition 6: DM, NMEA, AT, QMI USB composition 8: DM, NMEA, AT, MBIM USB composition 9: MBIM root@bpi-r3:~# qmicli -d /dev/cdc-wdm0 --device-open-mbim --dms-swi-set-usb-composition 6 root@bpi-r3:~# qmicli -d /dev/cdc-wdm0 --device-open-qmi --dms-swi-set-usb-composition 8
After that you will be prompted to set device offline and do reset.
qmicli ... --dms-set-operating-mode=offline qmicli ... --dms-set-operating-mode=reset
and you should see unregister of current devices and register of new, here switch from QMI to MBIM:
[ 435.846807] usb 1-1.1: USB disconnect, device number 4 [ 435.852478] qcserial ttyUSB0: Qualcomm USB modem converter now disconnected from ttyUSB0 [ 435.860767] qcserial 1-1.1:1.0: device disconnected [ 435.866377] qcserial ttyUSB1: Qualcomm USB modem converter now disconnected from ttyUSB1 [ 435.874650] qcserial 1-1.1:1.2: device disconnected [ 435.880265] qcserial ttyUSB2: Qualcomm USB modem converter now disconnected from ttyUSB2 [ 435.888540] qcserial 1-1.1:1.3: device disconnected [ 435.893721] qmi_wwan 1-1.1:1.8 wwx269b6469dbbd: unregister 'qmi_wwan' usb-11200000.usb-1.1, WWAN/QMI device [ 443.533425] usb 1-1.1: new high-speed USB device number 5 using xhci-mtk [ 443.763963] usb 1-1.1: config 1 has an invalid interface number: 12 but max is 4 [ 443.771366] usb 1-1.1: config 1 has an invalid interface number: 13 but max is 4 [ 443.778764] usb 1-1.1: config 1 has an invalid interface number: 13 but max is 4 [ 443.786158] usb 1-1.1: config 1 has no interface number 1 [ 443.791544] usb 1-1.1: config 1 has no interface number 4 [ 443.799669] qcserial 1-1.1:1.0: Qualcomm USB modem converter detected [ 443.806455] usb 1-1.1: Qualcomm USB modem converter now attached to ttyUSB0 [ 443.814219] qcserial 1-1.1:1.2: Qualcomm USB modem converter detected [ 443.820906] usb 1-1.1: Qualcomm USB modem converter now attached to ttyUSB1 [ 443.828921] qcserial 1-1.1:1.3: Qualcomm USB modem converter detected [ 443.835728] usb 1-1.1: Qualcomm USB modem converter now attached to ttyUSB2 [ 443.898553] usbcore: registered new interface driver cdc_ether [ 443.964054] usbcore: registered new interface driver cdc_ncm [ 444.034077] cdc_mbim 1-1.1:1.12: cdc-wdm0: USB WDM device [ 444.040007] cdc_mbim 1-1.1:1.12 wwan0: register 'cdc_mbim' at usb-11200000.usb-1.1, CDC MBIM, 66:9b:64:69:db:bd [ 444.050308] usbcore: registered new interface driver cdc_mbim
troubleshooting
In my case no device is recognized by driver (no serial ttyUSBx too). Fixed this by adding usb-id in qcserial and qmi_wwan driver.
But before i tried these steps:
i saw in dmesg only this (also after cold-reset):
[ 3.592655] usb 1-1.1: new high-speed USB device number 4 using xhci-mtk [ 3.823392] usb 1-1.1: config 1 has an invalid interface number: 8 but max is 3 [ 3.830719] usb 1-1.1: config 1 has no interface number 1
with this i have got access to the AT-Interface:
lsusb:
Bus 001 Device 004: ID 413c:81c2 Dell Computer Corp. DW5811e Snapdragon™ X7 LTE
unlock ttyUSBx with option-module:
root@bpi-r3:~# modprobe option [ 229.747728] usbcore: registered new interface driver option [ 229.753429] usbserial: USB Serial support registered for GSM modem (1-port) root@bpi-r3:~# echo 413c 81c2 >/sys/bus/usb-serial/drivers/option1/new_id [ 300.293186] option 1-1.1:1.0: GSM modem (1-port) converter detected [ 300.299755] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0 [ 300.307011] option 1-1.1:1.2: GSM modem (1-port) converter detected [ 300.313657] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1 [ 300.320968] option 1-1.1:1.3: GSM modem (1-port) converter detected [ 300.327741] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2 [ 300.336533] option 1-1.1:1.8: GSM modem (1-port) converter detected [ 300.343262] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB3
now only with “minicom -D /dev/ttyUSB2”. (commandmode with Ctrl+AA, because already via Minicom on the R3)
ATE1 OK AT!ENTERCND="A710" OK AT!CUSTOM? !CUSTOM: GPSENABLE 0x04 GPSSEL 0x01 IPV6ENABLE 0x01 SIMLPM 0x01 USBSERIALENABLE 0x01 SINGLEAPNSWITCH 0x01 OK AT!USBCOMP? Config Index: 1 Config Type: 1 (Generic) Interface bitmask: 0020010D (diag,nmea,modem,rmnet0,ubist) OK AT!USBCOMP=? !USBCOMP: AT!USBCOMP=<Config Index>,<Config Type>,<Interface bitmask> <Config Index> - configuration index to which the composition applies, s <Config Type> - 1:Generic, 2:USBIF-MBIM, 3:RNDIS config type 2/3 should only be used for specific Sierra customized VID/PID should use config type 1 <Interface bitmask> - DIAG - 0x00000001, NMEA - 0x00000004, MODEM - 0x00000008, RMNET0 - 0x00000100, RMNET1 - 0x00000400, MBIM - 0x00001000, e.g. 10D - diag, nmea, modem, rmnet interfaces enabled 1009 - diag, modem, mbim interfaces enabled The default configuration is: at!usbcomp=1,1,10F OK
can't set default-mode, but the following fixes it and go back to mbim-mode after a cold-boot (ttyUSB accessible via options-module too)
AT!USBCOMP=1,1,100D OK AT!RESET OK