How to use BPI-4G LTE module with BPI-R2

(ZB) #1

1.Firstly, use R2 connects LTE module by USB or 14pin Headers. then execute command "lsusb" to have a look if R2 have drove the module. The red box is the id of 4G module.


After seeing this, execute command "ls /dev/ttyUSB*" to make sure the 4G module have been recognised as USB devs.


2. Execute the "./ &"


then execute command “ifconfig -a”,you will see ppp0

3. Execute command ”wget -O speedtest-cli” to download speed test tool.

4. Execute command "chmod +x speedtest-cli",  then execute "./speedtest-cli"


ppp1_success_log.txt (5.7 KB)


(1) You could get from here :

(2) Q: What should I do, if you meet this "expect (OK) ^M alarm Failed " image

A:The root cause is the Modem.service has used the module usbserial, so the 4G module can’t use usbserial; we can solve the problem by using command "systemctl disable ModemManager.service " or "systemctl stop ModemManager.service "

(3) Q:How to test the communication between SIM card and 4G module?

A:Use minicom, ”minicom -D /dev/ttyUSB2”,and then use AT commands to test, such as ”at”,”at+csq”,“at+ccid”,if you get response without error,that means the communication is OK.

(4) Q: How to install libqmi?

A: Download from here: ; then make and make install.

If you meet this:

you need to install libgudev-1.0-dev, then make and make install again.

(5) Q:How to use qmi-wwan

A:There is a very easy way to use,I’ve put quectel-CM in home path of root,just execute “./quectel-CM &”,then execute “dhclient wwan0”,now you have finished the configurations.

(6) Q:How to use GPS

A:BPI-4G module supports GPS and BeiDou,execute “minicom -D /dev/ttyUSB2”,then input AT commands like this:

if you want to use BeiDou,just input AT commands like this:


(7) Here are kernel configurations and driver patch for kernel 4.14.

config (120.3 KB) patch (6.6 KB)

(8) Support areas:

  • EC25-E support: EMEA/Thailand/India/South Korea

  • EC25-AU support: Australia

  • EC25-V/-A support:North America

(9) Openwrt Supported:

A. Clone the source code from this link : BPI-R2 OpenWrt(LEDE) Souce code : 2018-04-11

B. Add qmi-wwan driver to this project :

  • Execute “./scripts/feeds/ install minicom” to install minicom to openwrt project

  • Execute “./scripts/feeds/ install python” to install python to openwrt project

  • Execute “make menuconfig”

  • Add minicom “Utilities —> Terminal —> minicom”

  • Add python “Languages —> Python”

  • Add driver “Network —> wwan …Genetic OpenWrt 3G/4G proto handler”

  • Add "Kernel modules —> USB Support —>


    kmod-usb-net —> kmod-usb-net-qmi-wwan


    kmod-usb-serial —> kmod-usb-serial-option , kmod-usb-serial-wwan



  • Use these source files to replace your openwrt project source files (“build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/linux-4.9.44/drivers/usb(or net)/…”) : image

C. Image & Stuff Link :

D. Cross-Compile quectel-CM

  • Copy “quectel-CM” to Linux host PC,and change “Makefile” under the “quectel-CM”,change tools like this:

    The tools are under openwrt project,you can find them according to the following picture.


  • If ping Domain name fail,add “nameserver” to /etc/resolv.conf



(10) If you use mPCIE interface 4G module to connect R2 by 14 pin header,use these cmds to enable 4G module,after you did these steps,USB0 port will be disable.

  • cd /sys/class/gpio/
  • echo 266 > export 【# 266(gpio_offset) = 232(base) + 34(GPIO_34)】
  • cd gpio266/
  • echo out > direction
  • echo 1 > value

BPI-4G LTE module for banana pi (USB interface) public sale
BPI-4G LTE module for banana pi (USB interface)
BPI-R2 New Image Release : Ubuntu 16.04 V1.3 2018-3-30
BPI-R2 new image: Ubuntu with Linux kernel 4.14 release V1.0 2018-4-28
(Wolfgang) #2

Good writeup, however you are operating the modem in PPP mode, which limits the maximum speed you will be able to achieve. This modem is a LTE Cat.4 modem capable of 150MBps downlink speed, with PPP you will probably max out between 10-20 MBps.

This is too broad of a topic for me to elaborate in greater detail, but to achieve better performance you need to have the qmi-wwan driver recognize the modem, which should result in a ‘wwan0’ interface. You should also have a /dev/cdc-wdm0 device file. Next, make sure to install libqmi and use qmicli to start a network connection. ModemManager can actually do all this for you automatically, however I’m not sure from which kernel onwards the Quectel EC25 LTE module is supported. My guess is that kernel 4.14 might work out of the box…

(ZB) #3

wow,you are cool,are you skilled about this part? thanks for your advice,EC25 support qmi-wwan, I will have a try.

I have added qmi-wwan driver,I will do more test about this.:wink:



(Wolfgang) #4

I know a bit about this, but I don’t have an EC25 modem. A few pointers:

  • I highly recommend trying this with a 4.14 kernel. The wwan0 interface to the modem can operate in 802.3 mode (frames carrying an Ethernet header) or in raw IP mode. Very likely the EC25 will only support raw IP mode (this is the case for all newer Qualcomm based modems) Setting this up in older kernels often requires patches to the qmi-wwan driver. On a new kernel you simply enter

    echo 1 > /sys/class/net/wwan0/qmi/raw_ip

  • Next, try if you can talk to the modem using QMI. Install libqmi and try a simple status query:

    qmicli -d /dev/cdc-wdm0 --nas-get-signal-info

    [/dev/cdc-wdm0] Successfully got signal info


      RSSI: '-79 dBm'
      RSRQ: '-14 dB'
      RSRP: '-111 dBm'
      SNR: '4.6 dB'
  • If this works, use ‘qmi-network’ to start a connection. Please google this command for more information on how to use it…

(ZB) #5

Hello,wtolkien, I have tested qmi-wwan,I succeed to get ip for wwan0, and use data speed tool to test speed,as you say,the performance of qmi is better than ppp.

(ZB) #6

And I also think it’s depend on network situation,here I got 70Mb/s speed.


(Wolfgang) #7

Excellent! I’m glad you got it to work. 70Mb/s is actually really good for real world testing!

(ZB) #8

Thanks for your advice wtolkien;:grinning:

I will post GPS testing result later.

(gary) #9

Please integrate latest kernel(including qmi driver) in latest release, also please provide the instruction about how to use qmi-www in release notes. Good job, thanks.

(ZB) #10

OK,Gary,I will put qmi instruction in this thread.

(ZB) #11

I’ve put qmi-wwan usage instructions and GPS usage instructions in FAQ,if you guys have any questions,please let me know . Thanks.

(Prakash) #12

Hi. I attached the 4G LTE USB module on R2 board by USB OTG cable. When I type,


Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 2c7c:0125
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ls /dev/ttyUSB*

ls: cannot access ‘/dev/ttyUSB*’: No such file or directory

I am using @frank-w 4.14.28-bpi-r2-main kernel.


(ZB) #13

Hello,Did you enable CONFIG_USB_SERIAL_OPTION?

Could you please try to enable “USB driver for GSM and CDMA modems”?

(Prakash) #14

Hi. Should I enable this configuration in kernel configuration file & recompile?. If so, may I know if we have any precompiled for 4G LTE USB module. Otherwise, I will recompile it.


(ZB) #15

I tested with Kernel4.4, I will have a test with kernel 4.14,but now could you please recompile by yourself?

(ZB) #16

Hello,I have succeed to add ppp and qmi-wwan driver to kernel 4.14,I will make a patch to this repo which is based on frank’s.

(Prakash) #17

@Jackzeng glad to hear from you. Appreciate if you share your 4.18.32 kernel binary. I am also building my kernel source.


(ZB) #18

Hello, here is the patch file for the kernel 4.14; if you want the image, I will post it here later.

you need also modify the kernel configurations, you can compare with yours.

config (120.3 KB) patch (6.6 KB)

best regards.

(Prakash) #19

@Jackzeng Thanks. I have done it. Got the ports. However, facing other issues and unable to make it work with ppp. The log is as follow. I am using Vodafone 4G SIM and the APN is www, user name & pwd are empty.

> ./ &                                                                                            
> [1] 8212
> quectel-pppd options in effect:
> devname   /dev/ttyUSB3    # (default)
> apn       www    # (default)
> user         # (default)
> password     # (default)
> pppd options in effect:
> debug           # (from command line)
> nodetach                # (from command line)
> dump            # (from command line)
> noauth          # (from command line)
> user            # (from command line)
> password ??????         # (from command line)
> /dev/ttyUSB3            # (from command line)
> 115200          # (from command line)
> lock            # (from command line)
> K ATI\\;+CSUB\\;+CSQ\\;+CPIN?\\;+COPS?\\;+CGREG?\\;\\&D2 OK AT+CGDCONT=1,\\\"IP\\\",\\\"www\\\",,0,0 OK ATD*99# CONNECT'
>                 # (from command line)
> disconnect chat -s -v ABORT ERROR ABORT \"NO DIALTONE\" SAY \"\\nSending break to the modem\\n\" \"\" +++ \"\" +++ \"\" +++ SAY \"\\nGo
> od bay\\n\"             # (from command line)
> nocrtscts               # (from command line)
> modem           # (from command line)
> asyncmap 0              # (from /etc/ppp/options)
> lcp-echo-failure 4              # (from /etc/ppp/options)
> lcp-echo-interval 30            # (from /etc/ppp/options)
> hide-password           # (from /etc/ppp/options)
> novj            # (from command line)
> novjccomp               # (from command line)
> ipcp-accept-local               # (from command line)
> ipcp-accept-remote              # (from command line)
> noipdefault             # (from command line)
> ipcp-max-configure 30           # (from command line)
> defaultroute            # (from command line)
> usepeerdns              # (from command line)
> noccp           # (from command line)
> noipx           # (from /etc/ppp/options)
> abort on (BUSY)
> abort on (NO CARRIER)
> abort on (NO DIALTONE)
> abort on (ERROR)
> abort on (NO ANSWER)
> timeout set to 30 seconds
> send (AT^M)
> expect (OK)
> ^M
> OK
>  -- got it
> send (ATE0^M)
> expect (OK)
> ^M
> ^M
> OK
>  -- got it
> send (ATI;+CSUB;+CSQ;+CPIN?;+COPS?;+CGREG?;&D2^M)
> expect (OK)
> ^M
> ^M
> Quectel^M
> EC25^M
> Revision: EC25EFAR02A08M4G^M
> ^M
> SubEdition: V04^M
> ^M
> +CSQ: 99,99^M
> ^M
> ^M
> +COPS: 0^M
> ^M
> +CGREG: 0,0^M
> ^M
> OK
>  -- got it
> send (AT+CGDCONT=1,"IP","www",,0,0^M)
> expect (OK)
> ^M
> ^M
> OK
>  -- got it
> send (ATD*99#^M)
> expect (CONNECT)
> ^M
> ^M
>  -- got it
> SUB\;+CSQ\;+CPIN?\;+COPS?\;+CGREG?\;\&D2 OK AT+CGDCONT=1,\"IP\",\"www\",,0,0 OK ATD*99# CONNECT'' finished (pid 8215), status = 0x0
> Serial connection established.
> using channel 3
> Using interface ppp0
> Connect: ppp0 <--> /dev/ttyUSB3
> sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xba9fe554> <pcomp> <accomp>]
> rcvd [LCP ConfReq id=0x5 <asyncmap 0x0> <auth chap MD5> <magic 0xd1228a58> <pcomp> <accomp>]
> sent [LCP ConfNak id=0x5 <auth pap>]
> rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xba9fe554> <pcomp> <accomp>]
> rcvd [LCP ConfReq id=0x6 <asyncmap 0x0> <auth pap> <magic 0xd1228a58> <pcomp> <accomp>]
> sent [LCP ConfAck id=0x6 <asyncmap 0x0> <auth pap> <magic 0xd1228a58> <pcomp> <accomp>]
> sent [LCP EchoReq id=0x0 magic=0xba9fe554]
> sent [PAP AuthReq id=0x1 user="" password=<hidden>]
> rcvd [LCP DiscReq id=0x7 magic=0xd1228a58]
> rcvd [LCP EchoRep id=0x0 magic=0xd1228a58 ba 9f e5 54]
> rcvd [PAP AuthAck id=0x1 ""]
> PAP authentication succeeded
> sent [IPCP ConfReq id=0x1 <addr> <ms-dns1> <ms-dns2>]
> Modem hangup
> Connection terminated.
> CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7 | VT102 | Online 0:42 | ttyUSB0

(ZB) #20

Hello,try to modify here in to www