botletics / SIM7000-LTE-Shield

Botletics SIM7000 LTE CAT-M1/NB-IoT Shield for Arduino
https://www.botletics.com/products/sim7000-shield
GNU General Public License v3.0
481 stars 216 forks source link

Linux USB Driver #15

Open rmarlan opened 6 years ago

rmarlan commented 6 years ago

I am trying to support Raspberry Pi 3. The linux driver code has the 7100 but not the 7000 listed. When I try to compile on raspberry - jesse it gives error: make[1]: *** /lib/modules/4.9.59-v7+/build: No such file or directory. Stop.

The Simcom site says there are both linux and android drivers for the 7000, but I can not find them.

The module works perfectly with Arduino! Thanks. Bob

imrj commented 4 years ago

@crazydiam0nd @jupiter8888 ill be dam....all the wasted time and installing this got it working in < 5min.....unbelievable....and with a GUI and all......am all set....hope works out for you guys too, it should oh its free too....

https://raspap.com/

crazydiam0nd commented 4 years ago

@jupiter8888 I've not got a Pi 3 or 4 as lent it to someone but I've moved the sheild away from the Pi and put the Pi in an anti static bag, and that's stopped it crashing. Thanks for the heads up on the dongle, I may get one and reverse engineer it.

@cellphonedude it was your original qmi guide that I followed on github that led me in the right direction, so thanks for that. I had to change a few commands and remove the need for APN user name and password. But this has got me online. Just the IP doesn't stick for long before it changes back and on every reboot I have to start all over again. But making progress.

@imrj I'm not really looking for a GUI solution but will look into this and see if it will run in CMI GUI is so slow on a Pi zero

Actually looking at an orange pi 4G board, they look promising.

jupiter8888 commented 4 years ago

@crazydiam0nd I have one of these sleeping on my shelve, usless for me as it doesn't work here in Canada, you want it? make me an offer i'll ship it to you.

crazydiam0nd commented 4 years ago

@jupiter8888 why doesn't it work in Canada? I'm in the UK. Surely you have world Sims?

jupiter8888 commented 4 years ago

https://www.aliexpress.com/item/32858836485.html

It's like your botletic shield, sim7000E is for Europe, sim7000A for america and sim7000G is global.

imrj commented 4 years ago

@jupiter8888 @crazydiam0nd this is what it looks for me in a working state, using with zerotier now and its very reliable (ive scrambled my ether and IPs)

enxb827e67f694f: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether b8:27:eb:67:69:4f 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

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

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether b8:27:eb:67:3c:2a 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

wwan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 22.187.177.175 netmask 255.255.255.252 broadcast 22.186.107.107 ether 32:5d:3d:6a:55:1d txqueuelen 1000 (Ethernet) RX packets 3407 bytes 775014 (756.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 6148 bytes 962442 (939.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

zt2lr3yo3a: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 2800 inet 172.27.77.48 netmask 255.255.0.0 broadcast 172.27.255.255 ether b2:f7:3a:87:4a:c1 txqueuelen 1000 (Ethernet) RX packets 1103 bytes 112966 (110.3 KiB)

imrj commented 4 years ago

@jupiter8888 @crazydiam0nd

notice my ethernet and wifi on the Pi are both unassigned, so as to they not be the default routes....zerotier interface (last one) is default route, havent tried enabling either one of them yet.....

I never got the modem to show as any other adapter type except wwan0 (ppp was possible when i tried it as a dial connection, but was messy)

crazydiam0nd commented 4 years ago

@jupiter8888 @crazydiam0nd

notice my ethernet and wifi on the Pi are both unassigned, so as to they not be the default routes....zerotier interface (last one) is default route, havent tried enabling either one of them yet.....

I never got the modem to show as any other adapter type except wwan0 (ppp was possible when i tried it as a dial connection, but was messy)

I've requested a refund on the HAT, Its been days now and have followed every guide, script and command going. I had success but soon as a ping was requested the IP would disappear. I even installed the Modem Supervisor Script for RAW-IP Modems

Is it the SIM7000E NB-IoT HAT that you are using? people are having success with the 7600 but I doubt I will ever touch another SimCom embedded device again after this and the lack of support.

Now I need to find one that will work and won't cost the earth

jupiter8888 commented 4 years ago

@crazydiam0nd I'm using this: https://www.aliexpress.com/item/32967753699.html Set apn, cecmmode and away you go. Don't try it with a pi zero, EMI will kick out the device from the usb port. with full size usb like pi 3,4 or orange pi no problem.

You have a CAT-M1 or NB-iot Sim card don't you? As you know that regular 3g, 4g, lte sims won't work with this modem.

crazydiam0nd commented 4 years ago

@crazydiam0nd I'm using this: https://www.aliexpress.com/item/32967753699.html Set apn, cecmmode and away you go. Don't try it with a pi zero, EMI will kick out the device from the usb port. with full size usb like pi 3,4 or orange pi no problem.

You have a CAT-M1 or NB-iot Sim card don't you? As you know that regular 3g, 4g, lte sims won't work with this modem.

That's incredibly cheap. I may have to order one. And this works PPP? Basically I need the internet connection up constantly.

Yes I'm using an IOT simcard made by tele2iot that's a world SIM and I purchased from a company that supplies all of my alarm monitoring diallers.

This unit kind of looks like the SIXFAB one that I was considering buying. Uses a mini PCI card.

I'm using with the Pi Zero but have managed to prevent it getting interference, if it wasn't for you mentioning it before then I'd probably have never worked it out, so Thanks for that I used a longer quality usb cable and this stopped it crashing.

I might get an Esp32 instead or another embedded board. Needs to be small enough to fit inside my project. I'll order another pi 3 and test different boards

jupiter8888 commented 4 years ago

It' up constantely, with the cecmmode=1 setup, it's like your lan.

I also have the pycom GPY with PYTRACK basically an esp32 and a CAT-M1 modem made by sequans put on a gps shield, works, but you'll have to get your hands dirty as support is scarse and you have to dig in the forums for up to date information. And cheap too.

crazydiam0nd commented 4 years ago

@jupiter8888 Cheers my friend, you're very helpful.

I've contacted the sellers on AliExpress for details. Only problem with them is the 2 month delivery times 🤦🏻‍♂️ I got a parcel through the door the other day and it was like Xmas, I'd forgotten I'd even ordered it all.

I think my project requirements definitely need to be Linux based as I can roll out firmware updates, give remote support etc. I think the orange Pi is mainly Android based which would be good if I could get Node-Red working. I prefer Linux and python and some C

I may order one of those SixFab boards although they are expensive, then possibly use the Chinese 7600 and compare results. Crazy that these boards are so difficult where the USB dongles can work plug and pray

jupiter8888 commented 4 years ago

Armbian (raspbian like) for orange pi, well maintained and stable.

crazydiam0nd commented 4 years ago

Thanks, I shall order an Orange Pi too. And one of these as looks like it does everything I require https://sixfab.com/product/raspberry-pi-lte-m-nb-iot-egprs-cellular-hat/

jupiter8888 commented 4 years ago

Beware that raspi's hat that need i2c won't work with an orange pi, they mixed the i2c ports. i2c 1 on the raspi's is i2c 0 on the opi. Try the opi pc plus, it has onboard emmc, no need sd card afer install. Let us know how how the sixfab works.

jupiter8888 commented 4 years ago

@crazydiam0nd

It's been a while, and i did more testings with the sim7000 chip (plug in USB) and i have to retract.

The CECMMODE=1 way of connecting proved to lead to disconnects, in fact Simcom does'nt recomment it. Itried hard with QMI and never succeeded. Now i found this way with Wvdial thru PPP:

https://medium.com/@naveenkumarasinghe/auto-connecting-usb-modems-on-linux-raspberry-pi-with-wvdial-daemon-90db240916de

Simple, and it just work and keep a consistent connection.

Side note: On a Pi Zero, keep the antenna far from the Pi as possible and the use of shileded usb cable is mandatory, real shielded cables, i mean the shield have to go from one connector to the other.

https://www.yoctopuce.com/EN/article/usb-cables-shielding-matters-as-well

sansoy commented 3 years ago

Just an update, and possible tutorial to get this board working successfully with the Raspberry PI: @botletics - This is a lengthy post and would be suited for a wiki page, just don't know where to post one at.

Before we beign, you will need to have these two things to make this work

  • a lipo battery as stated - I used a 3.7 1800 mah lipo
  • a micro usb male to male connector - I spliced two cables to make one, power is not needed, just the data cables (white & green)

The reason for the lipo battery is to supply enough current so the board can function without turning off the pi. The reason for the micro usb cable is because we are going to use this board as a QMI modem and not mess with any of the AT commands stuff. It is still supported but I'd rather just have a internet connection and my choice of communication protocol to use.

Step 1: Install the latest stretch image i'm using 2019-04-08-raspbian-stretch-lite and once you've gotten your configuration setup the way you want via raspi-config (ssh, timezone, locale etc) you are ready to begin the setup.

Step 2: Power the device The pi zero has a 5v out which can be connected to the 5v in on the board (the one close to the two ground points); Just wire / solder / the 5v to 5V and the pi ground to ground. The battery full light should come on and say on when it has power. If the lte (blue led) is not blinking, hold down the power on switch for a couple seconds to turn it on. Once both lights are active plug in the device via the micro usb male to male cable.

Step 3: Check for device detection Run this command ls -al /dev/ttyUSB* you should see ttyUSB0 ttyUSB1 ttyUSB2 ttyUSB3 ttyUSB04

Also, if you run ifconfig You should see a wwan0 device listed If you don't see this then you might need to install the drivers like mentioned above, but going off a fresh image for the pi zero I did not encounter this issue. To test AT commands, I would install gammu sudo apt install gammu then create a config file at this location ~/.gammurc

[gammu]
device = /dev/ttyUSB2
connection = at

The AT port will be ttyUSB2 and to validate your device run this command sudo gammu identify This should spit out the device information.

Step 4: QMI Modem Setup Alot of the information I got here is based on the documentation here: http://www.embeddedpi.com/documentation/3g-4g-modems/raspberry-pi-sierra-wireless-mc7455-modem-raw-ip-qmi-interface-setup But there are some bits missing that I had to search countless forums to find a solution - install the latest libqmi-utils

apt remove libqmi-utils
wget http://www.freedesktop.org/software/libqmi/libqmi-1.22.4.tar.xz
tar -vxf libqmi-1.22.4.tar.xz
cd libqmi-1.22.4
./configure --prefix=/usr --disable-static
make && sudo make install

This will take a long time on the pi zero w, about 30 mins to complete. If you have a pi3 I would do it on there and run make -j 4 && sudo make install to speed things up

Once that is done, it's time to fix a bug in the qmi code: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=845979 Edit this file: /usr/bin/qmi-network find this string: START_NETWORK_ARGS="apn='$APN'" and change it to: START_NETWORK_ARGS="'apn=$APN'"

Or if you would rather do it from the terminal, run this command sudo sed -i "s/apn='/'apn=/g" /usr/bin/qmi-network

Once that's done, install udhcpc sudo apt install -y udhcpc

As this modem only works in raw-ip mode (- not fully clear what that is); even if you connect to a carrier you will not be assigned an IP until you request one, which is what udhcpc does.

Next, create a file to store your APN information sudo nano /etc/qmi-network.conf I'm using a thingsmobile SIM card so my info looks like this APN=TM,ip-type=4 save the file, and now it's time to test the connection.

Step 5: Internet Please? First, try to ping google.com via the wwan0 interface for 4 tries: ping -c 4 -I wwan0 www.google.com you should see 100 packet loss, now it's time to tell the modem to connect to the carrier via:

qmicli -d /dev/cdc-wdm0 --device-open-"net=net-raw-ip|net-no-qos-header" --wds-start-network="apn=TM,ip-type=4" --client-no-release-cid

ip link set dev wwan0 down

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

ip link set dev wwan0 up

The first command is the connect command, you might not need the --wds-start-network parameter, but I put it in there to make sure it used the correct APN values. The next three commands put the modem in raw-ip mode (more info about that from the URL in Step 4) Once that command completes, it's time to get an IP address udhcpc -i wwan0 You should see a sending discover output in the terminal a handful of times, before getting an IP with a lease time. Once you have that and can verify your IP is that same via ifconfig you can test pinging google again ping -c 4 -I wwan0 www.google.com This time you should have a 0% packet loss.

Hopefully this will help anyone who wants to use this board with a raspberry pi and also doesn't want to be limited to using AT commands.

I was able to have it up and running using nodejs + socket.io to do bi-directional communication from the pi and my server, sending data from an attached sensor every second in real time for 3+ days with no issue.

Thanks to @botletics for creating such a great board.

hi. i've followed step 1 with a fresh install of Stretch and step 2 successfully. however in step 3 i'm unable to see any /dev/ttyUSB* or wwan0. Any suggestions would be awesomely appreciated.

nkaramolegos commented 8 months ago

I can not make it work using pi3B+. I don't know why I bought this hat. Very bad support from the Chinese company. Outdated, but they still sell. I tried what @MikeBosw mentioned (thank you) and I have the errors:

[ 1456.669008] GobiSerial: Unknown symbol usb_wwan_suspend (err -2)
[ 1456.669105] GobiSerial: Unknown symbol usb_wwan_resume (err -2)

During sudo modprobe usbserial && sudo insmod GobiSerial.ko My kernel is 6.1.0-rpi8-rpi-v8 and I am using the 64bit version of OS Debian GNU/Linux 12

Bad investment.