Bring up Raspberry Pi

To bring up your Raspberry Pi (my Pi is version 3 B) please follow the below link:

How to bring up Pi using NOOS

Download Siera Wireless Linux drivers

I am going to integrate the EM7565 LTE device into my Raspberry Pi ver 3 B. So I would next like to download the Linux for the device. The recommended drivers are available from SieraWireless website. You might need to create a account with them. Check with your vendor dor the details of the account and then check where to find the driver links etc. In my case the driver archives were located here.

Cross Compile the Linux drivers

After you have successfully downloaded the linux drivers in the previous step, you should have a SierraLinuxQMIdriversS2.35N2.54.tar.bz2 file in your Download folder. In my case it is located at the default Download folder called ~/Download/SierraLinuxQMIdriversS2.35N2.54.tar.bz2. Extract this file with the below command:

Now, do a ls to see what you have got after extracting the driver archive.

$ ls -la 
total 128
drwxr-xr-x  4 vbhadra vbhadra  4096 Nov 21 05:58 .
drwxr-xr-x 29 vbhadra vbhadra 28672 Feb 26 14:37 ..
drwxr-xr-x  2 vbhadra vbhadra  4096 Nov 21 05:59 GobiNet
drwxr-xr-x  2 vbhadra vbhadra  4096 Nov 21 05:59 GobiSerial

So in my case two folder have been created GobiNet and GobiSerial. GobiNet would emulate the device as a serial (actually it emulates as 3 usb serial device, ttyUBB0, ttyUSB1, ttyUSB2) and GobiNet handles the data packets like a linux network driver. What you need to do is to cross compile these two drivers and then take the .ko files for both the driver to the Rasp Pi and dynamically insert those into the running kernel inside the Pi.

For cross compiling the drivers you may follow the instructions in the below:

How to cross compile Gobi drivers.

Transfer the Driver .ko files to Raspberry Pi

Attach the SD card to your Linux PC. Copy the .ko driver images into the sd card and then un-mount it as below:

vbhadra@vbhadra-8200-elit-convertable-microtower:~/rpi/GobiNet$ mount
...
...
/dev/sdb1 on /media/vbhadra/7EFE-4409 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

~/rpi/GobiNet$ cp GobiNet.ko /media/vbhadra/7EFE-4409/.
~/rpi/GobiSerial$ cp GobiSerial.ko /media/vbhadra/7EFE-4409/.
~/rpi/GobiNet$ umount /media/vbhadra/7EFE-4409

Now, take out the SD card from your local Linux PC and attach it to the Pi. Once attached Pi should detect it automatically. It is by default mounted under:

/media/pi/<sd card label>

I usually mount it in a more easier location. Like in the below commands I am mounting it in my home directory under a folder named usb:

pi@raspberrypi:~ $ mkdir usb
pi@raspberrypi:~ $ mount -t vfat /dev/sda1 usb/
pi@raspberrypi:~ $ ls usb/
 20-02-2020   detect_practice2.nnb   GobiNet_pi_build.ko   log_02142020_01.txt             log.txt            Makefile_GobiSerial   Pi              'System Volume Information'
 2.ppm        GobiNet.ko             GobiSerial.ko         log_02142020_over_weekend.txt   Makefile_GobiNet   myobject              scratchpad.txt

In the above case the SD card has been mounted by Pi kernel under /dev/sda and /dev/sda1 is the partition which I am mounting. It could be mounted by kernel under /dev/sdb, /dev/sdc… etc as well. If you are not sure, you can check with dmesg command.

Now, for EM7565 device and Gobi* drivers it is recommended that you disable two linux’s default drivers: qcserial and qmi_wwan, as these may interfere in the operation of the Gobi* drivers. To do that you have add the below two lines in the following file:

pi@raspberrypi:~ $ sudo touch /etc/modprobe.d/blacklist-modem.conf
pi@raspberrypi:~ $ sudo vim.tiny /etc/modprobe.d/blacklist-modem.conf
blacklist qcserial
blacklist qmi_wwan

Now, do a reboot of the Rasberry Pi system.

pi@raspberrypi:~ $ sudo shutdown -r now

Once it come back do the following:

pi@raspberrypi:~ $ export OUTPUTDIR=/lib/modules/`uname -r`/kernel/drivers/net/usb/
pi@raspberrypi:~ $ cp ~/usb/GobiNet.ko $OUTPUTDIR 
pi@raspberrypi:~ $ sudo cp ~/usb/GobiSerial.ko $OUTPUTDIR
pi@raspberrypi:~ $ sudo depmod
pi@raspberrypi:~ $ modprobe GobiSerial 
pi@raspberrypi:~ $ sudo modprobe GobiNet 
pi@raspberrypi:~ $ dmesg | grep -i "Gobi*"
[  318.763626] GobiSerial: loading out-of-tree module taints kernel.
[  318.764822] usbcore: registered new interface driver GobiSerial
[  318.764895] usbserial: USB Serial support registered for GobiSerial
[  318.764920] GobiSerial: 2019-11-22/SWI_2.39:GobiSerial
[  593.404829] GobiNet: 2019-11-22/SWI_2.60
[  593.405285] usbcore: registered new interface driver GobiNet

As you can see the Gobi* drivers have now been insmod-ed into the Pi linux kernel.

You can check the dmesg logs to confirm yours. Last few lines of your log file should look like the above.

Now, check if there has been any emulated ttyUSB nodes created with the below command:

pi@raspberrypi:~ $ dmesg | grep -i "ttyUSB*"
pi@raspberrypi:~ $ 

As you can see in my case there is still no ttyUSB* device node created.

The GobiSerial driver will create 3 ttyUSB* nodes as soon as you attach the device into the USB port. If it doesn’t, something is not quite right.

Attach the EM7565 LTE device to the USB port of the RaspPi

Now, attach your LTE EM7565 device to the Raspberry Pi USB port. It looks like the below in my setup:

Once you attach the device to the USB port, go back to your Pi console and type the below command and notice the outputs, it should look something like the below as I can see in my console:

pi@raspberrypi:~ $ dmesg
[64326.392221] Under-voltage detected! (0x00050005)
[64332.632157] Voltage normalised (0x00000000)
[64336.052097] usb 1-1.2: new high-speed USB device number 10 using dwc_otg
[64336.182652] usb 1-1.2: config 1 has an invalid interface number: 8 but max is 3
[64336.182670] usb 1-1.2: config 1 has no interface number 1
[64336.183359] usb 1-1.2: New USB device found, idVendor=1199, idProduct=9091, bcdDevice= 0.06
[64336.183371] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[64336.183381] usb 1-1.2: Product: Sierra Wireless EM7565 Qualcomm® Snapdragon™ X16 LTE-A
[64336.183391] usb 1-1.2: Manufacturer: Sierra Wireless, Incorporated
[64336.183400] usb 1-1.2: SerialNumber: UF92377624041506
[64336.184899] GobiSerial 1-1.2:1.0: GobiSerial converter detected
[64336.185236] usb 1-1.2: GobiSerial converter now attached to ttyUSB0
[64336.185902] GobiSerial 1-1.2:1.2: GobiSerial converter detected
[64336.186381] usb 1-1.2: GobiSerial converter now attached to ttyUSB1
[64336.187548] GobiSerial 1-1.2:1.3: GobiSerial converter detected
[64336.188063] usb 1-1.2: GobiSerial converter now attached to ttyUSB2
[64336.188763] QMAP Disabled
[64336.190634] GobiNet 1-1.2:1.8 eth1: register 'GobiNet' at usb-3f980000.usb-1.2, GobiNet Ethernet Device, 0a:af:20:e2:05:08
[64336.191368] USB Speed : USB 2.0
[64336.291051] usbcore: registered new interface driver cdc_wdm
[64336.294292] usbcore: registered new interface driver qmi_wwan
[64336.433554] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[64357.572160] creating qcqmi0
[64357.572495] RawIP mode

Notice the below line, which obviously indicates the SieraWireless device EM7565 has been detected by the Kernel:

[64336.183391] usb 1-1.2: Manufacturer: Sierra Wireless, Incorporated

Also, notice that the GobiSerial driver is in action, and has created 3 different emulated USB ports, ttyUSB0, ttyUSB1 and ttyUSB2. The most important one at this point is the ttyUSB2 which we will need in a minute for issuing AT commands to configure the device.

[64336.184899] GobiSerial 1-1.2:1.0: GobiSerial converter detected
[64336.185236] usb 1-1.2: GobiSerial converter now attached to ttyUSB0
[64336.185902] GobiSerial 1-1.2:1.2: GobiSerial converter detected
[64336.186381] usb 1-1.2: GobiSerial converter now attached to ttyUSB1
[64336.187548] GobiSerial 1-1.2:1.3: GobiSerial converter detected
[64336.188063] usb 1-1.2: GobiSerial converter now attached to ttyUSB2

You can also double check the ttyUSB* ports with the blow command:

pi@raspberrypi:~ $ dmesg | grep -i "ttyUSB*" 
[64336.185236] usb 1-1.2: GobiSerial converter now attached to ttyUSB0
[64336.186381] usb 1-1.2: GobiSerial converter now attached to ttyUSB1
[64336.188063] usb 1-1.2: GobiSerial converter now attached to ttyUSB2

Also, note that the GobiNet driver is in action and has created an ethernet interface eth1 for data exchange as can be evident in the below log lines:

[64336.190634] GobiNet 1-1.2:1.8 eth1: register 'GobiNet' at usb-3f980000.usb-1.2, GobiNet Ethernet Device, 0a:af:20:e2:05:08
[64336.191368] USB Speed : USB 2.0

At this point we will open yet another terminal on the console and move there to open a serial communication channel with the device. But just to be vigilant on what’s going on the kernel log I do this on the current console:

pi@raspberrypi:~ $ tail -f /var/log/messages 
Sep 26 21:29:49 raspberrypi kernel: [64336.294292] usbcore: registered new interface driver qmi_wwan
Sep 26 21:29:49 raspberrypi mtp-probe: checking bus 1, device 10: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Sep 26 21:29:49 raspberrypi mtp-probe: bus: 1, device: 10 was not an MTP device
Sep 26 21:29:49 raspberrypi kernel: [64336.433554] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
Sep 26 21:30:10 raspberrypi kernel: [64357.572160] creating qcqmi0
Sep 26 21:30:10 raspberrypi kernel: [64357.572495] RawIP mode

As you can see the new ethernet interface eth1 is not yet ready:

Sep 26 21:29:49 raspberrypi kernel: [64336.433554] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready

To check this let’s try another command to see what is the status of the eth1 interface:

pi@raspberrypi:~ $ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:37:67:e0  txqueuelen 1000  (Ethernet)
        RX packets 306  bytes 353615 (345.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 172  bytes 17176 (16.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4227<UP,BROADCAST,NOARP,MULTICAST>  mtu 1500
        ether 0a:af:20:e2:05:08  txqueuelen 1000  (Ethernet)
        RX packets 22397  bytes 24982435 (23.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12996  bytes 1190453 (1.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:62:32:b5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Notice in the above command the eth1 ethernet interface doesn’t have any IP assigned yet which is in line with our anticipation as we have not configured the device yet:

eth1: flags=4227 mtu 1500
ether 0a:af:20:e2:05:08 txqueuelen 1000 (Ethernet)
RX packets 22397 bytes 24982435 (23.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12996 bytes 1190453 (1.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Open serial terminal

Now, open another terminal window and move there. To open a serial port I prefer minicom which doesn’t come with my installation of NOOBS. So there is no minicom at this point in my Pi. I luckily had a ethernet line coming to my desk. Hence, I connected that and installed minicom as below:

pi@raspberrypi:~ $ sudo apt-get install minicom 

Need to find a way to install minicom if you want to use it. But maybe you can try miniterm. I am not sure and haven’t tried it at all. I will it to you to resolve. Once you have minicom (or any other terminal emulator of you choice), configure it as below:

Serial Device      : /dev/ttyUSB2                           Bps/Par/Bits       : 115200 8N1                             Hardware Flow Control : Yes                                 Software Flow Control : No                                   

Configure the device

In the serial console type the below commands:

Welcome to minicom 2.7.1

OPTIONS: I18n                                                                
Compiled on Aug 13 2017, 15:25:34.                                           
Port /dev/ttyUSB2                                                            
                                                                             
Press CTRL-A Z for help on special keys                                                                                                                   
ati                                                                          
Manufacturer: Sierra Wireless, Incorporated                                  
Model: EM7565                                                                
Revision: xxxx_01.08.04.00 xxx jenkins 2018/08/21 21:40:11            
IMEI: 353533100239139                                                        
IMEI SV:  8                             
FSN: XXXXXXXX                     
+GCAP: +CGSM                            
                                                                                
OK                                      
at+creg?
+CREG: 0,1

OK
at+cgreg?
+CGREG: 0,1

You need to find out your device manufacturer’s AT commands. It usually follows the same set of commands. However, it may vary from vendor to vendor. So check with them. As in the above you can the device manufacturer’s details and the firmware details are being displayed with the ati command. Below are few other commands which you can try as well:

at+cgdcont?
+CGDCONT: 1,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0

Insert a SIM

At this point I will insert an appropriate SIM into the device’s SIM slot.

Once you have inserted the SIM into the device slot go back to your minicom terminal and issue the below commands:

OK                                      
at+creg?
+CREG: 0,1

OK
at+cgreg?
+CGREG: 0,1

OK
at+cgdcont?
+CGDCONT: 1,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0

OK
at!scact=1,1
OK

at+cgdcont=1,"IPV4V6","wap.vodafone.co.uk" 
OK
at+cgdcont?
+CGDCONT: 1,"IPV4V6","wap.vodafone.co.uk","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0

OK
at!scact=1,1

At this point you should have internet connectivity at you Rasp Pi. Try openning google.co.uk or something else and have fun. At the moment I am experimenting with the device and will possibly add on stuffs here. So watch this space.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.